Search code examples
sql-serversql-agent-job

receive an alert when job is *not* running


I know how to set up a job to alert when it's running.
But I'm writing a job which is meant to run many times a day, and I don't want to be bombarded by emails, but rather I'd like a solution where I get an alert when the job hasn't been executed for X minutes.

This can be acheived by setting the job to alert on execution, and then setting up some process which checks for these alerts, and warns when no such alert is seen for X minutes.

I'm wondering if anyone's already implemented such a thing (or equivalent).
Supporting multiple jobs with different X values would be great.


Solution

  • The danger of this approach is this: suppose you set this up. One day you receive no emails. What does this mean?

    It could mean

    • the supposed-to-be-running job is running successfully (and silently), and so the absence-of-running monitor job has nothing to say

    or alternatively

    • the supposed-to-be-running job is NOT running successfully, but the absence-of-running monitor job has ALSO failed

    or even

    • your server has caught fire, and can't send any emails even if it wants to

    Don't seek to avoid receiving success messages - instead devise a strategy for coping with them. Because the only way to know that a job is running successfully is getting a message which says precisely this.