Monitoring Tiger via SNMPD over the network (III)
Changed the way that the used percentage from the HDDs are being polled from Thor, because the old way was way too cumbersome, changed from using 'snmpdf' (and having to parse the result) to use 'snmpget' to poll only the necesary data.
Querying the 'dskPercent' MIB, in which, 'dskPercent.1' will be the first partition (whether is a disk or not) that you defined on your '/etc/snmpd.conf' file
From this:
/usr/local/bin/snmpdf -v 2c -Cu -c XXXXXXXXX thor | awk '{print $5}' | tail -r -n 2 | tail -n 1 | cut -d% -f 1
To this:
/usr/local/bin/snmpget -v 2c -Oqv -c XXXXXXXXX thor dskPercent.2
Where, 'dskPercent.2' is the disk/ partition that you want to query. Leaner, faster and easier on the eyes :D
So, the snip from the /etc/mrtg.cfg file on Judith looks like this now:
Title[thor_root_df]: Percentage use /dev/disk1s3 file system
PageTop[thor_root_df]: Use /dev/disk1s3/ file system
Target[thor_root_df]: `/usr/local/bin/snmpget -v 2c -Oqv -c XXXXXXXXXXXX thor dskPercent.1`
options[thor_root_df]: gauge,transparent,nopercent,noinfo,nobanner
Unscaled[thor_root_df]: ymwd
MaxBytes[thor_root_df]: 100
YLegend[thor_root_df]: Use %
ShortLegend[thor_root_df]: Percent
LegendI[thor_root_df]: Use
LegendO[thor_root_df]: Use
Legend1[thor_root_df]: Use /dev/disk1s3/ file system
Legend2[thor_root_df]: Use /dev/disk1s3/ file system
Title[thor_root_data1]: Percentage use /dev/disk1s5/ file system
PageTop[thor_root_data1]: Use /dev/disk1s5/ file system
Target[thor_root_data1]: `/usr/local/bin/snmpget -v 2c -Oqv -c XXXXXXXXXXXX thor dskPercent.2`
options[thor_root_data1]: gauge,transparent,nopercent,noinfo,nobanner
Unscaled[thor_root_data1]: ymwd
MaxBytes[thor_root_data1]: 100
YLegend[thor_root_data1]: Use %
ShortLegend[thor_root_data1]: Percent
LegendI[thor_root_data1]: Use
LegendO[thor_root_data1]: Use
Legend1[thor_root_data1]: Use /dev/disk1s5/ file system
Legend2[thor_root_data1]: Use /dev/disk1s5/ file system
Title[thor_root_data2]: Percentage use /dev/disk0s3/ file system
PageTop[thor_root_data2]: Use /dev/disk0s3/ file system
Target[thor_root_data2]: `/usr/local/bin/snmpget -v 2c -Oqv -c XXXXXXXXXXXX thor dskPercent.3`
options[thor_root_data2]: gauge,transparent,nopercent,noinfo,nobanner
Unscaled[thor_root_data2]: ymwd
MaxBytes[thor_root_data2]: 100
YLegend[thor_root_data2]: Use %
ShortLegend[thor_root_data2]: Percent
LegendI[thor_root_data2]: Use
LegendO[thor_root_data2]: Use
Legend1[thor_root_data2]: Use /dev/disk0s3/ file system
Legend2[thor_root_data2]: Use /dev/disk0s3/ file system
Labels: Apple, hardware, Network monitoring, OpenBSD, Os X
0 Comments:
Post a Comment
<< Home