system monitoring with mrtg/snmp

Someone emailed me thusly:

I saw your email to the mailing list (http://www.ee.ethz.ch/~slist/mrtg/msg23710.html), that you have a rather successful install of MRTG and SNMP on OS X. 

I am quite jelous.
http://www.paulbeard.org/mrtg/pink/

I got SNMP installed OK (from Darwinports via opendarwin), and gor MRTG installed.  I’ve been plotting Ethernet connection for sometime.  I wanted to get CPU and Disk (like you have)

I tried snmpwalk, but see nothing of the sort.  Any assistance would be greatly apprciated.

I decided to take a look at this as a new install (my move from Jaguar to Panther on the host he saw being graphed worked without a hitch . . . ) I have a new iBook and am starting from scratch.

First off, the factory version of snmp seems to be OK. So he could have saved himself some work there.

Next, run snmpconf and make sure you can actually access your snmp daemon. You need to set a community name and define a version for security purposes.

The next thing to look at is the hrStorageTable. (The Cw 100 syntax wraps output to 100 characters.)

snmptable -v[your version] -c[your community name] -Cw 100 localhost hrStorageTable

This should spit out a table of all the storage devices you have mounted:

SNMP table: HOST-RESOURCES-MIB::hrStorageTable

hrStorageIndex hrStorageType hrStorageDescr
1 HOST-RESOURCES-TYPES::hrStorageFixedDisk /
2 HOST-RESOURCES-TYPES::hrStorageFixedDisk /dev
3 HOST-RESOURCES-TYPES::hrStorageFixedDisk /dev
4 HOST-RESOURCES-TYPES::hrStorageFixedDisk /.vol
5 HOST-RESOURCES-TYPES::hrStorageFixedDisk /Network
6 HOST-RESOURCES-TYPES::hrStorageFixedDisk /automount/Servers
7 HOST-RESOURCES-TYPES::hrStorageFixedDisk /automount/static
8 HOST-RESOURCES-TYPES::hrStorageFixedDisk /Volumes/paulbeard
101 HOST-RESOURCES-TYPES::hrStorageRam Real Memory
102 HOST-RESOURCES-TYPES::hrStorageVirtualMemory Swap Space
103 HOST-RESOURCES-TYPES::hrStorageOther Memory Buffers

SNMP table HOST-RESOURCES-MIB::hrStorageTable, part 2

hrStorageAllocationUnits hrStorageSize hrStorageUsed hrStorageAllocationFailures
4096 Bytes 7324800 4095758 0
512 Bytes 2 2 0
512 Bytes 2 2 0
512 Bytes 1024 1024 0
512 Bytes 0 0 0
512 Bytes 0 0 0
512 Bytes 0 0 0
512 Bytes 204800 25819 0
4096 Bytes 0 761696 ?
4096 Bytes 761640 -1073746560 ?
256 Bytes ? 48 ?

From this you can get the variable you want to report on:

white:~ paul$ snmpget -v[your version] -c[your community name] localhost hrStorageSize.1 hrStorageUsed.1
HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 7324800
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 4095757

Once you have that in hand, you can initialize mrtg with it’s cfgmaker command and then add additional stanzas to suit your needs.