Let's take a closer look at narrowing down the scope of a rule. The use case I normally hear is, we have some important jobs, databases, etc. that we want alarms for, but we don't want alarms for the other non-important ones.

Exclusion lists can be created on a per-instance basis which can help in small-scale scenarios. But we then have to remember to update the list every time a job, database, etc. is added. That can be prone to error.

In this post, rules were configured to only fire alarms upon the instances contained within a Database Group. 

In this post, rules were configured to only fire alarms upon the instances contained within a Service definition.

When using the Service Builder to define a service, you are picking objects to add by using UI Queries. There are pre-built queries that return objects such as SQL instances, Azure SQL Databases, etc.

In this post, UI Queries are introduced and a sample query is built to return SQL Server Agent Jobs - a list of all jobs that are monitored. We can put the pieces together now, and create a service to return the "important jobs", and then update the "DBSS - Job Failure" rule to only alert on those jobs. It will be dynamic too, so any new job matching our pattern will be included in the scope of the rule.

In this example, we create a dynamic service to return Jobs that start with "LiteSpeed" - N.B., it is case-sensitive. You can create additional rules to account for case sensitivity, to add other patterns, etc.

Testing the query, we confirm a listing of matching jobs:

We can also review the service definition in the Service Builder dashboard:

Now that the service is defined we just need to update the rule scope to just the jobs within the service.

Edit the the appropriate rule (eg. DBSS - Jobs Failed) to include the following scope:

DBSS_Agent_Job_List where $object within^2 (FSMService where name = 'My Important Jobs')

Verify the scope and then save the rule. That's it! All of the agent jobs will continue to be monitored, but the job failure rule will only fire on those within the specified service.

Anonymous
Related Content