Issue with MRTG
Issue with MRTG
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
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
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Issue with MRTG
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
I get this error in the Status Information, I also get a critical error under the Status.
Re: Issue with MRTG
Hi gavinr98,
You have the following line:
This should really just read:
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:
Kind Regards.
Gary Shergill
You have the following line:
Code: Select all
command_line $USER1$/check_mrtgtraf -F $LOGFILE$ $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$Code: Select all
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$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 10Gary Shergill
Re: Issue with MRTG
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?
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?
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Issue with MRTG
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?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
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
}
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
Hi Gavin,
Maybe try this.
Change your command definition from:
To:
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
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$
}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$
}This is assuming you run manually from that directory, otherwise use the directory it worked from.
Kind Regards,
Gary Shergill
Re: Issue with MRTG
That worked... 
Thanks for all your help.
Thanks for all your help.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Issue with MRTG
Excellent! Thanks for pitching in Gary, always helpful! Closing and marking as resolved.