Page 1 of 1

check_esxi_hardware.py - Return code of 255 is out of bounds

Posted: Wed Jan 18, 2017 1:56 pm
by SHou
Hi Guys,
i have a problem which drives me really crazy since some days, hope someone cann support.

Using:
Nagios Core 4.2.2
Ubuntu 16.04 LTS

i want to use the pyhton script check_esxi_hardware.py to check the health of my ESXi Server.
If i run the command via the shell i get the expected result, do i integrate the check into my nagios i get the error code:
Status Information: (Return code of 255 is out of bounds)
the Event Log show the following entry:
Warning: Return code of 255 for check of service 'Hardware' on host 'winserver' was out of bounds.

Shell command:

Code: Select all

./check_esxi_hardware.py -H esxi-ip -U username -P mypass -V hp
result
OK - Server: HP Proliant........

Command definition inside commands.cfg:

Code: Select all

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -V $ARG3$
}
Service check inside windows.cfg

Code: Select all

# Check HP Server hardware
define service{
use generic-service
host_name winserver
service_description Hardware
check_command check_esxi_hardware!root!mypass!hp
}

Thanks in advance for your support

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Wed Jan 18, 2017 3:45 pm
by rkennedy
Usually the error is related to permissions, what happens if you run it as the nagios user?

Code: Select all

su - nagios
./check_esxi_hardware.py -H esxi-ip -U username -P mypass -V hp
If this fails, then you may just need to change the permissions on the check_esxi_hardware.py script so the nagios user can access it.

If that doesn't help, please show us the full output as well as the permissions on the file - ls -al check_esxi_hardware.py

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Thu Jan 19, 2017 1:29 pm
by SHou
the result is the same, like before

Code: Select all

$ ./check_esxi_hardware.py -H 192.168.1.1 -U root  password
OK - Server: HP ProLiant DL380p Gen8 s/n: jasdfioanfö System BIOS: P70 2015-07-01
from my point if view the permission are also looking good, correct me if im wrong ;)

Code: Select all

ls -al check_esxi_hardware.py
-rwxrwxrwx 1 nagios nagios 35579 Jan 16 19:12 check_esxi_hardware.py

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Thu Jan 19, 2017 5:58 pm
by tgriep
Can you run the following as root and post the output?

Code: Select all

which python
python -V

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Fri Jan 20, 2017 4:17 am
by SHou
find attached the output

which python
/usr/bin/python

python -V
Python 2.7.12

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Fri Jan 20, 2017 9:57 am
by tgriep
Thanks for the output. I just wanted to make sure that the path to python is what the plugin expects.
What I think it is is the output from your command line example has a umlaut o in it and that could be causing it issue.
Can you try a different option that doesn't output a special character and see if it works?
Another thing, it you have special characters in the user name or password, try putting them between single quotes and see it that works.

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Sat Jan 21, 2017 11:14 am
by SHou
thank's for your feedback!
i don't have any special characters in the user or password, i put both also between single characters.
no change - same error :( out of bounds

any more ideas?

regards SHou

Re: check_esxi_hardware.py - Return code of 255 is out of bo

Posted: Mon Jan 23, 2017 11:55 am
by tgriep
All of the settings look like they should work but you could add the -v option to your command to get a verbose output and see if you can get any more details on why it is failing.

You may also want to check this link and verify that you are running the latest version of the plugin as well as searching their site for any tips.
https://www.claudiokuenzler.com/nagios- ... IY0p30sCrc