Page 1 of 1

Monitor MRTG run times?

Posted: Wed Jul 18, 2018 10:57 am
by DFaught
How can I reasonably do ongoing tracking and alerting of how long it takes the MRTG task, driven by cron, to run? Is there a way to set up a low overhead service to track this?

Re: Monitor MRTG run times?

Posted: Thu Jul 19, 2018 7:10 am
by scottwilkerson
you can use the Folder Watch wizard
to search in /var/lib/mrtg/
use regex mrtg.lock

and select the File Age: you want to warn/critical on.

It won't give you the actual run time but will tell you it is is running long.

Otherwise you would have to create your own plugin that would have to grab the start and stop times (maybe add some commands to the beginning and end of the cron line to create these.

Re: Monitor MRTG run times?

Posted: Thu Jul 19, 2018 8:16 am
by DFaught
So to get the actual run times, the cron command might look like this?

{ time LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok > /dev/null 2>&1 ; } 2>/var/lib/mrtg/time.log

Now I just need to read up on writing a plugin, I guess.

Re: Monitor MRTG run times?

Posted: Thu Jul 19, 2018 8:18 am
by scottwilkerson
Nagios Plugin Development Guidelines
https://nagios-plugins.org/doc/guidelines.html