Dynamic Queries with an IP Range & Variable Octets for Alerting

Hello, I am attempting to create an alert that would alert me when a BGP Neighbor goes down on one of my devices. The problem is I manage a very large and complex network that does have many stale BGP sessions that have not been cleaned up yet. What I am trying to do is make a Dynamic Query that would only monitor a selection of IP ranges, using the second Octet as the variable. 

For example, I want to alert on an IP range like this:


So you can see I am only concerned about the second octet being the variable. 

I am not familiar with Dynamic Queries and can't seem to even find where to create one, so any guidance would be much appreciated. 

For further information, my ultimate goal is to have an Alert that looks at only these ranges and ONLY if the BGP Routing Neighbor is Deleted or NOT EQUAL TO "Established". 

Thank you very much.