1

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?

  • What version of Nagios? What version of check_nrpe? – Keith Oct 14 '15 at 2:27
  • @Keith I added the requested information, thanks for pointing that out. – Nir Friedman Oct 14 '15 at 4:29
  • Is it possibile you have two different check_nrpe: ie the one with path: libexec on the other with path $USER1 refer to different executables ? – Francesco Malvezzi Oct 14 '15 at 6:53
  • Well, the python script indicates that USER1 is getting expanded to libexec, so it seems rather unlikely. When I run check_nrpe from the command line I use the absolute path. I also verified there is no check_nrpe in PATH. I then also deleted the extra check_nrpe I had (in the unzipped nrpe plugin), and ran it again, and results did not change. – Nir Friedman Oct 14 '15 at 14:20
0

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).

  • 1
    Wow, that's a new one. Never would have found that ;-) – Keith Oct 15 '15 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.