Check service

Overview

Checks the state of one or more Windows services. You have to provide the case-insensitive „Service Name“, not the „Display Name“. Supports Python regular expressions, so you are able to check multiple Windows services on a host with almost the same name, for example.

Example:

  • Display Name: „Diagnostic Policy Service“

  • Service Name: DPS (provide this)

Hints:

  • For use in Icinga Director: If the service name contains a $, this dollar sign must be escaped with another dollar sign. Since the plugin is capable of regular expressions, this character must also be escaped with a backslash. So if you want to check my$service, you have to specify my\$$service.

  • On the command line: If you want to check my$service, you have to specify my\$service.

Fact Sheet

Check Plugin Download

https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/service

Check Interval Recommendation

Once a minute

Can be called without parameters

No

Compiled for

Windows

3rd Party Python modules

psutil

Help

usage: service [-h] [-V] [--always-ok] [-c CRIT] --service SERVICE
               [--starttype {automatic,disabled,manual}]
               [--status {continue_pending,pause_pending,paused,running,start_pending,stop_pending,stopped}]
               [-w WARN]

Checks the state of one or more Windows services. You have to provide the
case-insensitive "Service Name", not the "Display Name". Supports Python
regular expressions, so you are able to check multiple Windows services on a
host with almost the same name, for example.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  -c CRIT, --critical CRIT
                        Set the CRIT threshold. Accepts ranges. Default:
                        "None"
  --service SERVICE     Name of the service. Supports Python Regular
                        Expressions (regex).
  --starttype {automatic,disabled,manual}
                        Expected service start type. Default: automatic
  --status {continue_pending,pause_pending,paused,running,start_pending,stop_pending,stopped}
                        At least one expected service status (repeating).
                        Default: running
  -w WARN, --warning WARN
                        Set the WARN threshold. Accepts ranges. Default: "1:"

Usage Examples

Check that exactly one service named „AppIDSvc“ (exact match) is running, otherwise WARN:

service --service="^appidsvc$" --status=running --warning=1:1

Output:

0 services named "^appidsvc$" with status "running" found, but expected "1:1" [WARNING].

Service Name ! Display Name         ! Status  ! Startup
-------------+----------------------+---------+---------
AppIDSvc     ! Application Identity ! stopped ! manual

Check that there are at least 10 but not more than 20 Windows Services named „myapp followed by a 4-digit serial number“ meet the status „running“:

service --service="^myapp[0-9]{4}$" --status=running --warning=10:19

Everything is ok.

Output:

Service Name ! Display Name         ! Status  ! Startup
-------------+----------------------+---------+---------
myapp2606    ! ...                  ! ...
...

States

  • WARN or CRIT if number of services found does not fit into the given ranges.

Perfdata / Metrics

There is no perfdata.

Credits, License