Monitor MRTG run times?
Monitor MRTG run times?
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?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitor MRTG run times?
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.
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?
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.
{ 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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitor MRTG run times?
Nagios Plugin Development Guidelines
https://nagios-plugins.org/doc/guidelines.html
https://nagios-plugins.org/doc/guidelines.html