<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="City"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:Tahoma;
color:maroon;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'>I am having the same
problem as you and tried what you suggest but I am getting this error when I
try the double backslash:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'>Sep 11 20:02:02
sjvp00dbs001.stubhub.com Sep 11 20:02:02 nrpe[4988]: [ID 494588 daemon.error]
Error: Request contained illegal metachars!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'>Did you encounter this?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=maroon face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:maroon'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Noel Platzke
[mailto:neufpas@gmail.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, September 11, 2009
8:11 AM<br>
<b><span style='font-weight:bold'>To:</span></b> nagios List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Nagios-users]
passing arguments with spaces</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>I managed to figure this
out with what I'm considering to be a terrible hack. When the arguments are
passed from the service definition to the command, escaped characters are
translated into their unescaped form. So when I try to pass the argument "this\
is\ a\ string" it becomes "this is a string" when it's passed to
the command. And from there it gets passed to my script which fails to parse it
as a single argument. To address this, I'm passing the string "this\\ is\\
a\\ string" so that the first time it gets passed the escaped backslashes
are translated into regular backslashes and then it passes escapes spaces.<br>
<br>
Hopefully this will be useful to someone else.<br>
<br>
<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Fri, Sep 11, 2009 at 10:26 AM, Noel Platzke <<a
href="mailto:neufpas@gmail.com">neufpas@gmail.com</a>> wrote:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>It still doesn't work. I've tried single quotes, double quotes,
escaping the quotes, escaping the spaces. Somewhere along the line nagios is
stripping things out that need to be passed to the script.<o:p></o:p></span></font></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br>
<br>
<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Thu, Sep 10, 2009 at 5:29 PM, Marc Powell <<a
href="mailto:marc@ena.com" target="_blank">marc@ena.com</a>> wrote:<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
On Sep 10, 2009, at 3:14 PM, Noel Platzke wrote:<br>
<br>
> I've tried everything possible.<br>
> I am completely lost.<br>
> I want to throw my keyboard through a window.<br>
> How in god's name do I get nagios to accept an argument that<br>
> includes spaces?<br>
><br>
> I have a service that uses the check_by_ssh plugin to run a script<br>
> on a remote server. The script takes an argument that is wrapped in<br>
> quotes and can potentially contain spaces.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>> So I defined a new
command...<br>
><br>
> command_name my_custom_script<br>
> command_line
/usr/lib/nagios/plugins/check_by_ssh -H<br>
> $HOSTADDRESS --command="/my/custom/script '$ARG1$'"<br>
><br>
> and set up a new service...<br>
><br>
> my_custom_script!"this is my argument"<o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Don't use quotes here. You're effectively canceling the quotes you<br>
have above, leaving the arguments with spaces bare. The command line<br>
that nagios is trying to run as a result is --<br>
<br>
/usr/lib/nagios/plugins/check_by_ssh -H <someaddress> --command="/my/<br>
custom/script '"this is my argument"'"<br>
<br>
--<br>
Marc<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Let Crystal Reports handle the reporting - Free <st1:City w:st="on"><st1:place
w:st="on">Crystal</st1:place></st1:City> Reports 2008 30-Day<br>
trial. Simplify your report design, integration and deployment - and focus on<br>
what you do best, core application coding. Discover what's new with<br>
<st1:City w:st="on"><st1:place w:st="on">Crystal</st1:place></st1:City> Reports
now. <a href="http://p.sf.net/sfu/bobj-july" target="_blank">http://p.sf.net/sfu/bobj-july</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users"
target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting
any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</div>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>