check_service (windows)
Checks the state of one or multiple Windows services.
There is a specific check_service for Linux as well.
Implementation
| Windows | Linux | FreeBSD | MacOSX |
|---|---|---|---|
| ✅ |
Argument Defaults
| Argument | Default Value |
|---|---|
| filter | none |
| warning | state != ‘running’ && start_type = ‘delayed’ |
| critical | state != ‘running’ && start_type = ‘auto’ |
| empty-state | 3 (UNKNOWN) |
| empty-syntax | %(status) - No services found |
| top-syntax | %(status) - %(crit_list){{ IF crit_list != ’’ and warn_list != ’’ }}, {{ END }}{{ IF warn_list != ’’ }}delayed (%(warn_list)){{ END }}{{ IF crit_list == ’’ and warn_list == ’’ }}found ${count} services{{ END }} |
| ok-syntax | %(status) - All %(count) service(s) are ok. |
| detail-syntax | ${name}=${state} (${start_type}) |
Check Specific Arguments
| Argument | Description |
|---|---|
| exclude | List of case-insensitive services to exclude from the check (mainly used when service is set to *). Supports wildcards. |
| service | List of services to check (set to * to check all services). (case insensitive) Default: * |
Attributes
Filter Keywords
these can be used in filters and thresholds (along with the default attributes):
| Attribute | Description |
|---|---|
| name | The name of the service. When used as filter, looks in name and display. |
| service | Alias for name. When used as filter only looks in name. |
| display | Display name of the service. When used as filter, looks in name and display. |
| desc | Alias for display (not a typo). When used as filter, looks only in display. |
| description | Description of the service |
| state | The state of the service, one of: stopped, starting, stopping, running, continuing, pausing, paused or unknown |
| pid | The PID of the service |
| created | Date when service was started |
| age | Seconds since service was started |
| rss | Memory RSS in bytes |
| vms | Memory VMS in bytes |
| cpu | CPU usage in percent |
| delayed | If the service is delayed, can be 0 or 1 |
| classification | Classification of the service, one of: kernel-driver, system-driver, service-adapter, driver, service-own-process, service-shared-process, service or interactive |
| start_type | The configured start type, one of: boot, system, delayed, auto, demand, disabled or unknown |
Examples
Default Check
Checking all services except some excluded ones:
check_service exclude=edgeupdate exclude=RemoteRegistry
OK - All 15 service(s) are ok |'count'=15;;;0 'failed'=0;;;0
Checking a single service:
check_service service=dhcp
OK - All 1 service(s) are ok.
Example using check_snclient and Naemon
Naemon Config
define command{
command_name check_snclient
command_line $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}
define service {
host_name testhost
service_description check_service
use generic-service
check_command check_snclient!check_service!service=dhcp
}