Issue with MRTG

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
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Issue with MRTG

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Issue with MRTG

Post 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.
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Issue with MRTG

Post by gavinr98 »

I get this error in the Status Information, I also get a critical error under the Status.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Issue with MRTG

Post 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
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Issue with MRTG

Post 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?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Issue with MRTG

Post 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?
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Issue with MRTG

Post 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
}
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Issue with MRTG

Post 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
gavinr98
Posts: 22
Joined: Wed Jan 23, 2013 4:05 pm

Re: Issue with MRTG

Post by gavinr98 »

That worked... :)

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

Post by slansing »

Excellent! Thanks for pitching in Gary, always helpful! Closing and marking as resolved.
Locked