Tuesday, August 08, 2006

Using BSDStats

If you want to have hardware manufacturers and applicationn vendors take you seriously, it helps to have metrics. Today I learned of BSDStats, which uses the sysutils/bsdstats shell script to collect information on hosts. I decided to try it and see what data is collected.

First I installed the script.

orr:/usr/ports/sysutils/bsdstats# make install
...edited...
===> Installing for bsdstats-2.0_5
===> Generating temporary packing list
===> Checking if sysutils/bsdstats already installed
/bin/mkdir -p /usr/local/etc/periodic/monthly
/bin/cp /usr/ports/sysutils/bsdstats/files/300.statistics /usr/local/etc/periodic/monthly
/bin/cat /usr/ports/sysutils/bsdstats/pkg-message

********************
To enable the port, edit or create /etc/periodic.conf and add this line:
monthly_statistics_enable=yes

To enable device reporting, add this line:
monthly_statistics_report_devices=yes

To run it manually the first time, just run it as:
/usr/local/etc/periodic/monthly/300.statistics

To view current statistics, go to:
http://bsdstats.hub.org
********************

===> Registering installation for bsdstats-2.0_5

I looked at /usr/local/etc/periodic/monthly/300.statistics and saw it was a shell script. To enable it I added the lines to /etc/periodic.conf as recommended above. Next I set a HTTP proxy environment variable and ran the script.

orr:/home/richard$ HTTP_PROXY=http://192.168.2.12:3128; export HTTP_PROXY
orr:/home/richard$ env | grep HTTP
HTTP_PROXY=http://192.168.2.12:3128
orr:/home/richard$ sh -x /usr/local/etc/periodic/monthly/300.statistics
+ [ -r /etc/defaults/periodic.conf ]
+ . /etc/defaults/periodic.conf
+ periodic_conf_files=/etc/periodic.conf /etc/periodic.conf.local
+ local_periodic=/usr/local/etc/periodic /usr/X11R6/etc/periodic
+ daily_output=root
+ daily_show_success=YES
...edited...
+ /bin/hostname
+ HN=orr.taosecurity.com
+ /usr/bin/uname -r
+ SYS=6.1-RELEASE
+ /usr/bin/uname -m
+ ARCH=i386
+ /usr/bin/uname -s
+ OS=FreeBSD
+ /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/getid.php?hn=orr.taosecurity.com
&sys=6.1-RELEASE&arch=i386&opsys=FreeBSD
+ IFS=

+ /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/clear_devices.php?
hn=orr.taosecurity.com
+ /usr/sbin/pciconf -l
+ /usr/bin/grep -v none
+ echo agp0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x71908086 rev=0x03 hdr=0x00
+ awk -F@ {print $1}
+ DRIVER=agp0
+ awk {print $4}
+ echo agp0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x71908086 rev=0x03 hdr=0x00
+ cut -c12-15
+ VEN=8086
+ echo agp0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x71908086 rev=0x03 hdr=0x00
+ awk {print $4}
+ cut -c8-11
+ DEV=7190
+ /usr/bin/fetch -qo /dev/null http://bsdstats.hub.org/scripts/report_device.php?driver=agp0&vendor=8086
&device=7190&hn=orr.taosecurity.com
+ echo pcib1@pci0:1:0: class=0x060400 card=0x00000000 chip=0x71918086 rev=0x03 hdr=0x01+ awk
-F@ {print $1}
+ DRIVER=pcib1
+ echo+ awk+ cut pcib1@pci0:1:0: class=0x060400 card=0x00000000 chip=0x71918086
rev=0x03 hdr=0x01 {print $4} -c12-15
...truncated...

As you can see, various aspects of the system are being posted to a PHP script at bsdstats.hub.org. These populate the release and driver statistics.

Consider running this script to let vendors know you're using their products.

3 comments:

Royce said...

I'll be using this wherever I can. We should tell Pair Networks, Yahoo! and some other big FreeBSD shops.

Anonymous said...

See also this post for the most recent improvements.

bingo websites said...
This comment has been removed by a blog administrator.