We often get requests to only fire certain alarms (eg. hours since last log backup) on a specific set of instances (or other objects, like jobs, databases, etc.). One way to do that is to leverage the Database Groupings and use those to limit the alarms.

Here is a group named "Aventador" and I've placed a single instance within it. 

If we have additional instances that we want to limit the alarm to, simply add them to this group.

From the Rule Editor, we'll make the change to limit the alarm to fire only on those instances within that group.

Looking at the rule before making any changes, we see that it's scoped to "DBSS_Database". This will fire the rule on any database that is monitored by Foglight. Clicking the green check verifies the scope, and the databases are listed in the result window.

To limit the rule to only databases that belong to the instances in our Database group, we'll add this "where" clause to the scope:

where ($object within (DBWC_GV_GroupIdentifier WHERE groupName = 'Aventador'))

Clicking the green check again, we see it validated, but did not get any objects. We need to tell it how deep to search within that group. 

We can add "^n" to the "within" clause. I'll start at n=3, then work backwards to find objects. In this case, n=3 was the right choice.

Once this rule gets saved, it will only generate alarms for the instances that are within the "Aventador" group. You can expand the scoping "where clause" too with keywords like NOT, OR, etc. Here are some examples:

This will find instances in either the "IaaS" group or the "DBaaS" group and fire the alarm.

where ($object within^3 (DBWC_GV_GroupIdentifier WHERE groupName = 'IaaS'))
OR
($object within^3 (DBWC_GV_GroupIdentifier WHERE groupName = 'DBaaS'))

This will fire the rule on instances that ARE NOT in the "IaaS" Database group. 

where $object NOT within^3 (DBWC_GV_GroupIdentifier WHERE groupName = 'IaaS')

In a future post, I will show how to alert only on specific databases, jobs, etc. using the Service Builder and the same approach with rule scoping shown above.

Anonymous
Related Content