Help configuring MRTG on Ubuntu 8.04

Joined
Feb 19, 2004
Messages
3,861
Okay, so I just got our Nagios/MRTG server running in an ESXi VM and I'm running into a little snag with the MRTG cron configuration.

Per http://www.debianhelp.co.uk/mrtg.htm

I try to paste the following command into the console and I get an error.

Command:
cat /etc/cron.d/mrtg 0-55/5 * * * * root if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi

Error:
bash: syntax error near unexpected token `then'



I am no linux guru master. I know enough to follow directions and can usually figure most stuff out given enough time and patience. I have been googling my ass off and trying different crap for the last few hours and I am stumped. Everything seems to be working fine except the http://nagios/mrtg page only shows the local host graph.

If I do a
root@NAGIOS:~# indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
then all the other configured hosts' graphs show up. If I wait a few minutes and refresh the page then it goes back to only the local host. So I am thinking it is something to do with the CRON task that isn't working right.


Anybody got any ideas?

 
Not quite what you are looking for, but you could always simplify it and just remove the checking.

Make it just
0-55/5 * * * * root /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1


Or, take a look at Cacti.. it is like MRTG, but with a very slick web-gui ( no more editing config files)
 
hmmmm, I'll give that a shot and see what happens. Miraculously, the graphs did start refreshing and all the hosts are showing up even without that cron thing working right. Who knows... I'll take a look at Cacti, I like the idea of not having to mess around with config files . . .. .
 
Yea cacti is definately a hell of a lot easier to setup than MRTG.
 
Back
Top