I'm monitoring router's Bandwidth Usage in Nagios using MRTG. So if I'll not do this command periodically

env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg

I'll will get this warning in Nagios GUI

MRTG data has expired (11 minutes old) 

and the question is: how I can make it automatic?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

You could automate running your mrtg command with cron. If your system has a directory named /etc/cron.d/, create a new one-line file there with the following contents:

*/5 * * * * root LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg >/dev/null 2>&1

This tells cron to run your command every 5 minutes, as the user root, with LANG=C in the environment.

If your system does not have a /etc/cron.d/, then you'll have to insert the above crontab line in an alternate place, such as the root user's crontab. You can do that by running crontab -e as root. In that case, your crontab line should omit the username field (root), but will otherwise be the same as before:

*/5 * * * * LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg >/dev/null 2>&1
link|improve this answer
worked with creating new file. thanx – Andriy Dec 23 '10 at 17:29
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.