BSDstats Project v1.0

User Freebsd freebsd at
Sat Aug 5 03:25:32 UTC 2006

'k folks ... the quick and dirty .. actually, not too dirty ...

The attached script goes into /etc/periodic/monthly (and can be run from 
the command line) and is the *very* barebones ... it reports operating 
system and architecture ... it will return a unique id at the same time 
which will be used when we add in the pciconf output ...

I have it recording two things: IP and hostname ... I figure it is highly 
unlikely for two hosts to ever have both identical, so a *fairly* safe 
unique key to work with ... and unless someone is running a whack of 
machines behind NAT with the same hostname, it gives us a safe unique 
counter for those behind NAT ...

The backend is storing the data in a database right now, so what I'm 
curious most about is someone running behind NAT with a few servers, or 
behind a proxy, just to see what sort of results ...

I'm going to try and get the pciconf output added into it later tonight, 
and will post a follow up, but this at leave gives something to test 
against ...

Right now, there is no "output" on the web site, but I do have a link to, 
and daily run of, awstats, which will at least show some figures ... once 
there is data in the database, I'll start working up a stats page based on 
the #s there ...

Note that once you've added this script, you need to add:


to /etc/periodic.conf so that it will run monthly ... and, of course, you 
can run it manually, instead of waiting until the end of the month ...

You can also run it as often as you like, it will only record one 
submission *per* month, but it will update the data based on the last 
submission (ie. if you upgrade, or add/remove hardware) ...

Its a start ... will work on extending it to add the pciconf output next, 
and send a v2.0 script as soon as that is ready :)

Marc G. Fournier           Hub.Org Networking Services (
Email . scrappy at                              MSN . scrappy at
Yahoo . yscrappy               Skype:        ICQ . 7615664
-------------- next part --------------
#!/bin/sh -
# $FreeBSD: src/etc/periodic/monthly/300.accounting,v 1.10 2002/09/24 18:53:46 ache Exp $

# If there is a global system configuration file, suck it in.
monthly_statistics_mailto="scrappy at,root"
if [ -r /etc/defaults/periodic.conf ]
    . /etc/defaults/periodic.conf

umask 066

case "$monthly_statistics_enable" in
      SYS=`/usr/bin/uname -r`
      ARCH=`/usr/bin/uname -m`
      /usr/bin/fetch -qo /tmp/getid$HN\&sys=$SYS\&arch=$ARCH
    *)  rc=0;;

umask $oldmask
exit $rc

More information about the freebsd-questions mailing list