Page 1 of 1
Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 6:03 am
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
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 10:10 am
by tmcdonald
What commands do you have defined in NRPE, and what commands in Nagios are you using to run them?
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 10:35 am
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$
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 11:10 am
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?
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 11:27 am
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 "
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 12:26 pm
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$
}
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 12:35 pm
by abrist
Great! Shall we lock the thread up?
Re: Passing arguments to Nagios NRPE commands
Posted: Mon Mar 02, 2015 12:49 pm
by gabrielsousa
abrist wrote:Great! Shall we lock the thread up?
yes thanks