Nrpe trouble with wildcard in argument


#1

I’m trying to get a nrpe check to work with a wildcard in the argument.

Config nagios server:

[blockquote][code]define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t $ARG1$ -c $ARG2$ -a $ARG3$ $ARG4$ $ARG5$ $ARG6$
}

define service{
use generic-service
hostgroup_name linux-servers-nrpe
service_description System updates
check_command check_nrpe!30!check_yum_pkg!!kernel
}[/code][/blockquote]

Config on host (nrpe):
[blockquote]command[check_yum_pkg]=/usr/local/nagios/libopenfusion/check_yum -w $ARG1$ -c $ARG2$ $ARG3$[/blockquote]

Running the test manually gives me this:
[blockquote][[email protected] nagios]# /usr/local/nagios/libexec/check_nrpe -t 30 -H my.host.com -c check_yum_pkg -a * kernel* YUM CRITICAL - updates found: 7 critical, 0 warning [[email protected] nagios]# /usr/local/nagios/libexec/check_nrpe -t 30 -H my.host.com -c check_yum_pkg -a '*' 'kernel*' YUM CRITICAL - updates found: 3 critical, 4 warning[/blockquote]

As you can see, if I put ’ around the wildcard argument everything works fine on the console, But running it from nagios config it only gives me 7 critical instead of the correct 3 critical and 4 warnings

I’ve tried changing
[blockquote]check_nrpe!30!check_yum_pkg!*!kernel*[/blockquote]
to
[blockquote]check_nrpe!30!check_yum_pkg!'*'!'kernel*'[/blockquote]
without any luck.

Any suggestions on how I can get nagios/nrpe to send/parse the correct input?

If I run the test manually on the host it does not need ’ around the arguments:
[blockquote][[email protected] FILES]# /usr/local/nagios/libopenfusion/check_yum -w * -c kernel* YUM CRITICAL - updates found: 3 critical, 4 warning [[email protected] FILES]# /usr/local/nagios/libopenfusion/check_yum -w '*' -c 'kernel*' YUM CRITICAL - updates found: 3 critical, 4 warning[/blockquote]


#2

have you tried escaping the wildcard? i.e.

check_nrpe!30!check_yum_pkg!\*!kernel\*

or

check_nrpe!30!check_yum_pkg!'\*'!'kernel\*'

HTH

/S


#3

Thanks. That fixed it. I thought I had tried it.

check_nrpe!30!check_yum_pkg!\*!kernel\*did the trick