We have one central gateway, and multiple remote gateways on each site for machine connectivity.
On the central gateway, we are building screens to view data from the entire enterprise. On the central gateway, the goal is: ‘Show active alarms from all sites’.
This seems like a question that should be straight forward, but it seems like it’s not so easy. Alarm status table only gives alarms from the current gateway, and Alarm Journal only shows alarm events, so quite hard to find currently active ones.
Relatable issue shows that it’s not so easy to do as I would think.
Anyone experience with this? How would you solve this?
Edit * I know I can query it like this:
WITH sorted AS (
SELECT ae.*, ROW_NUMBER() OVER (PARTITION BY ae.source ORDER BY id DESC) AS rn
FROM alarm_events AS ae
)
SELECT * FROM sorted WHERE rn = 1;
But I don’t like to query my entire database every few seconds…
Edit** Second question I have if database querries are the way to go:
Where do you store the result for screens to access the info? In a tag? In a named query cache?
Edit *** And how would you perform action like shelving or acknowledging? Custom write on the table?