check_mrtgtraf: Unable to open MRTG log file

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

check_mrtgtraf: Unable to open MRTG log file

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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?
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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 ~]#
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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) .
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post by gazy007 »

Sorry it has gone back to same error
check_mrtgtraf: Unable to open MRTG log file
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post by gazy007 »

Hi,
Just run it or copy it in cron?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post by tmcdonald »

You need to run the command that slansing posted from the command line, and post the output.
Former Nagios employee
gazy007
Posts: 12
Joined: Thu Oct 02, 2014 9:02 am

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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 ~]#
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mrtgtraf: Unable to open MRTG log file

Post 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.
Locked