Passing arguments to Nagios NRPE commands

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
gabrielsousa
Posts: 20
Joined: Mon Mar 02, 2015 5:06 am

Passing arguments to Nagios NRPE commands

Post by gabrielsousa »

i have compile nrpe with --enable-command-args

and i have the nrpe.cfg with
dont_blame_nrpe=1

but the arguments dont pass :(

what i'm missing ?

thanks
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Passing arguments to Nagios NRPE commands

Post by tmcdonald »

What commands do you have defined in NRPE, and what commands in Nagios are you using to run them?
Former Nagios employee
gabrielsousa
Posts: 20
Joined: Mon Mar 02, 2015 5:06 am

Re: Passing arguments to Nagios NRPE commands

Post by gabrielsousa »

Code: Select all

define service{
        use                     generic-service
        host_name               zeus
        service_description     Current Users 2
        check_command           check_nrpe!check_usersa!"-w2 -c3"
        }

Code: Select all

command[check_usersa]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Passing arguments to Nagios NRPE commands

Post by abrist »

You either need to push all of your arguments into one $ARGn$ with the "-a" switch in nrpe, or specify the $ARGn$ values separately in the check.
Use -a:

Code: Select all

define service{
            use                     generic-service
            host_name               zeus
            service_description     Current Users 2
            check_command           check_nrpe!check_usersa!-a '-w 2 -c 3'
}

Code: Select all

command[check_usersa]=/usr/local/nagios/libexec/check_users $ARG1$
Or pass $ARGn$s independently:

Code: Select all

define service{
            use                     generic-service
            host_name               zeus
            service_description     Current Users 2
            check_command           check_nrpe!check_usersa!2!3"
            }

Code: Select all

command[check_usersa]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
Does that make sense?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
gabrielsousa
Posts: 20
Joined: Mon Mar 02, 2015 5:06 am

Re: Passing arguments to Nagios NRPE commands

Post by gabrielsousa »

abrist wrote:You either need to push all of your arguments into one $ARGn$ with the "-a" switch in nrpe, or specify the $ARGn$ values separately in the check.
Or pass $ARGn$s independently:

Code: Select all

define service{
            use                     generic-service
            host_name               zeus
            service_description     Current Users 2
            check_command           check_nrpe!check_usersa!2!3"
            }

Code: Select all

command[check_usersa]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
Does that make sense?
with this, that i wanna use i have this error

"check_users: Warning threshold must be a positive integer "
gabrielsousa
Posts: 20
Joined: Mon Mar 02, 2015 5:06 am

Re: Passing arguments to Nagios NRPE commands

Post by gabrielsousa »

found what my problem was i had this on commands.cfg

Code: Select all

define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
i change to this

Code: Select all

define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$
}
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Passing arguments to Nagios NRPE commands

Post by abrist »

Great! Shall we lock the thread up?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
gabrielsousa
Posts: 20
Joined: Mon Mar 02, 2015 5:06 am

Re: Passing arguments to Nagios NRPE commands

Post by gabrielsousa »

abrist wrote:Great! Shall we lock the thread up?
yes thanks
Locked