nrpe -a works for SOME plugins but not all and not for test

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
bpleat
Posts: 2
Joined: Fri May 01, 2020 2:34 am

nrpe -a works for SOME plugins but not all and not for test

Post by bpleat »

I am on a closed network, so safely enabling "dont_blame_nrpe=1" (no need for the usual concerns)

I disabled all the "hardcoded" commands (predefined with parameters, enabled all as soft-coded with "$ARG1$", because I will be monitoring different remote systems with different values and don't want to have to hard-code separate remote cfg files for for each one.
(Note: Some are various-model Raspberry Pi, some are various-config x86 Linux boxes)

Two of my four remote commands work, two do not.
These two (in the remote config)...

Code: Select all

command[check_rasp_temp]=/usr/lib/nagios/plugins/check_rasp_temp $ARG1$
command[check_procs]=/usr/lib/nagios/plugins/check_procs $ARG1$
...work with (in the server config)...

Code: Select all

        check_command             	check_nrpe!check_rasp_temp!'-w 50 -c 60'
	check_command		check_nrpe!check_procs!'-w 50 -c 100 RSZDT'
However, these two...

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk $ARG1$
command[check_load]=/usr/lib/nagios/plugins/check_load $ARG1$
...with...

Code: Select all

	check_command		check_nrpe!check_disk!'-w 20 -c 10 -p "/"'
	check_command 		check_nrpe!check_load!'-r -w 1.0,1.0,1.0 -c 2.0,2.0,2.0'
...do not work, they give a "Could not parse arguments" error. (for -p I've tried with and without the double-quotes, I just prefer with quotes for consistency with other checks I do)

Locally (on the remote server, they work fine:

Code: Select all

./check_procs -w 50 -c 100 RSZDT
./check_disk -w 20 -c 10 -p "/"
...both work, for example.

Due to the code above not working, I'd normally diagnose from the command line.
However, either I'm just not getting the syntax correct to place the test remote call with parameters or "something else is wrong". From the server:

Code: Select all

./check_nrpe -H 192.168.86.43 -t 30
...works

Code: Select all

./check_nrpe -H 192.168.86.43 -t 30 -c check_users
(or whatever I try)
...works in producing a response, e.g....

Code: Select all

Usage: check_users -w <users> -c <users>
I try with check_procs as well...

Code: Select all

./check_nrpe -H 192.168.86.43 -t 30 -c 'check_procs'
PROCS OK: 159 processes | procs=159;;;0;
But I can't seem to pass parameters to ANY remote plugins. Even...

Code: Select all

./check_nrpe -H 192.168.86.43 -t 30 -c check_users -a (anything)
...gives a strange error of...

Code: Select all

NRPE: Command 'check_users!' not defined
I get a similar response for any way I pass parameters - always a "command 'check_procs!(whatever else)' not defined.

It's almost as if the "-a" parameter is not being interpreted properly in some way, or I can't figure out how to pass parameters with it.
Yet it works fine for two of the commands from the serve console... (but, again, not in command line due to the -a issue).

I've even tried coding the parameters on the remotes as advised by https://support.nagios.com/kb/article/n ... s-759.html as "more secure", but I still get the "-a"-related issue.

Appreciate thoughts on how to proceed...
bpleat
Posts: 2
Joined: Fri May 01, 2020 2:34 am

Re: nrpe -a works for SOME plugins but not all and not for t

Post by bpleat »

I've narrowed it down to that it's not something the nagios server is doing wrong (e.g., misinterpreting or misrewriting).
It's something the nrpe client is doing wrong.

In my nrpe.cfg:

Code: Select all

command[check_rasp_temp_parms]=/usr/lib/nagios/plugins/check_rasp_temp $ARG1$
From the command line:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -t 30 -c check_rasp_temp_parms -a '-w 5 -c 20'
NRPE: Command 'check_rasp_temp_parms!-w 5 -c 20' not defined
So, for some reason check_nrpe is just doing something wrong in interpreting the -a parameters.

Please advise any further ways I can diagnose...
Locked