counting unack alarms

Find and share HowTos to various installations / configurations!
7 posts • Page 1 of 1
tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

counting unack alarms

Post by tmalone »

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

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: counting unack alarms

Post by kilianvp »

filter the dyn_dyn_anytype

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: counting unack alarms

Post by tmalone »

"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

Post by gschijndel »

Using the LIKE comparison without wildcard(s) does not make much sense. So add a wildcard for example:

Code: Select all

'_alert_hdl.._class' LIKE \"*:alert.\"
Without wildcard(s) also the equal operator could be used like this:

Code: Select all

'_alert_hdl.._class' == \"" + getSystemName() + "alert.\""
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.

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: counting unack alarms

Post by tmalone »

Thank you. I did not understand exactly how LIKE worked. I thought it was more like strpos().

Your examples are great.

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: counting unack alarms

Post by kilianvp »

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

Post by leoknipp »

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

7 posts • Page 1 of 1