Greetings,
I’ve searched this topic via google and these forums, and I tried a bunch of stuff, but I still can’t get this to work. I’m trying to write a custom plugin in python. The plugin is just a “hello world”. I’ve gotten most of the other “built-in” plugins to work correctly.
The python script looks like this:
[code]import os
import sys
def main():
print “Python file ran OK!”
if called by command line, call main method
if name==“main”:
main()[/code]
On my nagios SERVER, I created the following service definition:
# This is a service that will run a custom python file, this is testing to make sure we can do this correctly
define service{
use generic-service ; Name of service template to use
host_name <hostName> <---- Omitted for privacy
service_description Run Python File
check_command check_nrpe!run_python_file
}
Then, I restarted the nagios service.
On the nagios CLIENT, I created the following command definition:
Then, I restarted the xinetd service.
On the client, I logged in as the “nagios” user, and I ran the following:
/opt/ActivePython-2.6/bin/python /temp/test.py
Python file ran OK!
On the server, I logged in as the “nagios” user, and I ran the following:
/usr/local/nagios/libexec/check_nrpe -H -c run_python_file
Python file ran OK!
So the command is able to be manually run on the remote host, as well as manually run from the server through nrpe.
So why can’t the nagios server run the command? Why do I have this error message?