Firstly, I apologize for my english, I know it's terrible.
As part of an IT project, I worked with Nagios.
In order to get the value of a temperature sensor, I create a python plugin that will read the value in a database, and print in on screen.
The problem is that when I want to monitor the service based on this plugin, it is displayed as "CRITICAL" in the web interface with error « (Return code 127 is out of bounds) plugin may be missing ».
Here is a summary of my installations :
- I create a python plugin "cigne_plugin.py" that will read the value in a database, and print in on screen.
- Added file "cigne_python.py" in /usr/local/nagios/libexec
In file /usr/local/nagios/etc/resource.cfg, $USER1$ macro is define on /usr/local/nagios/libexec
- In /usr/local/nagios/etc/checkcommands.cfg, I added these lines :
Code: Select all
define command{
command_name arduino_temp_sensor
command_line $USER1$/cigne_plugin.py
}
- In /usr/local/nagios/etc/objects/commands.cfg, I added these line:
Code: Select all
define command{
command_name arduino_temp_sensor
command_line $USER1$/cigne_plugin.py
}
- In /usr/local/nagios/etc/objects/localhost.cfg :
Code: Select all
define service{
use local-service
host_name localhost
service_description Arduino Temp
check_command arduino_temp_sensor
notification_enabled 0
}
- Add command "arduino_temp_sensor" in the Web Interface (Configuration -> Commands)
- Add service "Arduino Temp" in the Web Interface (Configuration -> Services)
- Check the files rights
- Check that the script can be execute
- Check the files owners
- Check users and groups
I tried with a plugin version commenting all the code, and that only do a « sys.exit(2) », problem is not from the code.
Thank you for any help, have a nice day.