Escape spaces in Invoke-IcingaCheckProcessCount

Hi there,

I am testing out Invoke-IcingaCheckProcessCount in a lab environment at home, and I am attempting to monitor if the ‘Plex Media Service’ process is running.

PS C:\Windows\system32> Get-Process -Name 'Plex Media Server'

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    837     338   117452     124536  15,743.31   5428   2 Plex Media Server

Running this manually in PS appears to work fine:

PS C:\Windows\system32> Invoke-IcingaCheckProcessCount -Warning '1:' -Critical '1:' -Process 'Plex Media Server'
[OK] Check package "Process Check"
| 'process_count_plex_media_server'=1;1:;1:
0

However when I use check command configured via Director, it appears it is treating the space between the process name as an escape character:

Plugin Output:

[CRITICAL] Check package "Process Check" - [CRITICAL] Process Count "Plex"
\_ [CRITICAL] Process Count "Plex": Value "0" is lower than threshold "1"

Executed command:

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-IcingaCheckProcessCount'\''; exit Invoke-IcingaCheckProcessCount' '-Warning' '1:' '-Critical' '1:' '-Process' 'Plex Media Server' '-Verbosity' '0'

Custom Variables:

Custom Variables:

icingacheckprocesscount_array_process	Plex Media Server
icingacheckprocesscount_int32_verbosity	0
icingacheckprocesscount_object_critical	1:
icingacheckprocesscount_object_warning	1:
icingacheckprocesscount_switchparameter_noperfdata	false

Is there any way to escape the spaces? I’ve tried a few combinations but could not work it out.

Hi,
have you tried putting the process name into single quotes (‘Plex Media Server’) in the director array like you did in powershell? So the arguments should look like this:
icingacheckprocesscount_array_process ‘Plex Media Server’

I had the same issue with $-signs and this worked for me.

1 Like

I will give this a shot later tonight and report back :slight_smile:

Hi,

looks like the same problem like this: Invoke-IcingaCheckService has problems with spaces in servicename · Issue #125 · Icinga/icinga-powershell-plugins · GitHub

1 Like