8.22 ServiceHung

Use this Knowledge Script to detect whether a discovered service is hung. You can run this script for most services, including SQL Services, Exchange Services, and IIS Services. A service is considered hung if it is in a Start-Pending, Stop-Pending, Continue-Pending or Pause-Pending state for a specified number of consecutive intervals. This script raises an event if a hung service is detected, and can stop or restart the hung service.

8.22.1 Resource Objects

Any discovered Windows computer or Windows application service

8.22.2 Default Schedule

The default interval for this script is Every 5 minutes.

8.22.3 Setting Parameter Values

Set the following parameters as needed:

Parameter

How to Set It

Number of consecutive iterations before service is hung

Specify the number of consecutive job iterations a service can be in a Start-Pending, Stop-Pending, Continue-Pending or Pause-Pending state before it is considered hung. The default is 2 consecutive iterations.

Collect data for service status?

Set to y to collect data for charts and reports. If enabled, data collection returns one of the following:

  • 100 -- service is up

  • 0 -- service is hung

The default is n.

Stop the hung service?

Set to y to automatically stop hung services. The default is y.

Start hung service after it is stopped?

Set to y to automatically start the service after stopping it. The default is y.

Event severity when start fails

Set the event severity level, from 1 to 40, to indicate the importance of an event in which this script fails to start a hung service that had been stopped. The default is 5 (red event indicator).

Event severity when start succeeds

Set the event severity level, from 1 to 40, to indicate the importance of an event in which this script successfully starts a hung service that had been stopped. The default is 25 (blue event indicator).

Event severity when “start hung service” is disabled

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the a hung service is detected and the Start hung service after it is stopped? parameter is set to n. The default is 18 (yellow event indicator).

Event severity when status retrieval fails

Set the event severity level, from 1 to 40, to indicate the importance of an event in which this script cannot determine the status of a service. The default is 10 (red event indicator).

Event severity when service stop fails

Set the event severity level, from 1 to 40, to indicate the importance of an event in which this script fails to stop a hung service. The default is 8 (red event indicator).