NSClient++ NRPE check_uptime with arguments fails

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

NSClient++ NRPE check_uptime with arguments fails

Postby roddie » Thu Feb 07, 2019 11:24 am

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.
roddie
 
Posts: 4
Joined: Tue Apr 24, 2018 3:23 pm

Re: NSClient++ NRPE check_uptime with arguments fails

Postby scottwilkerson » Thu Feb 07, 2019 1:44 pm

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"
        }
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 14055
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NSClient++ NRPE check_uptime with arguments fails

Postby roddie » Tue Feb 12, 2019 8:02 am

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.
roddie
 
Posts: 4
Joined: Tue Apr 24, 2018 3:23 pm

Re: NSClient++ NRPE check_uptime with arguments fails

Postby scottwilkerson » Tue Feb 12, 2019 8:45 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 14055
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot] and 15 guests