I'm trying to setup NRPE with a basic example as a first step towards deploying it. For simplicity, I'm running both NRPE and Nagios locally. NRPE and Nagios both seem to be working, but using check_nrpe from Nagios fails mysteriously. Edit: I'm using version 4.1.1 of Nagios and 2.15 of NRPE.
I think that NRPE is working because I can run check_nrpe manually:
/s/l/n/nagios_instance ❯❯❯ libexec/check_nrpe -H 127.0.0.1 -p 5667 -c check_total_procs ⏎
PROCS CRITICAL: 536 processes | procs=536;150;200;0;
I think that Nagios is working (and supplying correct arguments) because I have written this simple check in python, file named check_hello_world.py that lives in the libexec directory:
#!/usr/bin/env python
import sys
print str(sys.argv)
raise SystemExit, 2
The relevant lines of my nagios config look like this:
define host {
use linux-server
host_name yourhost
alias My first Apache server
address 127.0.0.1
}
define command {
command_name check_procs_nrpe
command_line $USER1$/check_hello_world.py –H "$HOSTADDRESS$" -p 5667 -c "check_total_procs"
#command_line $USER1$/check_nrpe –H "$HOSTADDRESS$" -p 5667 -c "check_total_procs"
}
define service {
use generic-service
host_name yourhost
service_description Check using the hello world plugin
check_command check_procs_nrpe
}
As you can see, I define the check_procs_nrpe command with one of two commands, either the simple python script, or the nrpe command to check procs that worked from the command line. When I use the python script, within a couple of minutes I get an email with text:
Additional Info:
[/spare/local/nagios/nagios_instance/libexec/check_hello_world.py, –H, 127.0.0.1, -p, 5667, -c, check_total_procs]
This seems to show that Nagios is working correctly, triggering alerts, sending emails, and correct resolving arguments. When I change the command to use check_nrpe and rerun Nagios, I get an email with text:
Additional Info:
Incorrect command line arguments supplied
I really don't know where to go next. I don't have root on this box and thus cannot easily reconfigure rsyslog to try to get logging information. Happy to provide additional info upon request. Any ideas?
Respuesta1
En conclusión, el problema resultó ser que el guión en la '-H' no era en realidad un guión. Fue un final de carrera. De hecho, puedes verlo con bastante claridad en el texto anterior si lo buscas. Desafortunadamente, Source Code Pro (la fuente que uso en mi terminal y, por lo tanto, en vim) no diferencia realmente los guiones y los guiones. Reabrí un problema relacionado con esto, mientras tanto estoy buscando una nueva fuente (y agregando diferenciación de guiones a mi lista de criterios).