Escape \ in nagios config files?

Marc Powell marc at ena.com
Mon Apr 6 23:44:27 CEST 2009


On Apr 6, 2009, at 4:02 PM, Janet Sullivan wrote:

> Of course, right after I sent that, I found a solution.  It seems I  
> can
> use 3 \s to escape a \.  My path in the service definition becomes:
>
> \\\\\\\\localhost\\\\_definst_\\\\mp3\\\\mn_mp3_08_07\\\\streams
>
> ...and it works.
>
> Is there a list of all the ways to escape special characters in  
> Nagios?
> The only reason I came up with the three \ escape sequence was  
> because I
> noticed that my \\\\localhost was being seen as \localhost in the  
> error
> message.  I haven't found any mention of that sequence on google. :-/

\ is an escape character for both nagios and the shell. Actual service  
and command definitions may help clarify the situation but I expect  
that you're passing the path as an $ARGx$ via the service definition.  
You'll need to escape each \ there with a \ (see first Tip at http://nagios.sourceforge.net/docs/3_0/macros.html) 
  so that nagios treats them as literalls and not as nagios' internal  
escape character.

I'm going to next assume that the command_line for the check command  
doesn't quote the $ARGx$ macro so you need another \ for each \\ pair  
otherwise the shell will treat one of each pair as an escape.

If you need to use a $ in a command_line, you should use $$.

--
Marc

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list