NRPE check parameters getting lost

nagiosnrpeshinken

I'm running Shinken and have a pack which includes several commands that run bash scripts on the monitored host via NRPE. I have a check on the host which runs a bash script that takes 4 parameters. When it runs only 1 of the 4 parameters I pass in the commands.cfg makes it to the host for use by the script.

I've searched around a lot on this issue and haven't been able to find a solution. From what I've read most problems people report with passing parameters to NRPE stem from not having "dont_blame_nrpe" set properly or from not having nrpe compiled with support for parameters. This is not the case for my situation. dont_blame_nrpe is set to 1 and the module was compiled with parameter support. What's more, I have a check on the same host (set up within the same pack) that takes a single parameter and works just fine.

Here is my commands.cfg in the pack:

define command {
    command_name   check_nrpe
    command_line   $PLUGINSDIR$/check_nrpe -u -H $HOSTADDRESS$ -c $ARG1$ -a '$ARG2$ $ARG3$ $ARG4$ $ARG5$'
}

I've also tried the above with double quotes around the whole set of arguments and double quotes around each individual argument. I get the same result no matter what.

And the service definition:

define service{
    service_description check-worker-count
    use            generic-service
    register       0
    host_name      nrpe-pack
    check_command  check_nrpe!check-worker-count!worker-name!12!90!80
}

And the /etc/nrpe.d/check-worker-count.cfg on the host:

command[check-worker-count]=/usr/lib64/nagios/plugins/check_worker_count.sh -n $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$

I have the script on the host outputting $* at the very beginning and here is what it's getting:

-n worker-name -p -w -c

Compare to a run of the script locally with the parameters passed at the command line:

-n worker-name -p 12 -w 90 -c 80

Best Answer

Don't bother separating all of the -a ARGs into separate ARGs in the Nagios conf. You'll drive yourself crazy with the quotes. For simplicity, make your command_line something like:

$PLUGINSDIR$/check_nrpe -u -t 30 -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$

And then use it like this:

check_command  check_nrpe!check-worker-count!worker-name 12 90 80

At least, that's how you would do it in Nagios/Icinga. Should be the same for Shinken.

Related Topic