Use this Knowledge Script to monitor the up or down status of SQL Server. If the SQL Server or agent services are down, this script raises an event and optionally, attempts to start the services.
This script can also identify the downtime of the SQL Server since the server was started. This information is returned in the event detail message.
SQL Server instance
The default interval for this script is Every five minutes.
Set the following parameters as needed:
NOTE:The ServiceDown Knowledge Script does not raise any event or collect data for agent service for SQL Server Express Edition, because it does not monitor the agent service for SQL Server Express edition.
Description |
How to Set It |
---|---|
General Settings |
|
Job Failure Notification |
|
Raise event if job fails unexpectedly? |
Select Yes to raise an event if the SQLServer_ServerDown job fails unexpectedly. The default is Yes. |
Event severity when job fails unexpectedly |
Set the event severity level, from 1 to 40, to indicate the importance of an event that is raised when the job fails unexpectedly. The default is 5. |
Additional Settings |
|
Event Details |
|
Event detail format |
Select the format in which you want to display the event detail. You can select from HTML Table or Plain Text. The default is HTML Table. |
Monitor Server State |
|
Restart SQL Server automatically if down? |
Select Yes to automatically restart SQL Server if it is detected down. The default is Yes. |
Event Notification |
|
Raise event if service restart fails or succeeds? |
Select Yes to raise an event if a restart service fails or succeeds. The default is Yes. |
Event severity when service restart fails |
Set the event severity level, from 1 to 40, to indicate the importance of an event in which the service is down and AppManager for Microsoft SQL Server cannot restart it. The default is 5. |
Event severity when service restart succeeds |
Set the event severity level, from 1 to 40, to indicate the importance of an event in which the service is down and AppManager for Microsoft SQL Server successfully restarted it. The default is 25. |
Raise event if service down time exceeds threshold? |
Select Yes to raise an event if service down time exceeds the threshold you specify. The default is unselected. |
Event severity when service down time exceeds threshold |
Set the event severity level, from 1 to 40, to indicate the importance of an event in which the service down time exceeds the threshold you set. The default is 5. |
Threshold - Maximum service down time |
Specify the maximum time in minutes that a service can be down before an event is raised. The default is 5 minutes. |
Raise event if SQL Server’s server or agent service is disabled? |
Select Yes to raise an event if the SQL Server’s server or agent service is disabled. The default is unselected. |
Event severity when SQL Server’s server or agent service is disabled |
Set the event severity level, from 1 to 40, to indicate the importance of an event in which the SQL Server’s server or agent service is disabled. The default is 15. |
Raise event if SQL Server’s server or agent service does not exist? |
Select Yes to raise an event if the SQL Server’s server or agent service does not exist. The default is unselected. |
Event severity when SQL Server’s server or agent service does not exist |
Set the event severity level, from 1 to 40, to indicate the importance of an event in which the SQL Server’s server or agent service does not exist. The default is 25. |
Data Collection |
|
Collect data for server downtime? |
Select Yes to collect data for the total number of hours the server was down for charts and reports. If enabled, data collection returns the number of hours the server has been down since it was started. The default is unselected. |