Here is what i use to alert on routing issues (BGP/IPv4 or OSPF)
which equates to:
WHERE
(
(NPM_RoutingNeighbor_V.OrionStatus = 2) AND
(NPM_RoutingNeighbor_V.IsDeleted = 0) AND
(NPM_RoutingNeighbor_V.DisplayName <> 'Idle')
)
Note: the columns in the routing neighbor polling are oddly named, and mismatched between the UI and the SQL code that is generated
[whoever implemented this needed a pair-programmer to tell them this is being silly]
OrionStatus = the actual status of the peering
isMissing/isDeleted == peering has been administratively shutdown
idle == the idle BGP state, which is not active, connect, or established (e.g. a passive BGP peering, where the other side has to bring up the peering session)
/RjL