Page 1 of 1

check_mrtgtraf: Unable to process MRTG log file

Posted: Tue Dec 11, 2012 12:46 pm
by happy
Hello Everyone

I continue to explore Nagios and its plugins. I am trying to get a network switch port monitored for bandwidth using check_mrtgtraf. I am working off of this tutorial:

http://www.thegeekstuff.com/2008/11/how ... ng-nagios/

define service{
use generic-service
host_name core-switch
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.11_1.log!AVG!1000000,2000000!5000000,5000000!10
}

I ran into the issue mentioned in the tutorial

Issue1: Nagios GUI displays “check_mrtgtraf: Unable to open MRTG log file” error message for the Port bandwidth usage

Solution1: make sure the *.log file defined in the check_local_mrtgtraf service is pointing to the correct location.

I did not have MRTG installed and used another howto to install and configure it. I also created the log file by touch <ipaddress>_1.log command and for testing purposes have given 777 permissions on the file. With that the error message changed from 'Unable to open MRTG log file' I now that 'check_mrtgtraf: Unable to process MRTG log file'.

I continue to read online but can't seem to find a solution. Does anyone here know what might be the issue and a possible solution?

Many thanks for your time.

Re: check_mrtgtraf: Unable to process MRTG log file

Posted: Tue Dec 11, 2012 4:32 pm
by scottwilkerson
This will only work if your cron you setup looks something like this

Code: Select all

*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/lib/mrtg/192.168.1.11_1.log

Re: check_mrtgtraf: Unable to process MRTG log file

Posted: Tue Dec 11, 2012 5:15 pm
by happy
Hi scottwilkerson

Thank you for replying.

I have run:
crontab -e

and have added the code you provided with my own ip ... however, I still see the same error.

I am a bit confused as to why it needs to run as a cron job for monitoring bandwidth through Nagios, whereas for the rest of uptime, ping test, etc are done through Nagios without setting up a cron job.

Do you know?

Thanks.

Re: check_mrtgtraf: Unable to process MRTG log file

Posted: Fri Dec 14, 2012 1:28 pm
by happy
Anyone with any ideas on this? Many Thanks!

Re: check_mrtgtraf: Unable to process MRTG log file

Posted: Tue Dec 18, 2012 4:46 am
by gshergill
Hi happy,

I had the same issue.

When I set this up I used the post 10 or so on the following link - http://www.howtoforge.com/forums/archiv ... 48484.html

There were a few things I changed when running the command to create the config directory (/var/www/mrtg/ instead of /var/www/html/mymrtg) but whatever changes you make, ensure to change the rest of the post accordingly.

Hope this helps.

Kind Regards,

Gary Shergill

Re: check_mrtgtraf: Unable to process MRTG log file

Posted: Tue Dec 18, 2012 2:09 pm
by slansing
Thank you for the insight gshergill! We will see what happens.