Using python plugin in Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rawwrr
Posts: 19
Joined: Mon Aug 22, 2011 12:23 pm

Using python plugin in Nagios XI

Post by rawwrr »

Hi,

I'm trying to use the check_esxi_hardware.py plugin to check my hosts' hardware. I installed the pywbem extension and it works just fine when I run the following command directly on the Nagios server in the plugin folder;

[user@server libexec]#python ./check_esxi_hardware.py -H host -U user -P password -v

plugin; https://exchange.nagios.org/directory/P ... py/details

If I try to run the command in Nagios XI, I get not output, no error message, nothing. I'm pretty sure the problem comes from an error I made in my command - although I tried many different commands but I couldn't get it to work.

My command in Nagios XI;

$USERS1$\python ./check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -v

Is it possible that I'm doing this the wrong way? (I'm fairly sure I am!)

Thanks!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Using python plugin in Nagios XI

Post by tgriep »

The user section of your command isn't defined correctly. Try defining the command like below and see if it works for you.

Code: Select all

$USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -v
Be sure to check out our Knowledgebase for helpful articles and solutions!
rawwrr
Posts: 19
Joined: Mon Aug 22, 2011 12:23 pm

Re: Using python plugin in Nagios XI

Post by rawwrr »

Hi,

Thanks for the help - I tried with the suggested command but I still have the same issue, there's no output in Nagios;

COMMAND: /usr/local/nagios/libexec/check_esxi_hardware.py -H 0.0.0.0 -U user -P password
OUTPUT:

I'm still looking into the "python issue".
Thanks
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Using python plugin in Nagios XI

Post by jdalrymple »

Can you run it without calling the interpreter from the command line? If not it's probably as simple as doing `chmod +x /path/to/your/check_esxi_hardware.py`
rawwrr
Posts: 19
Joined: Mon Aug 22, 2011 12:23 pm

Re: Using python plugin in Nagios XI

Post by rawwrr »

Actually I can't --> /usr/bin/python: No such file or directory (yet it really exists!)

So I can run the command successfully in nagios this way;
/usr/bin/python $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using python plugin in Nagios XI

Post by Box293 »

rawwrr wrote:Hi,

Thanks for the help - I tried with the suggested command but I still have the same issue, there's no output in Nagios;

COMMAND: /usr/local/nagios/libexec/check_esxi_hardware.py -H 0.0.0.0 -U user -P password
OUTPUT:

I'm still looking into the "python issue".
Thanks
When you use the "Test Command" button it runs as the user apache, which is different to the nagios user that the monitoring engine runs as. There are some problems with the "Test Command" button so instead, save, apply config, find the service in the XI GUI (not CCM) and Schedule an immediate check. Does this work?

When you test at the command line, are you doing this as the nagios user?

Code: Select all

su nagios
./check_esxi_hardware.py -H host -U user -P password -v
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rawwrr
Posts: 19
Joined: Mon Aug 22, 2011 12:23 pm

Re: Using python plugin in Nagios XI

Post by rawwrr »

Box293 wrote:
rawwrr wrote:Hi,

Thanks for the help - I tried with the suggested command but I still have the same issue, there's no output in Nagios;

COMMAND: /usr/local/nagios/libexec/check_esxi_hardware.py -H 0.0.0.0 -U user -P password
OUTPUT:

I'm still looking into the "python issue".
Thanks
When you use the "Test Command" button it runs as the user apache, which is different to the nagios user that the monitoring engine runs as. There are some problems with the "Test Command" button so instead, save, apply config, find the service in the XI GUI (not CCM) and Schedule an immediate check. Does this work?

When you test at the command line, are you doing this as the nagios user?

Code: Select all

su nagios
./check_esxi_hardware.py -H host -U user -P password -v
1- It does not work
2- I was testing as root but it doesn't work either with the nagios user.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using python plugin in Nagios XI

Post by Box293 »

rawwrr wrote:2- I was testing as root but it doesn't work either with the nagios user.
This is the source of your problem. Something to do with the python environment or standard operating environment when the check executes is not present.

Do you have a heavily locked down system?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rawwrr
Posts: 19
Joined: Mon Aug 22, 2011 12:23 pm

Re: Using python plugin in Nagios XI

Post by rawwrr »

No particularly - I believe the base install was done using the Nagios VMware template but it precedes my arrival here. I don't think any specific restriction were enforced on the system.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using python plugin in Nagios XI

Post by Box293 »

But it works OK as root ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked