Using python plugin in Nagios XI
Using python plugin in Nagios XI
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!
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!
Re: Using python plugin in Nagios XI
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$ -vBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using python plugin in Nagios XI
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
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
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`
Re: Using python plugin in Nagios XI
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$
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$
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Using python plugin in Nagios XI
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?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 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 -vAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Using python plugin in Nagios XI
1- It does not workBox293 wrote: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?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 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
2- I was testing as root but it doesn't work either with the nagios user.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Using python plugin in Nagios XI
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.rawwrr wrote:2- I was testing as root but it doesn't work either with the nagios user.
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.
Re: Using python plugin in Nagios XI
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.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Using python plugin in Nagios XI
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.