We figured it out.

The service config needs to not have any quotes:

The service block has the check_command set to:
check_command                   
check_log_perl_nofilter_test!/srv/logs/spamnet/log-parser/log-parser.log!/srv/nagios_nrpe/tmp/log-parser.log.out!ERROR:
 Parent: Fatal error

The check_command definition needs quotes:
command_line    $USER2$/check_nrpe -u -t 30 -H $HOSTADDRESS$ -c 
check_log_perl_nofilter -a $ARG1$ $ARG2$ "$ARG3$"

and the nrpe.cfg needs quotes:
command[check_log_perl_nofilter]=/srv/nagios_nrpe/scripts/check_log.pl 
--filename=$ARG1$ --oldlog=$ARG2$ --query="$ARG3$"

-Lori

From: Lori Adams [mailto:lad...@cloudmark.com]
Sent: Wednesday, September 29, 2010 10:00 AM
To: nagios-users@lists.sourceforge.net
Subject: [Nagios-users] passing a string with spaces to nrpe

I'm having a terrible time setting up nrpe to allow me to pass a string with 
spaces.  This is with nagios 3.x and nrpe 2.0.

The service config is trying to check a log on a remote server for a string 
that contains spaces.

The service block has the check_command set to:
check_command                   
check_log_perl_nofilter_test!/srv/logs/spamnet/log-parser/log-parser.log!/srv/nagios_nrpe/tmp/log-parser.log.out!\"ERROR:
 Parent: Fatal error\"

The check_command is set to:
define command {
        command_name    check_log_perl_nofilter_test
        command_line    $USER2$/check_nrpe -u -t 30 -H $HOSTADDRESS$ -c 
check_log_perl_nofilter -a $ARG1$ $ARG2$ "$ARG3$"
}

The nrpe config is then:
command[check_log_perl_nofilter]= /srv/nagios_nrpe/scripts/check_log.pl 
--filename=$ARG1$ --oldlog=$ARG2$ --query=$ARG3$

If I change the nrpe config to echo the command, so that it looks like:
                command[check_log_perl_nofilter]= echo 
/srv/nagios_nrpe/scripts/check_log.pl --filename=$ARG1$ --oldlog=$ARG2$ 
--query=$ARG3$
Then, the output of the echo is:
/srv/nagios_nrpe/scripts/check_log.pl 
--filename=/srv/logs/spamnet/log-parser/log-parser.log 
--oldlog=/srv/nagios_nrpe/tmp/log-parser.log.out --query=ERROR:

I've tried quoting the $ARG3$ in the nrpe command, and I get the same thing.

I've seed other threads on the list that in order to pass quotes to nrpe, you 
must escape them.  You can see I've tried that.   Any guidance would be 
extremely helpful.


Thanks,
Lori Adams

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to