Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Query on Alarm Age

Query on Alarm Age

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 4.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N
    N
    Nagav
    wrote on last edited by
    #1

    Hi

    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)

    Basically I am trying to get table like this

    Alarm_id | Alarm_message | Time it got Triggered |Time it got Resolved Age ( difference between two times) |
        
    Can you please help me with SQL ?

    I did spent time looking at Alarm and Alarm_events tables, but I could not frame correct query

    1 Reply Last reply
    0
    • G
      G
      gdodd
      wrote on last edited by
      #2

      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.

      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 > 1
      order by alarms.last_change_time desc
      
      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups