passing arguments with spaces

Marc Powell marc at ena.com
Thu Sep 10 23:29:05 CEST 2009


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





More information about the Users mailing list