Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Aug 2006 00:25:28 -0300 (ADT)
From:      User Freebsd <freebsd@hub.org>
To:        freebsd-questions@freebsd.org
Subject:   BSDstats Project v1.0
Message-ID:  <20060804182042.U25268@ganymede.hub.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]

'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:

monthly_statistics_enable="YES"

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 (http://www.hub.org)
Email . scrappy@hub.org                              MSN . scrappy@hub.org
Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664
[-- Attachment #2 --]
#!/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@hub.org,root"
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

oldmask=$(umask)
umask 066

case "$monthly_statistics_enable" in
    [Yy][Ee][Ss])
      HN=`/bin/hostname`
      SYS=`/usr/bin/uname -r`
      ARCH=`/usr/bin/uname -m`
      /usr/bin/fetch -qo /tmp/getid http://bsdstats.hub.org/scripts/getid.php?hn=$HN\&sys=$SYS\&arch=$ARCH
      ;;
    *)  rc=0;;
esac

umask $oldmask
exit $rc
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060804182042.U25268>