[Nagiosplug-devel] Spaces in arguments?
Volker.Aust at premiere.de
Volker.Aust at premiere.de
Tue Sep 3 04:25:03 CEST 2002
I have notice this only when Nagios is compiled with embedded perl. Without
embedded perl Nagios calls a shell which is calling the plugin. And the
shell does pay attention to single or double quotes. With embedded perl
Nagos calls the plugin directly and does not pay attention to single or
double quotes.
For my plugin that needs arguments with spaces I have decide to URL-encode
spaces (and percent signs, eg. A%20String%20With%20Spaces) and to URL-decode
it in the script with:
# this RE come's from uri_unescape() from the module URI::Escape
$service =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
Hope this helps.
-vol
> -----Original Message-----
> From: Jan David [mailto:jan.david.jd at belgium.agfa.com]
> Sent: Tuesday, September 03, 2002 9:27 AM
> To: Gunnar Hellekson <ghelleks
> Cc: nagiosplug-devel
> Subject: Re: [Nagiosplug-devel] Spaces in arguments?
>
>
>
> You can't fix it. I've posted a very similar note on the
> Netsaint plugin
> development list just a couple of days ago. Apparantly this
> issue has been
> around for some time. The only way to solve it is to dig into
> the code and
> write a patch. This is obviously not the most rapid solution,
> so in the
> meantime, I suggest you forget about spaces and use hyphens
> or underscores
> for now.
>
> Regards,
>
> J. David
>
>
>
>
>
> Gunnar Hellekson <ghelleks at yahoo.com>@lists.sourceforge.net
> on 09/03/2002
> 07:12:05 AM
>
> Sent by: nagiosplug-devel-admin at lists.sourceforge.net
>
>
> To: nagiosplug-devel <nagiosplug-devel at lists.sourceforge.net>
> cc:
> Subject: [Nagiosplug-devel] Spaces in arguments?
>
>
> I've pored through the Nagios code, posted questions, and
> tried to find
> working examples. I'm starting to think I'm stupid. I've
> written a plugin
> which takes, among other things, a string containing spaces.
>
> define command {
> command_name my_plugin
> command_line $USER1$/my_plugin -C '$ARG1$' -T $ARG2$
> }
>
> define service {
> host_name my-host
> service_description buggy-service
> use generic-service
> check_command my_plugin!A String With Spaces!AnotherValue
> }
>
> Running this as nagios works, of course:
>
> ./my_plugin -C 'A String With Spaces' -T AnotherValue
>
> When run in Nagios, it behaves as if:
>
> ./my_plugin -C \'A String With Spaces\' -T AnotherValue
>
> In other words, argv is:
> 0 == ./my_plugin
> 1 == -C
> 2 == 'A
> 3 == String
> etc.
>
>
> I have tried:
>
> * wrapping $ARG1$ in both (') and (") characters
> * wrapping $ARG1$ in escaped quotes (\'), (\")
> * wrapping the first argument in the service declaration
> (A String...)
> in ('), (") and escaped quotes (\'), (\")
>
> In every case, the command is executed as if each word of $ARG1$
> is a seperate argument.
>
> This is with Nagios 1.0b5, Solaris 2.6. The documentation to popen()
> and Nagios tell me that I should have to, at most, place a
> single quote (')
> around the $ARG1$ string in the check_command directive. Yet, no
> joy.
>
> Can anyone confirm this? Has anyone been able to get arguments
> containing spaces fed into their plugins?
>
> I would recompile with DEBUG1 so I could see the raw_command and
> processed_command, but nagios dumps core each time I've tried.
>
> Anyone?
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone? Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
>
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone? Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
>
More information about the Devel
mailing list