a picture is not always worth a thousand words

In a previous incarnation, I did some work with network and system monitoring, and since I have a network here at my house, I continue to fiddle with this stuff.
RRDTOOL examples

network/host graphs

I used a tool called MRTG when I worked at CNN but it was limited to two datapoints: it’s hard to tell a complete picture with that, and a new tool was created to address that. rrdtool (round robin database tool) allows as many datapoints as you like, flexible graphing, all kinds of stuff. So I tried using it for a couple of weather graphs (one for the nearest NOAA station to me, at Boeing Field in Renton and Tallahassee Airport, near where my parents live).

I plot 60 days of data on each. It’s starting to get a bit busy on each graph.

It’s not that hard to do: just cryptic, or so I thought. First you create a datafile.

rrdtool create ~/rrdtool/weather.rrd –step 300 DS:temp:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200RRA:MIN:0.5:12:2400 RRA:MAX:0.5:12:2400RRA:AVERAGE:0.5:12:2400 DS:humidity:GAUGE:600:0:100 RRA:AVERAGE:0.5:1:1200 RRA:MIN:0.5:12:2400 RRA:MAX:0.5:12:2400 RRA:AVERAGE:0.5:12:2400 DS:windspeed:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200RRA:MIN:0.5:12:2400 RRA:MAX:0.5:12:2400RRA:AVERAGE:0.5:12:2400 DS:dewpoint:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200RRA:MIN:0.5:12:2400 RRA:MAX:0.5:12:2400RRA:AVERAGE:0.5:12:2400

Then you wrap all the steps to update the rrd and optionally make a new graph in a shell script. I use GrabWeather from the gkrellmweather plugin: google will show you the way.
#!/bin/sh
DATE=`date`
WORKDIR=/usr/local/etc/rrdtool
/usr/X11R6/bin/GrabWeather KBFI
cat ~/.wmWeatherReports/KBFI.TXT | $WORKDIR/weather.pl > data.txt
/usr/local/bin/rrdtool update $WORKDIR/weather.rrd `cat data.txt `
/usr/local/bin/rrdtool graph –title “weather recorded at KBFI @ $DATE” weather.png DEF:temp=weather.rrd:temp:AVERAGE DEF:humidity=weather.rrd:humidity:AVERAGE DEF:wind=weather.rrd:windspeed:AVERAGE DEF:dewpoint=weather.rrd:dewpoint:AVERAGE -s -60days LINE2:humidity#FF0000:”humidity (%)” LINE2:wind#00FF00:”windspeed (mph)” LINE2:dewpoint#0000FF:”dewpoint (F)” LINE2:temp#FFFF00:”temperature
(F)”

And that’s that. The one for disk space appears to be broken (or to have never worked before week 15) , but the only real difference is the data acquisition method: I use SNMP. One of the more vexing problems is that SNMP values are not standard from one OS to another, so you may be able to access the same datapoints on different OSes by different names. Or you might discover that on some, what you want isn’t implemented (disk/volume utilization info on OS X, frinstance).

#!/bin/sh
DATE=`date`
TIME=”N”
DIR=/usr/local/etc/rrdtool
cd $DIR
TMPFILE=./blue-disk.tmp
DATAFILE=./blue-disk.dat
if [ -e $TMPFILE ]; then
rm $TMPFILE
fi
SNMPVALS=`/usr/local/bin/snmpget -Oqv blue public dskPercent.1 dskPercent.2 dskPercent.3`
echo $TIME $SNMPVALS > $TMPFILE
mv $TMPFILE $DATAFILE
unset LANG
perl -pi -e “s# #:#g” $DATAFILE
/usr/local/bin/rrdtool update blue-disk.rrd `cat $DATAFILE`
/usr/local/bin/rrdtool graph –title “disk percentages as of $DATE” blue-disk.png DEF:root=blue-disk.rrd:root:AVERAGE DEF:usr=blue-disk.rrd:usr:AVERAGE DEF:var=blue-disk.rrd:var:AVERAGE -s -60days LINE2:usr#FF0000:”usr” LINE2:var#00FF00:”var” LINE2:root#FFFF00:”root”