Re: [Nagios-users] Escape \ in nagios config files?

2009-04-06 Thread Janet Sullivan
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_mp3mn_mp3_08_07streams

...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. :-/

-Original Message-
From: Janet Sullivan 
Sent: Monday, April 06, 2009 1:56 PM
To: 'nagios-users@lists.sourceforge.net'
Subject: Escape \ in nagios config files?

I want to check the disk space of a UNC path -
\\localhost\_definst_\mp3\mn_mp3_08_07\streams

From the command line, I can check it fine (using check_nrpe2) if I
escape each  \ like this:

localhost\\_definst_\\mp3\\mn_mp3_08_07\\streams

But when I try to use configure Nagios to check it, it strips out all
the \ characters.  I've tried single quotes, double quotes, and escaping
each \ - no luck.  How can I tell Nagios about this path in a service
definition without it stripping out the special characters?  Is there an
escape method I'm missing?  


--
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@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


Re: [Nagios-users] Escape \ in nagios config files?

2009-04-06 Thread Marc Powell

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_mp3mn_mp3_08_07streams

 ...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@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


Re: [Nagios-users] Escape \ in nagios config files?

2009-04-06 Thread Kevin Keane
Actually, this is not just in Nagios; this is standard Unix escaping. 
And it's not really 3 \. Rather, what is going on is that standard Unix 
escaping is applied twice - first when parsing the config file, and 
again when passing the arguments to the plugin.

In Unix, normally when you put a \ anywhere, it escapes the following 
character. For instance, a \ before a space means the next character 
isn't really a space, don't treat it as the end of the path. And a \ 
before a \ means the second backslash isn't really an escape character, 
but rather I want a literal backslash. So in order to get a single \ in 
the plugin, on the command line you need to escape it with another \. 
You found that out when you ran check_nrpe2 from the command line.

Now when Nagios parses the config file, it uses the same escaping 
mechanism. So when you simply put \\ into the config file, Nagios 
interprets the first one as escape and the second one as escaped to 
be literal - thus, you'd end up with a single \ in the command line. 
But you wanted two \. So you need to tell Nagios to do the same thing 
twice:  - \\ in the command line - \ for the plugin to see.

And where you needed the plugin to actually see \\ (before the 
localhost), you need to do the same thing yet again, for a total of 
eight consecutive backslashes.

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_mp3mn_mp3_08_07streams

 ...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. :-/

 -Original Message-
 From: Janet Sullivan 
 Sent: Monday, April 06, 2009 1:56 PM
 To: 'nagios-users@lists.sourceforge.net'
 Subject: Escape \ in nagios config files?

 I want to check the disk space of a UNC path -
 \\localhost\_definst_\mp3\mn_mp3_08_07\streams

 From the command line, I can check it fine (using check_nrpe2) if I
 escape each  \ like this:

 localhost\\_definst_\\mp3\\mn_mp3_08_07\\streams

 But when I try to use configure Nagios to check it, it strips out all
 the \ characters.  I've tried single quotes, double quotes, and escaping
 each \ - no luck.  How can I tell Nagios about this path in a service
 definition without it stripping out the special characters?  Is there an
 escape method I'm missing?  


 --
 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@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
   


-- 
Kevin Keane
Owner
The NetTech
Find the Uncommon: Expert Solutions for a Network You Never Have to Think About

Office: 866-642-7116
http://www.4nettech.com

This e-mail and attachments, if any, may contain confidential and/or 
proprietary information. Please be advised that the unauthorized use or 
disclosure of the information is strictly prohibited. The information herein is 
intended only for use by the intended recipient(s) named above. If you have 
received this transmission in error, please notify the sender immediately and 
permanently delete the e-mail and any copies, printouts or attachments thereof.


--
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@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