escaping semicolon

Nathan Vonnahme nathan.vonnahme at bannerhealth.com
Wed Jul 12 21:43:32 CEST 2006


Gerd Mueller <gmueller <at> netways.de> writes:

> My workaround will be a simple bash script which replaces another
> character with a semicolon but I really do not like this workaround! I
> would prefer if it is possible to escape the semicolon.

I discovered a different workaround for semicolons in command_line directives:

in resource.cfg:
$USER9$=;

then in the command definition I can use:
	command_line	$USER1$/contrib/check_oracle_instance.pl -ufoo -pbar
-c"host=host_foo$USER9$sid=oracle_sid_foo" -a

(incidently, that's a neat trick for making the check_oracle_instance.pl script
monitor a database on another machine... you could change the port too with
$USER9$port=1521).


but I agree, there should be a better way of escaping semicolons in
command_lines, and there should be something in the documentation for
command_line.   Maybe this patch to the docs would be a good temporary measure:

--- xodtemplate.html.dist       2006-07-12 11:24:07.000000000 -0800
+++ xodtemplate.html    2006-07-12 11:37:14.000000000 -0800
@@ -1112,6 +1112,8 @@
 <p>
 This directive is used to define what is actually executed by Nagios when the
command is used for service or host checks, notifications, or <a
href="eventhandlers.html">event handlers</a>. Before the command line is
executed, all valid <a href="macros.html">macros</a> are replaced with their
respective values.  See the documentation on macros for determining when you can
use different macros.  Note that the command line is <i>not</i> surrounded in
quotes.  Also, if you want to pass a dollar sign ($) on the command line, you
have to escape it with another dollar sign.
 </p>
+<p><strong>NOTE</strong>: You may not include a <b>semicolon</b> (;) in a
command_line directive, because everything after it will be ignored as a .cfg
file comment.  You can work around this by calling a wrapper shell script that
does what you want, or you can set one of the <a
href="macros.html#user"><b>$USER$</b> macros in your <a
href="configmain.html#resource_file">resource file</a> to a semicolon and use it
in place of the semicolon.
+</p>
 <p>
 If you want to pass arguments to commands during runtime, you can use <a
href="macros.html#arg"><b>$ARGn$</b> macros</a> in the <i>command_line</i>
directive of the command definition and then seperate individual arguments from
the command name (and from each other) using bang (!) characters in the object
definition directive (host check command, service event handler command, etc)
that references the command.  More information on how arguments in command
definitions are processed during runtime can be found in the documentation on <a
href="macros.html">macros</a>.
 </p>






-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Developers mailing list