This monitor checks the last run state of the SQL Agent Job. Note that SQL Server Agent Windows Service is not supported by any edition of SQL Server Express.
This monitor checks all jobs on the SQL Agent and if any of the jobs did not complete successfully, the monitor changes its state to Warning. This does not generate an alert because there is an override to disable alerts to control noise. If you want this level of monitoring, you need to override Alerting back to enabled.
The monitor has the `Number of fails threshold` override, which indicates how many times a SQL Agent Job can fail before the monitor's state is changed to 'Warning'. The override 'Defines the Canceled status as Failed' could track the Cancelled job's last run status as a Failed.
Note that SQL Server Agent Windows Service is not supported by any edition of SQL Server Express.
Name | Description | Default Value |
Alert Priority | Defines Alert Priority. | Normal |
Alert Severity | Defines Alert Severity. | Warning |
Enabled | Enables or disables the workflow. | Yes |
Generates Alerts | Defines whether the workflow generates an Alert. | No |
Interval (seconds) | The recurring interval of time in seconds in which to run the workflow. | 600 |
Synchronization Time | The synchronization time is specified by using a 24-hour format. Can be omitted. |
|
Timeout (seconds) | Specifies the time the workflow is allowed to run before being closed and marked as failed. | 300 |
Timeout for query execution (seconds) | The workflow will fail and register an event, if the query execution takes longer than the specified period. | 60 |
Timeout for database connection (seconds) | The workflow will fail and register an event, if it cannot access the database during the specified period. | 15 |
Number of fails threshold | The monitor changes its state to 'Warning' if the number of the job fails grows this threshold. | 1 |
Define the Canceled status as Failed | The workflow will register an alert, if the job's last run status is Cancelled will be specified as a Failed. | No |
Target | Microsoft.SQLServer.Windows.AgentJob | ||
Parent Monitor | System.Health.AvailabilityState | ||
Category | AvailabilityHealth | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SQLServer.Windows.MonitorType.AgentJob.LastRunState | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.Windows.Monitor.AgentJob.LastRunState" Accessibility="Public" Enabled="true" Target="SqlDiscW!Microsoft.SQLServer.Windows.AgentJob" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.Windows.MonitorType.AgentJob.LastRunState" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.Windows.Monitor.AgentJob.LastRunState.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.AgentJob"]/Name$</AlertParameter3>
<AlertParameter4>$Data/Context/Property[@Name='LastMessage']$</AlertParameter4>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="LastRunSucceeded" MonitorTypeStateID="LastRunSucceeded" HealthState="Success"/>
<OperationalState ID="LastRunFailed" MonitorTypeStateID="LastRunFailed" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<MachineName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<ConnectionString>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<MonitoringType>$Target/Host/Host/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine"]/MonitoringType$</MonitoringType>
<JobName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.AgentJob"]/Name$</JobName>
<ThresholdCountOfFails>1</ThresholdCountOfFails>
<InterpretCancelledAsFailed>false</InterpretCancelledAsFailed>
<SqlExecTimeoutSeconds>60</SqlExecTimeoutSeconds>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<IntervalSeconds>600</IntervalSeconds>
<SyncTime/>
</Configuration>
</UnitMonitor>