SQL Monitor’s Job duration unusual alert is a powerful tool for keeping track of most jobs in your SQL Server environment. It works by comparing the running time of any job instance against the median for that job, and identifying when a variation in the job duration could hint at a performance problem. However, if your environment contains big jobs whose durations vary by several orders of magnitudes, it can be tricky to specify what kind of variation is expected and what would be unusual. For these cases, it is possible to go beyond the functionality of the built-in alert with a custom metric.
This metric returns the longest running instance of the named job in the last hour. In the example, the job of interest is called ‘My_long_running_job’, so you’ll need to replace this with the job in your environment that you want to target.
By creating multiple custom metrics from this example – one for each job you’re interested in – you can specify alert thresholds for each job individually. Alert thresholds are absolute rather than relative values, which may help cover a few scenarios that the built-in alert is not suited for.Long-running job,