SQL Server Agent State for Distributor

Microsoft.SQLServer.Replication.Windows.Monitor.Distributor.SQLServerAgentState (UnitMonitor)

This monitor checks if the SQL Server Agent is running on Distributor.

Knowledge Base article:

Summary

The SQL Server Agent service is installed automatically during the SQL Server setup. This Windows service is used by Replication to start and stop the Replication SQL Server Agent Jobs which are responsible for data movement.

Causes

The SQL Server Agent Service may have been manually stopped or stopped as result of a failure of the Agent. Examine the Windows Application Event log for possible causes for an unexpected stopped Agent service.

If the Agent "Start Mode" property is set to "Manual" instead of “Automatic”, the SQL Server Agent service will not automatically restart upon reboot of the server.

Resolutions

Start the SQL Server Agent service under Windows Services, SQL Server Configuration Manager, or via SQL Server Management Studio. If the Agent "Start Mode" is set to "Manual", consider changing to "Automatic".

Start, Stop, or Pause the SQL Server Agent Service http://technet.microsoft.com/library/ms190695.aspx

Additional

Use the following link to view the SQL Server Agent Error Log: http://msdn.microsoft.com/library/ms175488.aspx

This topic describes how to configure Microsoft SQL Server Agent to automatically restart if it should stop unexpectedly in SQL Server on Windows: https://msdn.microsoft.com/library/ms178130.aspx

Overrideable Parameters

Name

Description

Default Value

Alert Priority

Defines Alert Priority.

Normal

Alert Severity

Defines Alert Severity.

Critical

Enabled

Enables or disables the workflow.

Yes

Generates Alerts

Defines whether the workflow generates an Alert.

Yes

Interval (seconds)

The recurring interval of time in seconds in which to run the workflow.

600

Synchronization Time

The synchronization time specified by using a 24-hour format. May be omitted.

 

Timeout (seconds)

Specifies the time the workflow is allowed to run before being closed and marked as failed.

300

Timeout for database connection (seconds)

The workflow will fail and register an event if it cannot access the database during the specified period.

15

Element properties:

TargetMicrosoft.SQLServer.Replication.Windows.Distributor
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.Replication.Windows.MonitorType.SqlServiceStatus
RemotableTrue
AccessibilityPublic
Alert Message
MSSQL on Windows Replication: Distributor: SQL Server Agent Windows service stopped.
The SQL Server Agent Windows service has stopped on SQL Server Instance {1} on computer {0} for Distributor.
RunAsMicrosoft.SQLServer.Core.RunAs.Monitoring

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.Replication.Windows.Monitor.Distributor.SQLServerAgentState" Accessibility="Public" Enabled="true" Target="SQLReplWD!Microsoft.SQLServer.Replication.Windows.Distributor" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.Replication.Windows.MonitorType.SqlServiceStatus" ConfirmDelivery="false" RunAs="SqlCoreLib!Microsoft.SQLServer.Core.RunAs.Monitoring">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.Replication.Windows.Monitor.Distributor.SQLServerAgentState.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/InstanceName$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Running" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="RunningManualOrUnableToDetectStatus" HealthState="Warning"/>
<OperationalState ID="Error" MonitorTypeStateID="NotRunning" HealthState="Error"/>
</OperationalStates>
<Configuration>
<MachineName>$Target/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/MachineName$</MachineName>
<NetbiosComputerName>$Target/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/InstanceName$</InstanceName>
<ConnectionString>$Target/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<MonitoringType>$Target/Host/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine"]/MonitoringType$</MonitoringType>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<IntervalSeconds>600</IntervalSeconds>
<SyncTime/>
</Configuration>
</UnitMonitor>