Skip to content

Windows service.exe fails monitoring services where technical Service Name contains spaces #921

@kilianmeister-klmitag

Description

@kilianmeister-klmitag

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Windows from download.linuxfabrik.ch
  • Source Code from GitHub

Bug description

The service.exe plugin for Windows fails to monitor services whose technical Service Name contains spaces.

This affects services like those installed by Parallels RAS, where the technical name (Win32_Service.Name) is "RAS Telegraf" — with a space. The plugin fails to match this service name, even when using quotes or regex syntax.

Expected: The plugin should support service names with whitespace (which are valid on Windows).
Actual: The plugin throws an error indicating that the service name was not found.

Steps to reproduce - Plugin call

service.exe --service="RAS Telegraf"

Steps to reproduce - Data

PS C:> Get-WmiObject Win32_Service | Where-Object { $_.DisplayName -like "RAS Telegraf" } | Select-Object Name, DisplayName

Name DisplayName


RAS Telegraf RAS Telegraf

Plugin output:
rRAS Telegraf does not match any service name.

Tried also:
service.exe --service="^RAS Telegraf$"
service.exe --service=".*Telegraf"

Environment

Windows Server 2022
Parallels RAS 19.x
Icinga2 Agent on Windows
Plugin binary: service.exe (from Linuxfabrik monitoring plugin package)

Plugin Version

service.exe: v2025021501 by Linuxfabrik GmbH, Zurich/Switzerland

Python version

No response

List of Python modules

No response

Additional Information

The plugin likely uses psutil.win_service_get(name), which is strict and fails on whitespace-containing service names.

Suggested fix:
Iterate all services using psutil.win_service_iter() and match manually, e.g.:

services = [s.as_dict() for s in psutil.win_service_iter()]
service = next((s for s in services if s['name'].lower() == service_name.lower()), None)

Additionally, consider allowing regex or fallback to DisplayName matching for flexibility.

This issue affects any service where Win32_Service.Name contains spaces — which is rare but valid on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions