Page 1 of 1

NSClient++ NRPE check_uptime with arguments fails

Posted: Thu Feb 07, 2019 11:24 am
by roddie
Nagios Core 4.3.2 on RHEL 7.4 monitoring Windows 2008R2 running NSClient++ 0.5.2.35

When I try to configure a command/service using check_uptime with arguments, it errors in Nagios as "Unknown command(s): check_uptime -a 'warn= uptime > 27d'" and using nscp test on the target server while it does this I can see "E core Unknown command(s): check_uptime -a 'warn= > 27d' available commands: commands {, check_counter, check_cpu, check_memory, check_network, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_uptime, checkcounter, checkcpu, checkmem, checkprocstate, checkservicestate, check_uptime}, plugins {, 0} c:\source\master\service\plugin_manager.cpp:475"

This is with the following command and service defined:

Code: Select all

define command{
        command_name    check_nrpe_uptime
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c "check_uptime -a 'warn= uptime > 27d'"
        }

Code: Select all

define service{
        service_description     Uptime
        host_name               server01
        check_command           check_nrpe_uptime
        use                     generic-service
        }
In nscp I have activated the CheckSystem module and in nsclient.ini I have allowed arguments and nasty characters under /settings/NRPE/server (it did complain about these until I enabled them but now I just get the "Unknown command" error in the Nagios CGI and nscp test output.

If I amend the command to remove everything after "check_uptime" it works (but obviously without the thresholds I want).

If I run the following command from the Nagios server it returns successfully:

Code: Select all

[root@nagios01 nagios]# /usr/lib64/nagios/plugins/check_nrpe -H server -c check_uptime -a "warn=uptime > 27d"
OK: uptime: 1d 06:5h, boot: 2019-02-06 10:12:17 (UTC)|'uptime'=108347s;2332800;86400
I have tried changing the single quotes and double quotes around in the command definition and also removing the -a to no avail.

Re: NSClient++ NRPE check_uptime with arguments fails

Posted: Thu Feb 07, 2019 1:44 pm
by scottwilkerson
you have an error in your command, replace this

Code: Select all

define command{
        command_name    check_nrpe_uptime
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c "check_uptime -a 'warn= uptime > 27d'"
        }
with this

Code: Select all

define command{
        command_name    check_nrpe_uptime
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_uptime -a "warn= uptime > 27d"
        }

Re: NSClient++ NRPE check_uptime with arguments fails

Posted: Tue Feb 12, 2019 8:02 am
by roddie
Thank you, Scott - I had the quotes around that part based on how my check_by_ssh commands were defined.

I can confirm your solution has fixed the problem.

Re: NSClient++ NRPE check_uptime with arguments fails

Posted: Tue Feb 12, 2019 8:45 am
by scottwilkerson
roddie wrote:Thank you, Scott - I had the quotes around that part based on how my check_by_ssh commands were defined.

I can confirm your solution has fixed the problem.
Great!

Locking thread