{"name":"Long-running job: (My_long_running_job)","description":"This metric returns the total duration (in seconds) of the longest running instance of the named job. ","tsql":"SELECT\r\n      (run_duration \/ 10000) * 3600 +\r\n      ((run_duration % 1000)\/ 100) * 60 +\r\n      (run_duration % 100) as total_job_duration\r\nFROM \r\n    msdb.dbo.sysjobs j\r\nINNER JOIN\r\n    msdb.dbo.sysjobhistory jh ON j.job_id = jh.job_id\r\nWHERE\r\n      j.name LIKE 'My_long_running_job' \r\nAND CONVERT(DATETIME, CONVERT(CHAR(8), run_date, 112) + ' ' \r\n    + STUFF(STUFF(RIGHT('000000' + CONVERT(VARCHAR(8), run_time), 6), 5, 0, ':'), 3, 0, ':'), 121) > DATEADD(HOUR, -1, GETDATE())\r\nORDER BY total_job_duration DESC","instances":true,"frequency":3600,"databases":{"mode":1},"rateofchange":false,"metricenabled":true,"alertname":"Long-running job: (My_long_running_job)","alertdescription":"This alert is raised when the named job has been running for longer than the thresholds specified.","aboveorbelow":"above","collections":1,"alertenabled":true,"_thresholds_high":{"selected":true,"value":120},"_thresholds_medium":{"selected":true,"value":60},"_thresholds_low":{"selected":true,"value":30},"name_comment":"Note: Replace (My_long_running_job) with the name of the job you're monitoring.","tsql_comment":"Note: Replace 'long_running_job' with the name of the job you're monitoring.","alertname_comment":"Note: Replace (My_long_running_job) with the name of the job you're alerting on.","targetentitytype":0}