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.
Locked
floatyzq
Posts: 3
Joined: Tue Nov 04, 2014 11:09 pm

check_mrtgtraf: Unable to open MRTG log file

Post by floatyzq »

Hi All

anyone can help on this issue? I have read all related topics of "check_mrtgtraf: Unable to open MRTG log file" within the forum and searched in google, but no solution for my case.

I have got the error "check_mrtgtraf: Unable to open MRTG log file " when i tried to monitor the bandwidth usage of switch ports, and my investigation is as below:

1. my service is as below:
define service{
use generic-service ; Inherit values from a template
host_name HKPUBSW09250
service_description Port 24 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.9.250_24.log!AVG!1000000,1000000!5000000,5000000!10
}

2. the file /var/lib/mrtg/192.168.9.250_24.log is exist, and permission is as below:

[root@ switches]# ll /var/lib/mrtg/192.168.9.250_24.log
-rw-r--r--. 1 root root 58410 Nov 5 12:40 /var/lib/mrtg/192.168.9.250_24.log

3. my command:
# 'check_local_mrtgtraf' command definition
define command{
command_name check_local_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}

4. i can run the check_mrtgtraf under user nagios:
[nagios@ ~]$ /usr/lib64/nagios/plugins/check_mrtgtraf -F /var/lib/mrtg/192.168.9.250_24.log -a AVG -w 1000000,100000 -c 5000000,5000000 -e 10
Traffic CRITICAL - Avg. In = 336.3 KB/s, Avg. Out = 11.5 MB/s|in=336.285156KB/s;1000000.000000;5000000.000000;0.000000 out=11.459609MB/s;100000.000000;5000000.000000;0.000000

Does anyone has ideas about this problem?

Best and Regards,
Nigel
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by sreinhardt »

well, that certainly looks correct to me, and your example as the nagios user shows that it should be working. Have you tried quoting the path to your log file? Do you happen to be using mklivestatus, mod_gearman, or anything other than stock nagios core and mrtg at the moment?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
floatyzq
Posts: 3
Joined: Tue Nov 04, 2014 11:09 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by floatyzq »

hi sreinhardt,

thanks for your kind reply. just tried but no luck. any ideas?

NO, there is only nagios, mrtg and nagios-plugins in my nagios server.

Best and Regards,
Nigel
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by sreinhardt »

Well, ok then. How about selinux? Try running getenforce
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
floatyzq
Posts: 3
Joined: Tue Nov 04, 2014 11:09 pm

Re: check_mrtgtraf: Unable to open MRTG log file

Post by floatyzq »

hi sreinhardt,

thanks very much.

after disable selinux, nagios can monitor bandwidth successfully now.

Best and Regards,
Nigel
Locked