Page 1 of 1

[Nagios-devel] Double escaping when using $ARGS1$?

Posted: Tue May 19, 2009 11:09 pm
by Guest
Hi!

I wanted to check what should be the correct behaviour.

Given a service and command definition like this:

define command {
command_name my_plugin_full
command_line /plugins/my_plugin 'Message with '\''quotes'\'' in'
}

define service {
check_command my_plugin_full
....
}

I can see Nagios executes this (from ndo data):
/plugins/my_plugin 'Message with '\''quotes''\' in'

This is what I want because commands are executed by the shell so
escaping of the single quotes is important to preserve the information.


However, given a service and command definition like this:

define command {
command_name my_plugin_with_args
command_line /plugins/my_plugin $ARG1$
}

define service {
check_command my_plugin_with_args!'Message with'\''quotes'\'' in'
....
}

I can see that Nagios executes a command line of:
/plugins/my_plugin 'Message with '''quotes''' in'

Note that there is no \ anymore. So in order to get the \ into the
command line, I'd need to escape the \ in the argument part of the
service definition.

Is this correct behaviour? I think this is wrong, or at least
inconsistent.

Ton






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]