check_nrpe passing string with spaces

  • Hey Guys,


    I have a command which checks my windows service and an eventhandler which restarts this service if it´s not started.


    /usr/lib64/nagios/plugins/check_nrpe -H $address$ -p 5666 -c check_winservice -a $Servicename$


    nsclient.ini:

    restart_service = powershell.exe scripts\restart_service.ps1 "$ARGS$"; exit($lastexitcode) | powershell.exe -command -

    check_winservice = powershell.exe scripts\win_service.ps1 "$ARGS$"; exit ($lastexitcode) | powershell.exe -command -


    This works if the servicename has no space included ....like "spooler"

    But i have a view services with spaces in the servicename.

    Is there any way to fix this, because i don´t want to write every service hard coded in my nsclient.ini.

  • if you look into the services.msc panel you can see that every service got a Servicename and a display name.

    Usually The service name does not include a space in the name.

    You can use this one.