mrtg with procfs as a replacement for snmpd.
in case of one of the system administrator's out there is about to install tobi oetiker's amazing multi router traffic grapher (or mrtg) package to collect some data from your server (not your router) and display it as pretty graphs, i want to throw in a few heller.
generally, it is recommended (or rather: necessary, at least if you want to use most of the example targets) to additionally install an snmp agent like net-snmp which enables the server to respond to queries for network management information.
i found this quite cumbersome, installing, configuring and running another daemon process and especially getting in touch with the weird world of snmp syntax, smiv2, mibs and oids. (confused? thought so!)
thus, if your server comes mounted with a process filesystem (ie. the /proc
directory) you can spare yourself the hassle with snmp and use some simple statements of cat
and awk
commands, like so:
Target[memory]:
cat /proc/meminfo | awk '/Mem: / {print $2/1024; print $1/1024}'
actually, this should return the same samples of the machine's free and total memory in kilobyte as the following target, defined with mib identifiers as quoted in many examples:
Target[memory]: memAvailReal.0&memTotalReal.0:public@localhost
(don't forget to include the correct mib file containing oid conversions of the identifiers as well as to correctly setup the snmpd configuration, if you really should insist on doing it the hard way.)
anyway, here's a config file for mrtg defining the imho most wanted targets, all defined with similar statements* as above: mrtg-procfs (application/octet-stream, 3 KB)
at antville.org mrtg is running smoothly with this configuration for a few days now; i compared the results with those of an equivalent snmp configuration and only found an error in the output of the disk usage – in the snmp version!
* with the exception of getting partition statistics via /bin/df
.