Perspective Alarming work around

With the lack of Alarm components in perspective I was wondering what others have used for showing alarm status/events.

Until we are able to add Alarm Components, the only way I can think of to do this would be to enable Alarm Journaling and use a query to populate a table component. While this wouldn’t allow you to act on alarms, it would allow you to see the information.

To answer the obvious follow up question of when Alarming components will be added. They are high on the list of components to be added, but there are a few larger items that need to be finished that are a higher priority and a timeframe for when these will appear isn’t clear yet.


1 Like

Thought I’d best tack onto this post rather than start my own, as the title is exactly what I’d be creating already :slight_smile:

I’m just trying to build a very simple alarm banner - literally just a list of currently active alarms, with the times they were activated. I don’t need to know if/when they were acknowledged/cleared/etc - I just need a very quick heads up of what’s currently wrong.

I’ve built a named query that can return exactly that from the alarm_events database:

select eventtime, displaypath from alarm_events AE
where eventtime = (select max(eventtime) from alarm_events TS where AE.source = TS.source)
and eventtype != 1
and source not like 'evt:%'
order by AE.priority, eventtime desc

Basically, I’m leveraging the fact that the source column is unique for all individual alarms, then picking only the most recent event for each source where the eventtype is anything other than 1 (cleared), filtering out system events, and then ordering by priority and then most recent.

Seems to work OK, but having had a quick look at the online demo perspective apps, they seem to have some more advanced alarm functionality in them. Is this functionality achieved by just using a similar (more complex) approach to my example above, or are there some better ways of displaying alarms now that I haven’t discovered yet? Again, I can live without all the niceties of acknowledged/cleared/active statuses, tracking of who did what, and so on - I just want to be able to display currently active alarms that require intervention to clear.

1 Like

You can look for cleared alarms in a subquery and filter those out if that’s what you’re trying to do. You can go a little crazy with it but your limitation as far as I’ve seen is the source field.

So far, the methodology that has worked best for me is to derive my alarms from UDTs that consistently put specific things in the types of alarms which I then use as groups. Then my query can grab specific types of alarms (ex. compliance alarms). The queries can get pretty complicated because the data is structured to be displayed by a client side alarm logger but it can be done with subqueries. Alternatively, you can process the data client side and read it in like an alarm logger.

Also, it can get a little tricky querying the data from the partition tables. I’ve been doing that with dynamic SQL but there might be a better way to do that. A better solution hasn’t dawned on me yet.

1 Like

This is what I use for PostgreSQL in a named query. You need the crosstab extension installed and probably need TIMESTAMP instead of TIMESTAMPTZ. Change {FILTER}, {TS1} and {TS2} to suit your needs.

	eventid AS "Event ID",
	displaypath AS "Display Path",
	substring(source, ':/tag:(.*):/alm.*') AS "Tag Name",
	substring(source, ':/alm:(.*)') AS "Alarm Name",
	time_active AS "Active Time",
	time_clear AS "Clear Time",
	time_clear - time_active AS "Duration"
FROM crosstab(
			displaypath LIKE '%{FILTER}%' AND 
			eventtype IN (0,1) AND 
			displaypath NOT LIKE '%evt:%' AND
			eventtime >= TIMESTAMPTZ '{TS1}' AND
			eventtime <  TIMESTAMPTZ '{TS2}'
		VALUES (0::integer), (1::integer)
) AS eventtable (
	eventid TEXT,
	source TEXT,
	displaypath TEXT,
	time_active TIMESTAMPTZ,
	time_clear TIMESTAMPTZ
	time_active IS NOT NULL
	time_active DESC