Page 1 of 1

check_mrtgtraf: Unable to open MRTG log file

Posted: Tue Nov 04, 2014 11:49 pm
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

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Wed Nov 05, 2014 3:56 pm
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?

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Wed Nov 05, 2014 9:18 pm
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

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Thu Nov 06, 2014 3:50 pm
by sreinhardt
Well, ok then. How about selinux? Try running getenforce

Re: check_mrtgtraf: Unable to open MRTG log file

Posted: Fri Nov 07, 2014 4:06 am
by floatyzq
hi sreinhardt,

thanks very much.

after disable selinux, nagios can monitor bandwidth successfully now.

Best and Regards,
Nigel