SQL Server 代理 Windows 服务

Microsoft.SQLServer.2012.Agent.ServiceMonitor (UnitMonitor)

此监视器检查此 SQL Server 实例的 SQL 代理服务的状态。
请注意,任何版本的 SQL Server Express 均不支持 SQL Server 代理 Windows 服务。

Knowledge Base article:

摘要

此监视器检查 SQL 代理服务的状态,并在该服务设置为自动启动且未运行时生成警报。

请注意,服务被禁用时不会生成警报,并且将显示正常状态。

原因

服务可以由于很多原因而停止,包括以下原因:

解决方法

您可以使用以下链接尝试重新启动 SQL 代理的 Windows 服务:

启动 SQL 代理服务

可替代参数

名称

说明

默认值

警报优先级

定义警报优先级。

正常

警报严重性

定义警报严重性。

错误

仅当服务启动类型为“自动”时发出警报

该值仅可设置为 "true" 或 "false"。如果设置为 "false",则无论启动类型设置为何值,都会触发警报。默认值为 "true"。

已启用

启用或禁用工作流。

生成警报

定义工作流是否生成警报。

Element properties:

TargetMicrosoft.SQLServer.2012.Agent
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.2012.CheckWinServiceStateMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
SQL Server 代理 Windows 已停止
计算机 {0} 上实例 {1} 的 SQL Server 代理的 Windows 服务已停止
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.2012.Agent.ServiceMonitor" Accessibility="Public" Enabled="true" Target="SQL2012Core!Microsoft.SQLServer.2012.Agent" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2012.CheckWinServiceStateMonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2012.Agent.ServiceMonitor.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Running" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="NotRunning" HealthState="Error"/>
</OperationalStates>
<Configuration>
<Frequency>60</Frequency>
<ComputerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<ServiceName>$Target/Property[Type="SQL!Microsoft.SQLServer.Agent"]/ServiceName$</ServiceName>
<CheckStartupType>true</CheckStartupType>
<UnavailableTime>900</UnavailableTime>
</Configuration>
</UnitMonitor>