NRPE with arguments issue

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.
jiikettu@gmail.com
Posts: 8
Joined: Mon Apr 18, 2016 5:14 am

NRPE with arguments issue

Post by jiikettu@gmail.com »

Hi all,

We have a need to monitor specific nodes through NRPE due to access restrictions.
We have configured the NRPE (3.0.1) on Centos 5.5 with following options:

Code: Select all

dont_blame_nrpe=1
command[check_all_interfaces]=/usr/local/nagios/libexec/check_all_interfaces.pl -H $ARG1$ -C $ARG2$
The NRPE was installed with the --enable-command-args configuration parameter.

The NRPE seems to work otherwise, but something goes wrong in the process:
./check_nrpe -H 1.1.1.1 -t 30 -c check_all_interfaces -a 2.2.2.2 public
NRPE: Command 'check_all_interfaces!2.2.2.2!public' not defined

That would need that we would require to define 200+ commands in the nrpe config for each and every node, unless this argument handling get's solved somehow.

Any ideas?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE with arguments issue

Post by tgriep »

Try putting single quotes around your arguments like below and see if that works.

Code: Select all

./check_nrpe -H 1.1.1.1 -t 30 -c check_all_interfaces -a '2.2.2.2 public'
Also, your check command should be the same.
check_all_interfaces!-a '2.2.2.2 public'
Be sure to check out our Knowledgebase for helpful articles and solutions!
jiikettu@gmail.com
Posts: 8
Joined: Mon Apr 18, 2016 5:14 am

Re: NRPE with arguments issue

Post by jiikettu@gmail.com »

As expected the result was as follows:

Code: Select all

./check_nrpe -H 1.1.1.1 -t 30 -c check_all_interfaces -a '2.2.2.2 public'
NRPE: Command 'check_all_interfaces!2.2.2.2 public' not defined
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE with arguments issue

Post by Box293 »

jiikettu@gmail.com wrote: The NRPE seems to work otherwise, but something goes wrong in the process:
./check_nrpe -H 1.1.1.1 -t 30 -c check_all_interfaces -a 2.2.2.2 public
NRPE: Command 'check_all_interfaces!2.2.2.2!public' not defined
This error:

NRPE: Command 'check_all_interfaces!2.2.2.2!public' not defined

Usually means that you're trying to call a command like:
command[check_all_interfaces!2.2.2.2!public]=/usr/local/nagios/libexec/check_all_interfaces.pl -H $ARG1$ -C $ARG2$

Which is extremely unlikely, I've not seen anything like this before.

Can you post your entire nrpe.cfg file from the remote host please.

Also, what is the output of this from the remote host:

Code: Select all

ps -C xinetd
ps -C nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jiikettu@gmail.com
Posts: 8
Joined: Mon Apr 18, 2016 5:14 am

Re: NRPE with arguments issue

Post by jiikettu@gmail.com »

Here is the config:

Code: Select all

log_facility=daemon
debug=0
pid_file=/usr/local/nagios/var/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,1.2.3.4
dont_blame_nrpe=1
allow_bash_command_substitution=0
command_timeout=60
connection_timeout=300

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

command[check_all_interfaces]=/usr/local/nagios/libexec/check_all_interfaces.pl -H $ARG1$ -C $ARG2$
And requested outputs:

Code: Select all

# ps -C xinetd
PID TTY          TIME CMD
17298 ?        00:00:00 xinetd
# ps -C nrpe
  PID TTY          TIME CMD
22436 ?        00:00:00 nrpe
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE with arguments issue

Post by tgriep »

Can you verify that the nrpe.cfg file you are editing matches the one defined in the /etc/xinetd.s/nrpe file?

Can you login to that remote server, run the following and post the output?

Code: Select all

su nagios
/usr/local/nagios/libexec/check_all_interfaces.pl -H xxx.xxx.xxx.xxx -C public
Run this on the Nagios server and post this is well

Code: Select all

/usr/local/nagios/libexec/check_nrpe --help
/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx
Replacing xxx.xxx.xxx.xxx with the IP address on your remove server.
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE with arguments issue

Post by Box293 »

Did you follow this guide to install NRPE v3?

https://support.nagios.com/kb/article.php?id=515
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jiikettu@gmail.com
Posts: 8
Joined: Mon Apr 18, 2016 5:14 am

Re: NRPE with arguments issue

Post by jiikettu@gmail.com »

Hre are the outputs:

Code: Select all

# su nagios
$ /usr/local/nagios/libexec/check_all_interfaces.pl -H x.x.x.x -C public
OK: Total in errors: 0, Total out errors: 0, Total in discards: 0, Total out discards: 0
And from the Nagios server:

Code: Select all

# ./check_nrpe --help

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
Version: 3.0.1
Last Modified: 09-08-2016
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [-2] [-4] [-6] [-n] [-u] [-V] [-l] [-d <dhopt>]
       [-P <size>] [-S <ssl version>]  [-L <cipherlist>] [-C <clientcert>]
       [-K <key>] [-A <ca-certificate>] [-s <logopts>] [-b <bindaddr>]
       [-f <cfg-file>] [-p <port>] [-t <interval>:<state>]
       [-c <command>] [-a <arglist...>]

Options:
 <host>       = The address of the host running the NRPE daemon
 -2           = Only use Version 2 packets, not Version 3
 -4           = bind to ipv4 only
 -6           = bind to ipv6 only
 -n           = Do no use SSL
 -u           = (DEPRECATED) Make timeouts return UNKNOWN instead of CRITICAL
 -V           = Show version
 -l           = Show license
 <dhopt>      = Anonymous Diffie Hellman use:
                0 = Don't use Anonymous Diffie Hellman
                    (This will be the default in a future release.)
                1 = Allow Anonymous Diffie Hellman (default)
                2 = Force Anonymous Diffie Hellman
 <size>       = Specify non-default payload size for NSClient++
 <ssl ver>    = The SSL/TLS version to use. Can be any one of: SSLv2 (only),
                SSLv2+ (or above), SSLv3 (only), SSLv3+ (or above),
                TLSv1 (only), TLSv1+ (or above DEFAULT), TLSv1.1 (only),
                TLSv1.1+ (or above), TLSv1.2 (only), TLSv1.2+ (or above)
 <cipherlist> = The list of SSL ciphers to use (currently defaults
                to "ALL:!MD5:@STRENGTH". WILL change in a future release.)
 <clientcert> = The client certificate to use for PKI
 <key>        = The private key to use with the client certificate
 <ca-cert>    = The CA certificate to use for PKI
 <logopts>    = SSL Logging Options
 <bindaddr>   = bind to local address
 <cfg-file>   = configuration file to use
 [port]       = The port on which the daemon is running (default=5666)
 [command]    = The name of the command that the remote daemon should run
 [arglist]    = Optional arguments that should be passed to the command,
                separated by a space.  If provided, this must be the last
                option supplied on the command line.

 NEW TIMEOUT SYNTAX
 -t <interval>:<state>
    <interval> = Number of seconds before connection times out (default=10)
    <state> = Check state to exit with in the event of a timeout (default=CRITICAL)
    Timeout state must be a valid state name (case-insensitive) or integer:
    (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here.  Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin.  This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.

Code: Select all

# ./check_nrpe -H x.x.x.x
NRPE v3.0.1
The installation was done according to https://github.com/NagiosEnterprises/nr ... s/NRPE.pdf
but it looks same to the link you provided.
Last edited by dwhitfield on Fri Oct 21, 2016 11:56 am, edited 1 time in total.
Reason: broke up the second code block
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE with arguments issue

Post by dwhitfield »

Could you post the contents of /usr/local/nagios/libexec/check_all_interfaces.pl? Thanks!
jiikettu@gmail.com
Posts: 8
Joined: Mon Apr 18, 2016 5:14 am

Re: NRPE with arguments issue

Post by jiikettu@gmail.com »

The check_all_interfaces can be found from:
https://exchange.nagios.org/directory/P ... ps/details
Locked