This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Add Acknowledge status to this critical alerts widget

I used this swql code from here to create a widget that showed only critical alerts.  I'd like to add Acknowledged "YES" or "NO" and by whom to the query.  

I'm not a swql or sql guru buty any strech of the imagination.  

Its a six year old post so I'm hoping I can start a new thread around this requirement

Parents
  • , is this query the output you're looking for?

    SELECT
    o.AlertConfigurations.Name AS [ALERT NAME]
    ,'/Orion/NetPerfMon/ActiveAlertDetails.aspx?NetObject=AAT:' + ToString(o.AlertObjectID) AS [_LinkFor_ALERT NAME]
    ,o.EntityCaption AS [ALERT OBJECT]
    ,o.EntityDetailsURL AS [_LinkFor_ALERT OBJECT]
    ,o.RelatedNodeCaption AS [RELATED NODE]
    ,o.RelatedNodeDetailsURL AS [_LinkFor_RELATED NODE]
    ,ToLocal(o.AlertActive.TriggeredDateTime) AS [ALERT TRIGGER TIME]
    ,o.AlertActive.TriggeredMessage AS [ALERT MESSAGE]
    ,CASE
    WHEN o.AlertConfigurations.Severity = 1 then 'Critical'
    WHEN o.AlertConfigurations.Severity = 2 then 'Serious'
    WHEN o.AlertConfigurations.Severity = 3 then 'Warning'
    WHEN o.AlertConfigurations.Severity = 4 then 'Informational'
    WHEN o.AlertConfigurations.Severity = 5 then 'Notice'
    END AS [Severity]
    , o.AlertActive.Acknowledged
    , o.AlertActive.AcknowledgedBy
    , o.AlertActive.AcknowledgedDateTime
    , o.AlertActive.AcknowledgedNote
    FROM Orion.AlertObjects o
    WHERE o.AlertActive.TriggeredMessage <> ''
    AND o.AlertConfigurations.Severity = 1
    ORDER by o.AlertActive.TriggeredDateTime DESC

  • How difficult would it be to have only unacknowledged alerts?  

  • , not difficult just add the following as part of the where condition

    o.AlertActive.Acknowledged IS NOT NULL
    
    -- Example
    WHERE o.AlertActive.TriggeredMessage <> ''
    AND o.AlertConfigurations.Severity = 1
    AND o.AlertActive.Acknowledged IS NOT NULL

  • , I was testing this and noticed that between what I was expecting and what the output did not match up. Somewhere between when the query was first written and now the Severity numbers changed below is a version that is correct, I am on the latest versions for all modules

    SELECT
    o.AlertConfigurations.Name AS [ALERT NAME]
    ,'/Orion/NetPerfMon/ActiveAlertDetails.aspx?NetObject=AAT:' + ToString(o.AlertObjectID) AS [_LinkFor_ALERT NAME]
    ,o.EntityCaption AS [ALERT OBJECT]
    ,o.EntityDetailsURL AS [_LinkFor_ALERT OBJECT]
    ,o.RelatedNodeCaption AS [RELATED NODE]
    ,o.RelatedNodeDetailsURL AS [_LinkFor_RELATED NODE]
    ,ToLocal(o.AlertActive.TriggeredDateTime) AS [ALERT TRIGGER TIME]
    ,o.AlertActive.TriggeredMessage AS [ALERT MESSAGE]
    ,CASE
    WHEN o.AlertConfigurations.Severity = 0 then 'Informational'
    WHEN o.AlertConfigurations.Severity = 1 then 'Warning'
    WHEN o.AlertConfigurations.Severity = 2 then 'Critical'
    WHEN o.AlertConfigurations.Severity = 3 then 'Serious'
    WHEN o.AlertConfigurations.Severity = 4 then 'Notice'
    END AS [Severity]
    , o.AlertActive.Acknowledged
    , o.AlertActive.AcknowledgedBy
    , o.AlertActive.AcknowledgedDateTime
    , o.AlertActive.AcknowledgedNote
    FROM Orion.AlertObjects o
    WHERE o.AlertActive.TriggeredMessage <> ''
    AND o.AlertConfigurations.Severity = 2
    --Uncomment below for only alerts that have been acknowledged
    --AND o.AlertActive.Acknowledged IS NOT NULL
    ORDER by o.AlertActive.TriggeredDateTime DESC

Reply Children
No Data