Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore SQL Agent Jobs by name/category #1175

Open
satoshidba opened this issue Jan 17, 2025 · 2 comments
Open

Ignore SQL Agent Jobs by name/category #1175

satoshidba opened this issue Jan 17, 2025 · 2 comments

Comments

@satoshidba
Copy link

Hi @DavidWiseman

Would it be possible to have the ability to ignore certain SQL Agent jobs based on some criteria such as job name or category for example with a customisable wildcard query on the name?

Just thinking along the lines of some agent jobs that we have where there is some development ongoing and regular failures are expected, don't want to disable the job but also don't want it to flag up.

Thanks

@DavidWiseman
Copy link
Collaborator

Thanks for the suggestion. You can disable the thresholds for individual jobs. It would be possible to automate it via a script as a workaround. Something like this:

INSERT INTO dbo.AgentJobThresholds(InstanceID,job_id,LastFailIsCritical,LastFailIsWarning)
SELECT J.InstanceID,J.job_id,0,0
FROM Jobs J
WHERE J.category='Your_Category_To_Exclude' -- Or: J.name LIKE '%Your_Name_To_Exclude%'
AND NOT EXISTS(SELECT 1 
			FROM dbo.AgentJobThresholds T 
			WHERE T.InstanceId = J.InstanceID
			AND T.job_id = J.job_id
			)

@satoshidba
Copy link
Author

Thanks for the reply, that seems like a simple enough way around it for what would probably be a niche request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants