Help needed with Return Code 126

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Help needed with Return Code 126

Post by stkol76 »

Hi

I am testing XI, and have setup some of my environment checks, but has now reached for our vSphere farm, using the vCenter wizard, and installed all plugins and SDK´s as described in the How Tos placed here at nagios.com and the little tutorial in the wizard. I have setup all checks (Disk, Ping, Cluster, Datacenter etc.) but the only thing that is working is the Ping, all others fails with "Critical" and the status "(Return code of 126 is out of bounds - plugin may not be executable)" .. I have checked the the forums, google etc. for the last 1½ day, and have sat the execute permissions using a varity of chmod commands.. i have tried uninstalling, services, wizard, plugins, SDK, and installed them again, and I have also tried more than 15 times going through the wizard again. I have even created a user called nagios ... but what ever I do I get the same "Critical" and the status "(Return code of 126 is out of bounds - plugin may not be executable)"

Please HELP :)

/stig :D
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Help needed with Return Code 126

Post by tonyyarusso »

Unfortunately, we don't have an actual vSphere environment locally, so it's possible you're encountering issues we wouldn't have seen in testing. One way to start debugging would be to try running the check command from the terminal, as sometimes that will give more / different output than is displayed in the Nagios interface - do you know how to do that?
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Re: Help needed with Return Code 126

Post by stkol76 »

Hi Tony

Thanks for you answer, sorry for long delay of my reply!!

I am not sure on how to do the check command from the terminal, guidance would be very much appriciated :D

/Stig :-)
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Help needed with Return Code 126

Post by tonyyarusso »

Okay, you'll need to go through a few steps to establish what exactly is being run. Grab some paper to note settings as you go. Start by going to the Core Config Manager (under "Configure"), under Services in the left sidebar, find the service in question, and click the crossed tools "Configure" icon. On the "Common Settings" tab, note what it says for "Command view", the values of the eight ARG variables, and anything listed under "Additional templates". Now, in the left sidebar again, click "Templates -> Service templates", and find any that were listed on the previous step. If any of the ARG variables that were blank on the first page are filled in here, write down the value on the template. Repeat this step if any of the templates in turn have templates listed on their definitions. Similarly, if the Check command and Command view were blank, fill them in from the template.

Now, starting with what you had for "Command view", replace $USER1$ with /usr/local/nagios/libexec , and replace $HOSTADDRESS$ with the IP address of the host this service is associated with.

As an example, I have a host called "Server Room", with an IP address of 192.168.5.254, and am running a simple ping check against it. For "Check command" and "Command view" they're blank, $ARG5$ = -p 5, and for templates it has "xiwizard_websensor_ping_service". The template for xiwizard_websensor_ping_service has a "Check command" of "check_xi_service_ping" and a "Command view" of '$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ $ARG5$', with $ARG1$ = 3000.0, $ARG2$ = 80%, $ARG3$ = 5000.0, $ARG4$ = 100%, $ARG5$ = -p 8, and a template of "xiwizard_generic_service". The "xiwizard_generic_service" template has a check command of "check_xi_service_none" and a command view of '$USER1$/check_dummy 0 "Nothing to monitor"', with blank args and no additional template. Nothing gets filled in from this template because all of the values it defines are already defined in a higher-priority setting.

Here, the first step is to look at '$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ $ARG5$'.
Step two fills in $ARG5$ from the service definition, and we get '$USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ -p 5'.
Step three gets args 1-4 from the xiwizard_websensor_ping_service template, giving '$USER1$/check_icmp -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5'. The $ARG5$ is left alone because it was already set.
Step four does nothing - the last template doesn't have any new info.
Step five is to fill in the macros, so you get '/usr/local/nagios/libexec/check_icmp -H 192.168.5.254 -w 3000.0,80% -c 5000.0,100% -p 5'. That's your full check command.

Now, log into your Nagios XI server as root, either on a direct terminal or through SSH. Enclose your command in single quotes like I've been doing here, put su -c before it and nagios after it, and hit enter. It should look something like this:

Code: Select all

[root@demo ~]# su -c '/usr/local/nagios/libexec/check_icmp -H 192.168.5.254 -w 3000.0,80% -c 5000.0,100% -p 5' nagios
OK - 192.168.5.254: rta 50.903ms, lost 0%|rta=50.903ms;3000.000;5000.000;0; pl=0%;80;100;; 
[root@demo ~]# 
Obviously that will be filled in with different details based on the check you're trying to run, but hopefully that demonstrates the progression of how to build the line.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Re: Help needed with Return Code 126

Post by stkol76 »

Okay, I have now taken the "VMware Storage Array Datastore DataStore01 Usage" and made a test on

The command it uses is :

Code: Select all

$USER1$/check_vmware.pl --config=$USER1$/$ARG1$ --mode=nagios --report=$ARG2$ --warn=$ARG3$ --crit=$ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$


and the arguments are :

$ARG1$ = check_vmware_config_vcenter01
$ARG2$ = disk
$ARG3$ = 70
$ARG4$ = 30
$ARG5$ = --include=DataStore01


I then run this command (in Putty) :

Code: Select all

su -c '/usr/local/nagios/libexec/check_vmware.pl' --config=/usr/local/nagios/libexec/check_vmware_config_vcenter01 --mode=nagios --report=disk --warn=70 --crit=30 --include=DataStore01'
and get an error that it can not find the file.. I then went inside the directory it self, and ran this :

Code: Select all

su -c check_vmware.pl' config=check_vmware_config_vcenter01 mode=nagios report=disk warn=70 crit=30 include=DataStore01
But then I get this error :

su: user config=check_vmware_config_vcenter01 does not exist

I have then checked the check_vmware_config_vcenter01 again to see if I have misspelled anything, but all seems OK :

VI_PASSWORD=XXXXXXXX
VI_SERVER=SERVER_NAME.domain.x
VI_USERNAME=domain.x\Administrator


Does this make any sense??

/Stig :-)
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Help needed with Return Code 126

Post by tonyyarusso »

You need to fix your quoting to be properly matched and around the entire command string, and then put nagios (the user) after that, as in my example.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Re: Help needed with Return Code 126

Post by stkol76 »

OK, I have now tried with this :

Code: Select all

su -c '/usr/local/nagios/libexec/check_vmware.pl -config=/usr/local/nagios/libexec/check_vmware_config_vcenter01 -mode=nagios -report=disk -warn=70 -crit=30 -include=DataStore01' nagios
and it returs this error :

bash: /usr/local/nagios/libexec/check_vmware.pl: /usr/bin/perl^M: bad interpreter: no such file or directory

I recon it has something to do with the Perl, but it is installed, so what is the problem??

/Stig :-)
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Help needed with Return Code 126

Post by tonyyarusso »

This has to do with the differences in text file line endings between operating systems. Currently your copy of check_vmware.pl is in a Windows format, and needs to be converted to Linux/Unix format. Either of the following commands should do the trick (the first one uses standard utilities, the second one requires a tool that may or may not be installed):

Code: Select all

sed -i 's/\r//' /usr/local/nagios/libexec/check_vmware.pl

Code: Select all

dos2unix /usr/local/nagios/libexec/check_vmware.pl
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Re: Help needed with Return Code 126

Post by stkol76 »

Ok, Great.. Know I am getting alittle further.. I get to enter username and pass, but after that it comes with this error

UNKNOWN: Login to VirtualCentre server failed: Server version unavailable at 'https://localhost:443/sdk/vimService.wsdl' at /usr/lib/perl5/5.8.8/VMware/VICommon.pm line 545, <STDIN> line 2.

What can this be?? :-)
stkol76
Posts: 8
Joined: Tue Dec 21, 2010 10:00 am

Re: Help needed with Return Code 126

Post by stkol76 »

Now everything, exept the Cluster check works :-)

The Service : VMware vCenter Cluster SKEJCOM Cluster Status

Returns status UNKNOWN with description : UNKNOWN: Cluster 'MYCCOMPANY' not found

I think I know why, but i am not able to solve it myself.. I believe it is because the Clustername is in 2 words MYCOMPANY Cluster

like this :

check_vmware_vc!check_vmware_config_vcenter01!cluster!--cluster=MYCOMPANY Cluster

I have tried to set it in 'MYCOMPANY Cluster' and "MYCOMPANY Cluster" but everytime I apply Nagios XI returns errors, that I can not save it!!

What can be wrong? :-)
Locked