Page 1 of 1
Issue with MRTG
Posted: Fri Feb 01, 2013 3:33 pm
by gavinr98
Need some help, I have setup MRTG and all the graphs have been generated and the log file has also been created. However I am getting this error (Return code of 139 is out of bounds). If I manually launch
http://nagios/mrtg/172.16.x.x_1.log the log file opens. I can also go directly to the page and see the graphs. Does anyone have any suggestions on how to get this working? Below is the configuration I am using.
switch.cfg
define service{
use generic-service ; Inherit values from a template
host_name switch01
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf! /var/www/mrtg/172.X.X.X_1.log!AVG!1000000,1000000!5000000,5000000!10
}
commands.cfg
# 'check_local_mrtgtraf' command definition
define command{
command_name check_local_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $LOGFILE$ $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}
Thanks,
Gavin
Re: Issue with MRTG
Posted: Fri Feb 01, 2013 4:42 pm
by slansing
Sorry if my mind is slipping and I am missing something here, but where are you getting the out of bounds error from? What Host/service.
Re: Issue with MRTG
Posted: Fri Feb 01, 2013 5:39 pm
by gavinr98
I get this error in the Status Information, I also get a critical error under the Status.
Re: Issue with MRTG
Posted: Mon Feb 04, 2013 5:42 am
by gshergill
Hi gavinr98,
You have the following line:
Code: Select all
command_line $USER1$/check_mrtgtraf -F $LOGFILE$ $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
This should really just read:
Code: Select all
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
No need for the $LOGFILE$ part.
Also, your service definition, you don't need a space between the ! and the /var/.
If this doesn't work, check that you can run this from the command line:
Code: Select all
cd /usr/local/nagios/libexec/
./check_mrtgtraf -F /var/www/mrtg/172.X.X.X_1.log -a AVG -w 1000000,1000000 -c 5000000,5000000 -e 10
Kind Regards.
Gary Shergill
Re: Issue with MRTG
Posted: Mon Feb 04, 2013 1:45 pm
by gavinr98
Hi Gary,
When I run the command I get "Traffic OK - with a bunch of stuff after that, so that appears to be running fine. I also updated the commands as you pointed out but still get the same error?
Re: Issue with MRTG
Posted: Mon Feb 04, 2013 2:54 pm
by slansing
When I run the command I get "Traffic OK - with a bunch of stuff after that, so that appears to be running fine. I also updated the commands as you pointed out but still get the same error?
So when you plug in all the information for those arguments on the command line you get an Okay result, but when you leave them blank and assign the Arg's though the service definition you don't get the Okay? How are you defining them through the service definition?
Re: Issue with MRTG
Posted: Mon Feb 04, 2013 3:00 pm
by gavinr98
Correct... this is what I have defined in the service
define service{
use generic-service ; Inherit values from a template
host_name SWITCH01
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/172.X.X.X_1.log!AVG!1000000,1000000!5000000,5000000!10
}
Re: Issue with MRTG
Posted: Tue Feb 05, 2013 8:55 am
by gshergill
Hi Gavin,
Maybe try this.
Change your command definition from:
Code: Select all
# '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$
}
To:
Code: Select all
# 'check_local_mrtgtraf' command definition
define command{
command_name check_local_mrtgtraf
command_line /usr/local/nagios/libexec/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}
So change the $USER1$/ to /usr/local/nagios/libexec/
This is assuming you run manually from that directory, otherwise use the directory it worked from.
Kind Regards,
Gary Shergill
Re: Issue with MRTG
Posted: Tue Feb 05, 2013 1:45 pm
by gavinr98
That worked...
Thanks for all your help.
Re: Issue with MRTG
Posted: Tue Feb 05, 2013 1:48 pm
by slansing
Excellent! Thanks for pitching in Gary, always helpful! Closing and marking as resolved.