| Version 17 (modified by Remc0, 3 years ago) (diff) |
|---|
TracNav
Modules
- overview
Checks and commands
- overview
CauseCrashes...
CheckNSCP...
CheckDisk...
CheckLogFile...
CheckEventLog...
CheckSystem
CheckHelpers...
CheckTaskSched...
CheckTaskSched2...
CheckWMI...
Scripting Languages?...
Servers and protocols?...
Utilities and tools?...
Documentation...
Guides...
Information...
Sponsoring...
Donate...
CheckServiceState
This check checks the state of one or more service on the system and generates a critical state if any service is not in the required state.
| Option | Values | Description |
| ShowAll | A flag to toggle if all service states should be listed. | |
| ShowFail? | (default) | A flag to indicate if only failed service states should be listed. |
| service=state | A service name or service display name and a state the service should have. The state can be either started or stopped. If no state is given started is assumed. | |
| CheckAll? | Check to see that all services set to auto-start are started and all set to disabled are not started. | |
| exclude | service name | Exclude this service from CheckAll? |
| truncate | off | Truncate the returned data. |
Configuration
ow to interpret "CheckAll?" can be configred and for details refer to the configuration section for the CheckSystem module
Examples
Sample check
Check that myService is running and that MyStoppedService? is not running:
Sample Command:
CheckServiceState ShowAll myService MyStoppedService=stopped
OK: myService : Running - MyStoppedService : StoppedNagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a ShowAll $ARG1$ $ARG2$=stopped
}
<<CheckServiceState>> myService!MyStoppedService
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckServiceState -a ShowAll myService MyStoppedService=stopped
Auto started
Check that all auto-start services are running but exclude some that are intentionaly not in the correct state:
Sample Command:
CheckServiceState CheckAll exclude=wampmysqld exclude=MpfService
OK: OK: All services are running.Nagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a CheckAll exclude=$ARG1$ exclude=$ARG2$
}
<<CheckServiceState>> wampmysqld!MpfService
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckServiceState -a CheckAll exclude=wampmysqld exclude=MpfService
Service name with spaces
If the service you are excluding has spaces in, you need to enclose the entire option in quotes, not just the string. So also include "exclude=" between the quotes. See below.
Sample Command:
CheckServiceState CheckAll exclude=wampmysqld "exclude=NetBackup SAN Client Fibre Transport Service"
OK: ...Nagios Configuration:
define command {
command_name <<CheckServiceState>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckServiceState -a CheckAll exclude=$ARG1$ "exclude=$ARG2$"
}
<<CheckServiceState>> wampmysqld!NetBackup SAN Client Fibre Transport Service
From Commandline (with NRPE):
check_nrpe -H IP -p 5666 -c CheckServiceState -a CheckAll exclude=wampmysqld "exclude=NetBackup SAN Client Fibre Transport Service"








