Double escaping when using $ARGS1$?

Ton Voon ton.voon at opsera.com
Wed May 20 02:09:30 CEST 2009


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


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects




More information about the Developers mailing list