Single quotes in custom commands

Hi there!
I created a custom command for monitoring SAP services.
The command should be:
/usr/sap/hostctrl/exe/sapcontrol -function GetProcessList -host somehost.somedomain -nr 00 -user someuser somepassword
But Icinga turns it to
'/usr/sap/hostctrl/exe/sapcontrol' '-function' 'GetProcessList' '-host' 'somehost.somedomain' '-nr' '00' '-user' 'someuser somepassword'
How do I get rid of those single-quotes?

And please, do not tell me, that there are other modules to use, they don’t work for us.


as far as i know: You can’t get rid of it.

Is this working from console?:

'/usr/sap/hostctrl/exe/sapcontrol' '-function' 'GetProcessList' '-host' 'somehost.somedomain' '-nr' '00' '-user' 'someuser' 'somepassword'

If so you need to add the password parameter as seperate variable and use “skip_key”

-user is the argument
someuser sompassword is the value.
There is no extra argument for the password.
Problem is, that sapcontrol does not accept any quotes.
And for every system I monitor, i have different values for “-user”, “-host” and “-nr”.
So creating a command for every system is way to much work.

I tried to use this post for help:

but as I’m using icinga director, I don’t know how to manipulate the command in texteditor…

Then you have to write a wrapper script around it. easy as it is.

1 Like

you don’t need to create a command for every changed value.

yes, so ‘user’ ‘password’ should work, but ‘user password’ not.

I think that the quotes are newer interpreted by the command, but by bash to determine the end of the argument. So SAP should not get these “’”. Otherwithe every variable you send to a script would have these in it and that is NOT the case. But maybe I learn something new today :slight_smile:

I’m a bit further, how can I process the output, what means green, yellow and red?

Plugins should follow these guidelines

Thanks, ist not a plugin, I simply call saphostctrl, I can’t manipulate the output.
if Output Text contains “RED” or “GRAY” -> Status critical
if Output contains “YELLOW” -> Status warning
if Output contains “NO STATUS” -> Status Unknown
else Status OK

Again, then you have to write a wrapper script around it and write your own logic for the output and follow the guidelines about the exit codes.