I have a requirement to create an alert if 5 or more members of a group (excluding a couple of sub-groups) are down for more than 4 hours. Initially I tried using the GUI (see image), but when it outputs the alert to the event table it includes the event text for every affected node. This breaks our integration with our servicedesk application which only expects a single set of alert text so I've been working on a SWQL alternative.
While I can pull out the list of devices that are down (I've not included the 4h timespan yet) I haven't worked out how I set the trigger up to fire if the SWQL returns more than 5 or more rows. So how do I do that?
SELECT n.NodeID, n.Caption, n.Status, n.StatusDescription, n.LastSystemUpTimePollUtc, ncp.AlertingRuleSet, a.ID, c.ContainerID, c.Name FROM Orion.Nodes n INNER JOIN Orion.NodesCustomProperties ncp ON n.NodeID =ncp.NodeID LEFT JOIN Orion.AlertSuppression a ON n.uri = a.entityuri INNER JOIN Orion.ContainerMembers cm ON cm.MemberPrimaryID = n.NodeID INNER JOIN Orion.Container c ON c.ContainerID = cm.ContainerID WHERE ncp.AlertingRuleSet = 'Prod' AND c.Name = 'Production' and c.Name NOT IN ('Dev','Test') AND a.ID IS NULL ORDER BY n.Caption