Page 1 of 2

check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:18 pm
by flounders
While I was trying to configure the check_mrtgtraf command in switch.cfg, somehow it won't let Nagios start now unless I have either the host_name or service_description commented out. I cannot have both uncommented and the service run. I am wondering what issues am I running into here.

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:21 pm
by sreinhardt
Have you tried verifying your configuration?

Code: Select all

/path/to/nagios -v /path/to/nagios.cfg

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:33 pm
by flounders
This is the error that comes up:

Code: Select all

Error: Service check command 'check_mrtgtraf' specified in service 'Port 1 Bandwidth Usage' for host 'netgear-gsm7312' not defined anywhere!
        Checked 12 services.

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:36 pm
by tmcdonald
I think the answer might be in the error.

Have you in fact defined the check_mrtgtraf command anywhere?

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:43 pm
by flounders
It is not defined. After I posted, I found out that check_local_mrtgtraf is the proper definition. I replaced that and the nagios service started again. Unfortunately it is having issues getting the log which is why I messed with changing check_local_mrtgtraf to check_mrtgtraf.

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:48 pm
by tmcdonald
What do you mean it is having trouble getting the log?

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 1:55 pm
by flounders
This is about all the information the logs are giving me:

Code: Select all

[1394476809] SERVICE ALERT: netgear-gsm7312;Port 1 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
[1394476929] SERVICE ALERT: netgear-gsm7312;Port 1 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
[1394477049] SERVICE ALERT: netgear-gsm7312;Port 1 Bandwidth Usage;UNKNOWN;HARD;3;check_mrtgtraf: Unable to open MRTG log file
MRTG is working, and I did point it to the correct log file which is sitting in /var/www/mrtg. I can view the traffic graph by going to http://10.0.0.42/mrtg/ where I see all the ports and then I can select, and check_mrtgtraf even works from the command-line with the parameters from switch.cfg, but from nagios it will not work.

Re: check_mrtgtraf: configuration broken

Posted: Mon Mar 10, 2014 4:29 pm
by lmiltchev
Do you get any errors, when you run the following command?

Code: Select all

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
What mrtg packages do you have installed? If it is a CentOS system, you can run:

Code: Select all

yum list installed mrtg*
Did you check the permissions?

Code: Select all

ls -lad /etc/mrtg/
ls -la /etc/mrtg/
ls -la /var/lib/mrtg/
ls -la /usr/local/nagios/libexec/check_mrtgtraf
Can you show us the mrtg cron entry?

Code: Select all

cat /etc/cron.d/mrtg
Note: Adjust the paths if you need to.

Re: check_mrtgtraf: configuration broken

Posted: Wed Mar 12, 2014 1:21 pm
by flounders
lmiltchev wrote:Do you get any errors, when you run the following command?

Code: Select all

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
Runs fine.
What mrtg packages do you have installed? If it is a CentOS system, you can run:

Code: Select all

yum list installed mrtg*

Code: Select all

mrtg.x86_64        2.16.2-7.el6        @base
mrtg-libs.x86_64        2.16.2-7.el6        @base
Did you check the permissions?

Code: Select all

ls -lad /etc/mrtg/
ls -la /etc/mrtg/
ls -la /var/lib/mrtg/
ls -la /usr/local/nagios/libexec/check_mrtgtraf

Code: Select all

drwxr-xr-x. 2 root root 4096 Mar 12 13:09 /etc/mrtg

total 28
drwxr-xr-x.  2 root root  4096 Mar 12 13:09 .
drwxr-xr-x. 83 root root  4096 Mar  5 15:15 ..
-rw-r--r--.  1 root root 17916 Mar  5 15:59 mrtg.cfg
-rw-r--r--.  1 root root     0 Mar 12 13:09 mrtg.ok

total 8
drwxrwxrwx.  2 nagios nagios 4096 Feb 27 16:55 .
drwxr-xr-x. 28 root   root   4096 Mar  5 14:16 ..
-rw-r--r--.  1 root   root      0 Mar 12 13:10 mrtg.ok
                                                                                                                              
-rwxr-xr-x. 1 root root 40240 Oct 17 06:43 /usr/lib64/nagios/plugins/check_mrtgtraf
The above is results from the ls commands requested. I don't know if these permissions are set correctly or not which is why I am giving raw data.
Can you show us the mrtg cron entry?

Code: Select all

cat /etc/cron.d/mrtg
Note: Adjust the paths if you need to.

Code: Select all

*/5 * * * * root 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

Re: check_mrtgtraf: configuration broken

Posted: Wed Mar 12, 2014 3:00 pm
by sreinhardt
Well I can see why the nagios check is failing, we don't have any rrd files for it to read in /var/lib/mrtg. Could you post your /etc/mrtg.cfg please, and we can look it over for issues.