I have a need to count unack alarms in different alert classes.
I can't seem to get the right syntax for this:
SELECT ALERT '_alert_hdl.._ackable', '_alert_hdl.._class' FROM '*' WHERE '_alert_hdl.._ackable' == 1 AND '_alert_hdl.._class' LIKE \"alert\"
without the WHERE clause, I can see the _class as System1:alert. so I would think that a string LIKE should work. But the query editor throws a syntax error.
Can anyone help me with this or another solution to get counts of unack alarms by class?
Todd Malone
counting unack alarms
- kilianvp
- Posts:443
- Joined: Fri Jan 16, 2015 10:29 am
Re: counting unack alarms
filter the dyn_dyn_anytype
- tmalone
- Posts:192
- Joined: Mon Nov 22, 2010 11:21 pm
Re: counting unack alarms
"filter". I'm sorry but I don't understand the comment.
- gschijndel
- Posts:376
- Joined: Tue Jan 15, 2019 3:12 pm
Re: counting unack alarms
Using the LIKE comparison without wildcard(s) does not make much sense. So add a wildcard for example:
Without wildcard(s) also the equal operator could be used like this:
An alternative would be to use sumalerts with filtering on the priority and/or short sign to only include alerts from a specific class. The count can then be determined with for example the '_summed_alerts_count' attribute. Not sure if the sumalert can be limited to unacknowledged alerts, but with the '_summed_states' attribute it can be determined which of the current summed alerts are unacknowledged.
Code: Select all
'_alert_hdl.._class' LIKE \"*:alert.\"Code: Select all
'_alert_hdl.._class' == \"" + getSystemName() + "alert.\""- tmalone
- Posts:192
- Joined: Mon Nov 22, 2010 11:21 pm
Re: counting unack alarms
Thank you. I did not understand exactly how LIKE worked. I thought it was more like strpos().
Your examples are great.
Your examples are great.
- kilianvp
- Posts:443
- Joined: Fri Jan 16, 2015 10:29 am
Re: counting unack alarms
I meant you do it without the like and pick the classes you want from the result and count them.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: counting unack alarms
The attribute _alert_hdl.._class is a dp identifier.
When referencing dp identifier you always have to keep in mind the rules for addressing DP elements, e.g. a "." in the end when addressing the root node.
How often will the function be called to count the unacknowledged alerts?
In huge projects it can take some time to get the unacknowledged alerts if the are a lot of alerts pending. While the Event Manager is processing the query no other task can be executed.
Best Regards
Leopold Knipp
Senior Support Specialist
When referencing dp identifier you always have to keep in mind the rules for addressing DP elements, e.g. a "." in the end when addressing the root node.
How often will the function be called to count the unacknowledged alerts?
In huge projects it can take some time to get the unacknowledged alerts if the are a lot of alerts pending. While the Event Manager is processing the query no other task can be executed.
Best Regards
Leopold Knipp
Senior Support Specialist