How to escape characters correctly

Hey everyone,

I’m trying to query my hosts through the nscp api. Using

./check_nscp_api '--password' 'password' '-H' '' '-a' 'service=nscp' "crit=state='stopped'" '-q' 'check_service'

directly from the command line of my icinga server I get the expected results.

Trying to use the director for it though it seems to be escaping the “crit=state=‘stopped’” in a way that the query doesn’t work anymore. Inspecting the command used shows this:

'/usr/lib/nagios/plugins/check_nscp_api' '--password' 'password' '-H' '' '-a' 'service=nscp'\'' '\''"crit=state='\''stopped'\''"' '-q' 'check_service'

Which results in the following error message:

check_service Failed to open service nscp "crit=state='stopped'": 424: Der angegebene Dienst ist kein installierter Dienst.

Does anyone know what or how I’d have to format the arguments for icinga to create a valid query?