Page 1 of 2

check_mrtgtraf: Unable to open MRTG log file

Posted: Thu Oct 02, 2014 9:59 am
by gazy007
I am sorry if there is a solution already and I missed it but I tried everything and I could not get it working.


http://support.nagios.com/forum/viewtop ... 23&p=78499
http://support.nagios.com/forum/viewtop ... f=7&t=8606

I think MRTG is working as I can see only one graph here but error in nagios Core Version 4.0.8.
http://192.168.3.2/mrtg/index.html

Permissions are as follows

-rwxr-xr-x 1 nagios nagios 110343 Oct 2 14:50 /usr/local/nagios/libexec/check_mrtgtraf
ls -la /etc/mrtg/
drwxr-xr-x. 2 root root 4096 Oct 2 15:27 .
drwxr-xr-x. 120 root root 12288 Oct 2 13:53 ..
-rw-r--r-- 1 root root 0 Oct 2 10:36 mrtg_252.cfg_l
-rw-r--r-- 1 root root 25078 Oct 2 12:04 mrtg2.cfg
-rw-r--r-- 1 nagios nagios 25078 Oct 2 15:30 mrtg.cfg
-rw-r--r-- 1 root root 0 Oct 2 13:48 mrtg.cfg_l
-rw-r--r--. 1 root root 45727 Sep 29 10:53 mrtg.cfg.rpmsave
-rw-r--r--. 1 root root 0 Oct 2 10:53 mrtg.ok
-rw-r--r-- 1 root root 25094 Oct 2 15:16 mymrtg.cfg
-rw-r--r-- 1 root root 0 Sep 29 11:10 mymrtg.ok

[root@nagios tmp]# ls -lad /etc/mrtg/
drwxr-xr-x. 2 root root 4096 Oct 2 15:27 /etc/mrtg/

I have spent over a week on it. FYI I am just a beginner on Linux but I can find my way around thanks to all your help.

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Thu Oct 02, 2014 4:47 pm
by slansing
Can you show us the cron that you currently have set up? Can you also manually run the command that you have in that cron and show us the output?

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Oct 03, 2014 2:36 am
by gazy007
Here is the output:

[root@nagios ~]# */5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
-bash: */5: No such file or directory
[root@nagios ~]# */5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log
-bash: */5: No such file or directory
[root@nagios ~]#

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Oct 03, 2014 3:04 am
by gazy007
This morning I changed my service def as well to
define service{
use generic-service
host_name Master
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/192.168.3.40_1.log!AVG!1000000,2000000!5000000,5000000!10
}
and restarted nagios service. Now I get MRTG data has expired (5619 minutes old) .

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Oct 03, 2014 3:42 am
by gazy007
Sorry it has gone back to same error
check_mrtgtraf: Unable to open MRTG log file

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Oct 03, 2014 4:18 pm
by slansing
You can't run that command as it is posted in the crontab, you need to run it as a typical linux command:

Code: Select all

/usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Oct 03, 2014 4:37 pm
by gazy007
Hi,
Just run it or copy it in cron?

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Mon Oct 06, 2014 9:15 am
by tmcdonald
You need to run the command that slansing posted from the command line, and post the output.

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Tue Oct 07, 2014 9:15 am
by gazy007
I have run the command and I did not see any output
[root@nagios ~]# /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
[root@nagios ~]#

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Tue Oct 07, 2014 5:08 pm
by slansing
What is the output of:

Code: Select all

ls -la /var/log/mrtg.log
I'm curious to see both the permissions, as well as the size and last update time.