Complex nagios command

Posted by gonvaled on Server Fault See other posts from Server Fault or by gonvaled
Published on 2012-04-06T10:39:13Z Indexed on 2012/04/06 11:32 UTC
Read the original article Hit count: 223

Filed under:

I have defined the following command for one of my service checks:

define command{
        command_name    mycommand
        command_line    $USER1$/check_by_ssh -p $ARG1$ -l nagios -i /etc/nagios2/keys/key1 -H $HOSTADDRESS$ -v -C 'source $USER10$ ; command.py -a get --alert-name $ARG2$ -q'
        }

The problem is that it seems that nagios is parsing the command with the semicolon, and producing garbage which can not be executed. I have tried also putting a backslash \;, to no avail.

If I run the command directly on the shell, it works. Which means that this is not a problem with check_by_ssh, but a problem on the parsing of the nagios configuration file.

How can I debug this? Is there a way to get a listing of all the commands that nagios has parsed when reading the configuration files?

© Server Fault or respective owner

Related posts about nagios