Monitor MRTG run times?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DFaught
Posts: 62
Joined: Tue Sep 26, 2017 12:50 pm

Monitor MRTG run times?

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor MRTG run times?

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
DFaught
Posts: 62
Joined: Tue Sep 26, 2017 12:50 pm

Re: Monitor MRTG run times?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitor MRTG run times?

Post by scottwilkerson »

Nagios Plugin Development Guidelines
https://nagios-plugins.org/doc/guidelines.html
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked