| The macros are expanded by Nagios - not the plugins. But I think the
| space issue still exist.
I haven't stared hard at the code, but I think it expands macros
in a string, and then passes the string to popen (and hence the shell).
Try quoting the argument in the command definition e.g.
command[event-oracle-freespace]=$USER2$/event_oracle_freespace $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$ "$SERVICEDESC$"
My simple-minded test suggested that that would likely work.
You might be able to quote it it the service definition, but then
the displayed information and notices would also include the quotes,
which would likely be ugly. If it was just an ARG to the command
(i.e. in the exclamation mark separated list) then you could likely
also quote it there.
(It could perhaps be useful for nagios to do argument expansion
into an array of strings, and then use one of the exec(3) family
of functions to invoke the plugin, but that's much more complicated
than popen(), and you might someday want to have the shell do
wildcarding, or redirection or pipes or something.)
| > If you have defined a service with a name that has spaces in it, then the
| > $SERVICEDESC$ macro will not get passed through correctly to an event
| > handler.
| > Example:
| > --------------
| > Suppose we have the following line in hosts.cfg:
| > service[unix-machine]=ORA FREESPACE;0;24x7;1;60;30;oracle-admins;240;24x7;1;1;0;event-oracle-freespace;check-oracle-freespace
| > and the following line in commands.cfg
| > command[event-oracle-freespace]=$USER2$/event_oracle_freespace $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$ $SERVICEDESC$
| > When the service check is performed and a state change occurs, the event handler is executed. As you can see from the line above, it expects 5
| > arguments. One of them
| > is the service description $SERVICEDESC$ which is derived from the definition in the service line.
| > The macro $SERVICEDESC$ should pass the value 'ORA FREESPACE' to the eventhandler, but in reality only 'ORA' is passed on. This causes some problems
| > because I
| > want to automatically log a comment to the comments file using the ADD_SVC_COMMENT external command. This extranal command requires the 'correct'
| > service description
| > in order to work.
| > I solved the problem by not using whitespace in service descriptions.
| > Either this is a bug OR is should be mentioned in the documentation that one is not allowed to use whitespace in service descriptions.
| > Regards,
| > J. David