-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Description
Unfortunately, there are software companies which deliver setup routines that create a service with spaces.
e.g.

The check "Invoke-IcingaCheckService" can't deal with this, because this is the plugin output:

The director is rendering this call:
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' '-C' 'try { Use-Icinga; } catch { Write-Output '\''The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'\''; exit 3; }; Exit-IcingaPluginNotInstalled '\''Invoke-IcingaCheckService'\''; exit Invoke-IcingaCheckService' '-Service' 'EJM Agent' '-Exclude' '$null' '-Status' 'Running' '-Verbosity' '3'
I looked into the command definition and tested a little bit. I saw the quotes are missing. I'm not an Icinga-DSL pro, but this change works (for us). But I think there is a nicer and more elegant solution :
var arr = macro("$IcingaCheckService_Array_Service$");
if (len(arr) == 0) {
return "$null";
}
return "'" + arr.join("', '") + "'";
Tested with one service to check

'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' '-C' 'try { Use-Icinga; } catch { Write-Output '\''The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'\''; exit 3; }; Exit-IcingaPluginNotInstalled '\''Invoke-IcingaCheckService'\''; exit Invoke-IcingaCheckService' '-Service' ''\''"EJM Agent"'\''' '-Exclude' '$null' '-Status' 'Running' '-Verbosity' '3'
And also tested with more services to check:

'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' '-C' 'try { Use-Icinga; } catch { Write-Output '\''The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'\''; exit 3; }; Exit-IcingaPluginNotInstalled '\''Invoke-IcingaCheckService'\''; exit Invoke-IcingaCheckService' '-Service' ''\''EJM Agent'\'', '\''icinga2'\'', '\''icingapowershell'\'', '\''MpsSvc'\'', '\''EventLog'\''' '-Exclude' '$null' '-Status' 'Running' '-Verbosity' '3'
Metadata
Metadata
Assignees
Labels
EnhancementNew feature or requestNew feature or request