此监视器检查长期运行的 SQL 代理作业。
请注意,任何版本的 SQL Server Express 均不支持 SQL Server 代理 Windows 服务,没有合适的发现对象。此监视器在默认情况下为禁用。请在必要时使用替代启用该监视器。
此监视器检查长期运行的 SQL 代理作业。如果作业的运行时间超出配置的阈值,将生成一个警告或错误警报。
不正常状态是由运行时间超出定义的阈值的 SQL Server 代理作业引起的。这可能表示作业存在问题。
SQL Server 代理负责运行计划在特定时间或间隔发生的 SQL Server 任务,还负责检测管理员已为其定义了操作(例如通过页面或电子邮件向某人发出警报)或可解决问题的任务的特定情况。SQL Server 代理还用于运行管理员定义的复制任务。
要确定引起警告或错误状态的作业,请检查状态更改或警报的上下文。
检查 SQL Server Management Studio 以确定正在运行哪些作业。如果这些作业运行的时间过长,请对它们进行调查以查明原因。
使用 sp_help_jobactivity 以查看有关当前正在运行作业的信息。
或者,如果期望某些代理作业长时间运行: :
替代监视器以更改此特定 SQL 实例或所有实例的阈值
禁用此特定 SQL 实例或所有实例的此监视器
名称 | 说明 | 默认值 |
警报优先级 | 定义警报优先级。 | 正常 |
警报严重性 | 定义警报严重性。 | MatchMonitorHealth |
严重阈值(分钟) | 如果值超过此阈值,监视器会将其状态更改为“严重”。值介于此阈值与警告阈值(包括警告阈值)之间会导致监视器处于警告状态。 | 120 |
已启用 | 启用或禁用工作流。 | 否 |
生成警报 | 定义工作流是否生成警报。 | 是 |
间隔(秒) | 运行工作流的重复间隔时间(秒)。 | 600 |
同步时间 | 使用 24 小时格式指定的同步时间。可以忽略。 |
|
超时(秒) | 指定允许工作流在被关闭并标记为失败之前运行的时间。 | 300 |
警告阈值(分钟) | 警告阈值。超过该阈值会导致监视器至少进入警告状态。 | 60 |
Target | Microsoft.SQLServer.2016.Agent | ||
Parent Monitor | System.Health.PerformanceState | ||
Category | PerformanceHealth | ||
Enabled | False | ||
Alert Generate | True | ||
Alert Severity | MatchMonitorHealth | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SQLServer.2016.AgentLongRunningJobsProvider | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.2016.Agent.LongRunningJobs" Accessibility="Public" Enabled="false" Target="SQL2016Core!Microsoft.SQLServer.2016.Agent" ParentMonitorID="SystemHealth!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2016.AgentLongRunningJobsProvider" ConfirmDelivery="false">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2016.Agent.LongRunningJobs.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.ServerRole"]/InstanceName$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="UnderThreshold1" MonitorTypeStateID="UnderThreshold1" HealthState="Success"/>
<OperationalState ID="OverThreshold1UnderThreshold2" MonitorTypeStateID="OverThreshold1UnderThreshold2" HealthState="Warning"/>
<OperationalState ID="OverThreshold2" MonitorTypeStateID="OverThreshold2" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>600</IntervalSeconds>
<SyncTime/>
<ConnectionString>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.DBEngine"]/ConnectionString$</ConnectionString>
<Threshold1>60</Threshold1>
<Threshold2>120</Threshold2>
<TimeoutSeconds>300</TimeoutSeconds>
</Configuration>
</UnitMonitor>