<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Query on Alarm Age]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I am trying to write SQL that will collect how much time each alarm (that got triggered) took to get resolved ( time difference between time of when it got triggered and time of when it got resolved)</p>
<p dir="auto">Basically I am trying to get table like this</p>
<p dir="auto">Alarm_id |	Alarm_message | Time it got Triggered |Time it got Resolved	Age ( difference between two times) |<br />
    <br />
Can you please help me with SQL ?</p>
<p dir="auto">I did spent time looking at Alarm and Alarm_events tables, but I could not frame correct query</p>
]]></description><link>https://forum.netxms.org/topic/5132/query-on-alarm-age</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 16:08:05 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5132.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Jul 2017 18:53:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Query on Alarm Age on Wed, 12 Jul 2017 18:17:47 GMT]]></title><description><![CDATA[<p dir="auto">I think this is what you are looking for. If not, it should get you started. I did not find a " time resolved" field, only the last time the alarm was changed. Which I am assuming, if it was resolved or terminated, that would be the last time it was changed. I added in the source object name, as I thought that would be useful.</p>
<pre><code>select object_properties.name as 'Node Name', alarms.alarm_id as 'Alarm ID', alarms.message as 'Message', DATEADD(S,alarms.creation_time, '1970-01-01') as 'Date Created',DATEADD(S,alarms.last_change_time, '1970-01-01') as 'Date Last Changed',
CONVERT(varchar, (alarms.last_change_time-alarms.creation_time) / 86400) + ':' + CONVERT(varchar, DATEADD(s, (alarms.last_change_time-alarms.creation_time), 0), 108) as 'Age DD:HH:MM:SS'
from alarms
inner join object_properties on object_properties.object_id=alarms.source_object_id
where alarms.alarm_state &gt; 1
order by alarms.last_change_time desc
</code></pre>
]]></description><link>https://forum.netxms.org/post/22658</link><guid isPermaLink="true">https://forum.netxms.org/post/22658</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Wed, 12 Jul 2017 18:17:47 GMT</pubDate></item></channel></rss>