NRPE Works From Command Line; “Incorrect command line arguments” from Nagios

nagiosnrpe

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?

Best Answer

In conclusion, the issue turned out to be that the dash in the '-H' was not actually a dash. It was an en-dash. You can actually see it quite clearly in the text above if you look for it. Unfortunately, Source Code Pro (the font I use in my terminal, and therefore in vim) does not really differentiate dashes and en dashes. I reopened an issue regarding this, in the meanwhile I'm looking for a new font (and adding dash differentiation to my list of criteria).