The uptime script works nicely as well, although, I'd suggest a small inline bash command in the config file:
Code: Select all
Target[xacatecas.uptime]: `sed -e 's,\.[0-9]*,,g' < /proc/uptime | (read C1 C2; echo $(( $C1 / 60 )); echo $(( $C2 / 60 )))`Also, Gentoo allows one to run mrtg in daemon mode if instead of a bunch of seperate config files you create one big config file. I haven't done this but the option is available. This also allows one to make use of the global "Fork" option, which will allow a small speed improvement in the case where you are doing many remote queries (My mrtg updates takes well over a minute already with almost no CPU usage).
Instead of the bunch of shell scripts that does this I've instead got a single command stored in cron:
Code: Select all
*/5 * * * * for i in /etc/mrtg/*.cfg; do /usr/bin/mrtg $i; doneCode: Select all
# useradd mrtg -g daemon -G cron -d /dev/null
# passwd -l mrtgCode: Select all
# crontab -e -u mrtgThen I also need some help. I'm trying to get the hrSystemUptime working so that I can monitor the uptime of remote machines without the need of ssh hacks and tunnels.
Code: Select all
xacatecas ~ # snmpwalk -v 1 -c public localhost hrSystemUptime
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (292802531) 33 days, 21:20:25.31
xacatecas ~ # Code: Select all
xacatecas mrtg # cat /proc/uptime && snmpwalk -v 1 -c public localhost hrSystemUptime
2928616.04 2881494.04
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (292861618) 33 days, 21:30:16.18
xacatecas mrtg # Code: Select all
xacatecas mrtg # mrtg pug-uptime.cfg.tmp
WARNING: Expected a number but got '3 days, 13:15:46'
WARNING: Expected a number but got '3 days, 13:15:46'
ERROR: Target[pug.uptime][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
ERROR: Target[pug.uptime][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
xacatecas mrtg # Code: Select all
$BER::pretty_print_timeticks=0


