NSClient++ NRPE check_uptime with arguments fails

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
roddie
Posts: 10
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

NSClient++ NRPE check_uptime with arguments fails

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NSClient++ NRPE check_uptime with arguments fails

Post 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"
        }
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
roddie
Posts: 10
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: NSClient++ NRPE check_uptime with arguments fails

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NSClient++ NRPE check_uptime with arguments fails

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked