Disabled replication jobs

| 0 comments | 3,083 views
Categories: ,

VN:F [1.9.17_1161]
Rating: 5.0/5 (2 votes cast)

This metric investigates replication jobs, searching for any that may be disabled inappropriately.

If any of your replication jobs have been disabled inappropriately, you may not be aware of their state. If too much time passes, your publication may expire. This will inevitably cause you grief in recreating the publication. Ensuring that your replication jobs are functioning as desired is paramount. Monitoring them is vital to the health of your replication topology.

The associated alert will keep a vigilant eye on your systems, ensuring that the appropriate jobs remain in an enabled state and allowing their functionality to continue executing properly.

To analyze further and see the status of all replication jobs, execute the following query:

SELECT @@ServerName AS [ServerName],
    sj.[Name],
    CASE WHEN sj.[enabled] = 1 THEN 'Enabled'
         ELSE 'Not Enabled - Please Investigate'
    END AS [Enabled],
    ISNULL(run_date, '') AS [Run_Date]
  FROM msdb.dbo.sysjobs sj
  LEFT OUTER JOIN (SELECT MAX(CASE WHEN run_date IS NULL THEN ''
                                   ELSE SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                  1, 4) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    5, 2) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    7, 2)
                              END) AS [run_date],
                      job_id
                    FROM msdb.dbo.sysjobhistory sh
                    WHERE Step_id = 0
                    GROUP BY job_id
                  ) AS sh
  ON
    sh.job_id = sj.job_id
  WHERE (sj.name LIKE '%Distribution%'
    OR sj.name LIKE '%LogReader%')
    AND sj.name NOT LIKE '%backup%'
    AND sj.name NOT LIKE 'Replication monitoring refresher for distribution.'
  ORDER BY [run_date] DESC,
    sj.[name];

Note: This metric works on SQL Server 2000 SP4 and later versions.

Disabled replication jobs, 5.0 out of 5 based on 2 ratings

Metric definition

Metric Name:
Monitor replication jobs
Description:

This metric investigates replication jobs, searching for any that may be disabled inappropriately.

If any of your replication jobs have been disabled inappropriately, you may not be aware of their state. If too much time passes, your publication may expire. This will inevitably cause you grief in recreating the publication. Ensuring that your replication jobs are functioning as desired is paramount. Monitoring them is vital to the health of your replication topology.

The associated alert will keep a vigilant eye on your systems, ensuring that the appropriate jobs remain in an enabled state and allowing their functionality to continue executing properly.

To analyze further and see the status of all replication jobs, execute the following query:

SELECT @@ServerName AS [ServerName],
    sj.[Name],
    CASE WHEN sj.[enabled] = 1 THEN 'Enabled'
         ELSE 'Not Enabled - Please Investigate'
    END AS [Enabled],
    ISNULL(run_date, '') AS [Run_Date]
  FROM msdb.dbo.sysjobs sj 
  LEFT OUTER JOIN (SELECT MAX(CASE WHEN run_date IS NULL THEN ''
                                   ELSE SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                  1, 4) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    5, 2) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    7, 2)
                              END) AS [run_date],
                      job_id
                    FROM msdb.dbo.sysjobhistory sh
                    WHERE Step_id = 0
                    GROUP BY job_id
                  ) AS sh
  ON
    sh.job_id = sj.job_id
  WHERE (sj.name LIKE '%Distribution%'
    OR sj.name LIKE '%LogReader%')
    AND sj.name NOT LIKE '%backup%'
    AND sj.name NOT LIKE 'Replication monitoring refresher for distribution.'
  ORDER BY [run_date] DESC,
    sj.[name];
Enter the T-SQL query that will collect data:
SELECT COUNT(*) AS [Count]
  FROM msdb.dbo.sysjobs sj 
  LEFT OUTER JOIN (SELECT MAX(CASE WHEN run_date IS NULL THEN ''
                                   ELSE SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                  1, 4) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    5, 2) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    7, 2)
                              END) AS [run_date],
                      job_id
                    FROM msdb.dbo.sysjobhistory sh
                    WHERE Step_id = 0
                    GROUP BY job_id
                  ) AS sh
  ON
    sh.job_id = sj.job_id
  WHERE (sj.name LIKE '%Distribution%'
    OR sj.name LIKE '%LogReader%')
    AND sj.name NOT LIKE '%backup%'
    AND sj.name NOT LIKE 'Replication monitoring refresher for distribution.'
    AND sj.[enabled] <> 1;
Note: This query, limits the results to specifically named jobs. Replace the following terms with appropriate values for your system and needs, ensuring that they match your naming convention:

[sql]‘%Distribution%’[/sql]

'%LogReader%'

'%backup%'

'Replication monitoring refresher for distribution.'[/sql]

Select instances to collect from:
Manually select instances containing the databases you’re interested in.
Note: Turn on the check boxes for instances that perform replication tasks.
Choose databases to collect from:
Specify databases and type
MSDB
Set collection frequency:
Collect data every hour
Use collected or calculated values:
Leave the Use a calculated rate of change between collections check box turned off
Metric collection is:
Enabled

Alert definition

Alert name:
Disabled replication jobs
Description:

This alert is raised when replication jobs that may have been disabled inappropriately are detected. It ensures that the appropriate jobs remain in an enabled state, allowing their functionality to continue executing properly.

If any of your replication jobs have been disabled inappropriately, you may not be aware of their state. If too much time passes, your publication may expire. This will inevitably cause you grief in recreating the publication. Ensuring that your replication jobs are functioning as desired is paramount. Monitoring them is vital to the health of your replication topology.

To analyze further and see the status of all replication jobs, execute the following query:

SELECT @@ServerName AS [ServerName],
    sj.[Name],
    CASE WHEN sj.[enabled] = 1 THEN 'Enabled'
         ELSE 'Not Enabled - Please Investigate'
    END AS [Enabled],
    ISNULL(run_date, '') AS [Run_Date]
  FROM msdb.dbo.sysjobs sj 
  LEFT OUTER JOIN (SELECT MAX(CASE WHEN run_date IS NULL THEN ''
                                   ELSE SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                  1, 4) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    5, 2) + '-'
                                        + SUBSTRING(CONVERT(VARCHAR, sh.run_date),
                                                    7, 2)
                              END) AS [run_date],
                      job_id
                    FROM msdb.dbo.sysjobhistory sh
                    WHERE Step_id = 0
                    GROUP BY job_id
                  ) AS sh
  ON
    sh.job_id = sj.job_id
  WHERE (sj.name LIKE '%Distribution%'
    OR sj.name LIKE '%LogReader%')
    AND sj.name NOT LIKE '%backup%'
    AND sj.name NOT LIKE 'Replication monitoring refresher for distribution.'
  ORDER BY [run_date] DESC,
    sj.[name];
Raise an alert when the metric value goes:
Above the defined thresholds
Default threshold values:
Set the thresholds as follows:
High:0
Medium:Turn off check box
Low:Turn off check box
Note: These thresholds are intended as guideline values. If they seem too high or too low for your environment, replace them with values more suited to your server performance.
Raise an alert when the threshold is passed for:
Enter 1 collection
This alert is:
Enabled
VN:F [1.9.17_1161]
Rating: 5.0/5 (2 votes cast)