passing arguments with spaces

Noel Platzke neufpas at gmail.com
Fri Sep 11 16:26:28 CEST 2009


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.



On Thu, Sep 10, 2009 at 5:29 PM, Marc Powell <marc at ena.com> wrote:

>
> On Sep 10, 2009, at 3:14 PM, Noel Platzke wrote:
>
> > I've tried everything possible.
> > I am completely lost.
> > I want to throw my keyboard through a window.
> > How in god's name do I get nagios to accept an argument that
> > includes spaces?
> >
> > I have a service that uses the check_by_ssh plugin to run a script
> > on a remote server. The script takes an argument that is wrapped in
> > quotes and can potentially contain spaces.
>
> > So I defined a new command...
> >
> > command_name        my_custom_script
> > command_line           /usr/lib/nagios/plugins/check_by_ssh -H
> > $HOSTADDRESS --command="/my/custom/script '$ARG1$'"
> >
> > and set up a new service...
> >
> > my_custom_script!"this is my argument"
>
> Don't use quotes here. You're effectively canceling the quotes you
> have above, leaving the arguments with spaces bare. The command line
> that nagios is trying to run as a result is --
>
> /usr/lib/nagios/plugins/check_by_ssh -H <someaddress> --command="/my/
> custom/script '"this is my argument"'"
>
> --
> Marc
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090911/3677d56e/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
-------------- next part --------------
_______________________________________________
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