{"name":"Disabled backup jobs","description":"<p>This metric investigates backup jobs, searching for any that may be disabled inappropriately.<\/p>\r\n<p>If any of your backup jobs have been disabled inappropriately, you may not be aware of their state. This may cause you grief if backups do not occur properly. Ensuring that your backup jobs are functioning as desired is paramount. Monitoring them is vital to the health of your topology.  <\/p>\r\n","tsql":"SELECT \r\n      COUNT(*) AS [Count]\r\n    FROM msdb.dbo.sysjobs sj\r\n      left outer join ( \r\n                        SELECT \r\n                            MAX(CASE \r\n                                  WHEN run_date is NULL THEN ''\r\n                                  else\r\n                                    substring ( CONVERT( VARCHAR, sh.run_date), 1, 4) + '-'\r\n                                      + substring ( CONVERT( VARCHAR, sh.run_date), 5, 2) + '-'\r\n                                      + substring ( CONVERT( VARCHAR, sh.run_date), 7, 2)\r\n                                end) AS [run_date], \r\n                            job_id\r\n                          FROM msdb.dbo.sysjobhistory sh\r\n                            WHERE Step_id = 0\r\n                            GROUP BY job_id\r\n                      ) AS sh on sh.job_id = sj.job_id\r\n      WHERE sj.name LIKE '%backup%'\r\n        AND sj.name NOT IN ( 'Daily Backups.Subplan_1')\r\nAND sj.[enabled] <> 1 \r\n","instances":false,"frequency":86400,"databases":{"mode":1},"rateofchange":false,"metricenabled":true,"alertname":"Disabled backup jobs","alertdescription":"<p>This alert is raised when named backup jobs are in a disabled state. It keeps a vigilant eye on your systems, ensuring that the appropriate jobs remain in an enabled state, and allowing their functionality to continue executing properly.<\/p>\r\n<p>Execute the following query to see status of all backup jobs:<\/p>\r\n<pre class=\"sql\">SELECT \r\n        @@ServerName AS [ServerName],\r\n        sj.[Name], \r\n        CASE  \r\n          WHEN sj.[enabled] = 1 THEN 'Enabled'\r\n          ELSE 'Not Enabled - Please Investigate'\r\n        END AS [Enabled],\r\n        ISNULL( run_date, '') AS [Run_Date]\r\n      FROM msdb.dbo.sysjobs sj\r\n        left outer join ( \r\n                          SELECT \r\n                              MAX(CASE \r\n                                    WHEN run_date is NULL THEN ''\r\n                                    else\r\n                                      substring ( CONVERT( VARCHAR, sh.run_date), 1, 4) + '-'\r\n                                        + substring ( CONVERT( VARCHAR, sh.run_date), 5, 2) + '-'\r\n                                        + substring ( CONVERT( VARCHAR, sh.run_date), 7, 2)\r\n                                  end) AS [run_date], \r\n                              job_id\r\n                            FROM msdb.dbo.sysjobhistory sh\r\n                            where Step_id = 0\r\n                            GROUP BY job_id\r\n                        ) AS sh on sh.job_id = sj.job_id\r\n      WHERE sj.name LIKE '%backup%'\r\n        AND sj.name NOT in ('Daily Backups.Subplan_1')\r\n      ORDER BY [run_date] DESC, sj.[name]<\/pre>","aboveorbelow":"above","collections":1,"alertenabled":true,"_thresholds_high":{"selected":true,"value":0},"_thresholds_medium":{"selected":false},"_thresholds_low":{"selected":false},"tsql_comment":"<p>Note: This query looks for jobs with \u2018backup\u2019 in the name. It also excludes specific jobs that are acceptable to be disabled. Replace the following terms with appropriate values for your system and needs, ensuring that they match your naming convention:<\/p>\r\n<p>[%backup%]<\/p>\r\n<p>['Daily Backups.Subplan_1']<\/p>","thresholds_comment":"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.","instances_comment":"Note: Turn on the relevant check boxes.","targetentitytype":0}