Compare commits
No commits in common. "a5a556a258690d09c6d458dc3024ade31e6222ae" and "2c4ec92ad5d21201d410c6672a9542da7364405d" have entirely different histories.
a5a556a258
...
2c4ec92ad5
File diff suppressed because it is too large
Load Diff
@ -1,40 +0,0 @@
|
|||||||
SELECT
|
|
||||||
Active.id AS ID,
|
|
||||||
Active.eventtime AS `StartTimestamp`,
|
|
||||||
Clear.eventtime AS `EndTimestamp`,
|
|
||||||
CONCAT(
|
|
||||||
LPAD(FLOOR(duration_seconds / 3600), 2, '0'), ':',
|
|
||||||
LPAD(FLOOR((duration_seconds % 3600) / 60), 2, '0'), ':',
|
|
||||||
LPAD(duration_seconds % 60, 2, '0')
|
|
||||||
) AS Duration,
|
|
||||||
CONCAT(
|
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(Active.source, '/HMI/ALARMST', 1), ':/tag:', -1), '/', -1),
|
|
||||||
' - ',
|
|
||||||
SUBSTRING_INDEX(Active.source, ':/alm:', -1)
|
|
||||||
) AS Description,
|
|
||||||
CASE Active.priority
|
|
||||||
WHEN 0 THEN 'Diagnostic'
|
|
||||||
WHEN 1 THEN 'Low'
|
|
||||||
WHEN 2 THEN 'Medium'
|
|
||||||
WHEN 3 THEN 'High'
|
|
||||||
WHEN 4 THEN 'Critical'
|
|
||||||
ELSE 'Unknown'
|
|
||||||
END AS Priority,
|
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(Active.source, '/HMI/ALARMST', 1), ':/tag:', -1), '/', -1) AS Tag,
|
|
||||||
SUBSTRING_INDEX(SUBSTRING_INDEX(Active.source, '/tag:', -1), '/', 1) AS MCM
|
|
||||||
FROM (
|
|
||||||
SELECT
|
|
||||||
ae.id,
|
|
||||||
ae.eventtime,
|
|
||||||
ae.eventid,
|
|
||||||
ae.source,
|
|
||||||
ae.priority,
|
|
||||||
TIMESTAMPDIFF(SECOND, ae.eventtime, COALESCE(ae_clear.eventtime, NOW())) AS duration_seconds
|
|
||||||
FROM alarm_events ae
|
|
||||||
LEFT JOIN alarm_events ae_clear
|
|
||||||
ON ae.eventid = ae_clear.eventid AND ae_clear.eventtype = 1
|
|
||||||
WHERE ae.eventtype = 0
|
|
||||||
) AS Active
|
|
||||||
LEFT JOIN alarm_events Clear
|
|
||||||
ON Active.eventid = Clear.eventid AND Clear.eventtype = 1
|
|
||||||
ORDER BY Active.eventtime DESC;
|
|
||||||
Loading…
x
Reference in New Issue
Block a user