DX Unified Infrastructure Management

  • 1.  Correct query for device without alarms

    Posted Dec 27, 2017 12:20 PM

    Hi everyone,

     

    Im doing a dashboard for a client and put a widget in order to show the alarms that a device have in the moment (pie widget).

    The query associate to this pie its the next:

     

    select severity, count(severity) from nas_alarms where source='10.0.10.250'
    group by severity

     

    If the device have any alarms the widget whow the correct information but if the device have not any alarms the widget show garbage. This because the result of the query its NULL.

     

     

    Can any one please tell me what its the correct query in order to show '0' alarms and made the widget show correct values when the device have not any alarms and if have some they were showed too.

     

    I hope you can help me.

     

    Regards

     

    Jose



  • 2.  Re: Correct query for device without alarms

    Broadcom Employee
    Posted Dec 28, 2017 08:31 AM

    try something like

    select severity,
           IsNull((
                Select Count(Severity) as alarmcount
                from  NAS_ALARMS as  NA
                where (source='***.***.***.***' and severity = NAS_ALARMS.severity)
                group by severity),0) as AC

     

    from NAS_ALARMS
    where source='***.***.***.***'



  • 3.  Re: Correct query for device without alarms

    Posted Dec 28, 2017 11:52 AM

    Hi Gene;

     

    I put the query you send me, but its the same result.

    The query send me this result.

     

     

    And the widget its showed in this way.

     

     

    Regards

     

    Jose



  • 4.  Re: Correct query for device without alarms
    Best Answer

    Broadcom Employee
    Posted Dec 28, 2017 02:12 PM

    Sorry did some more testing try this one

     

    select
         severity,Count(nimid) as alarmcount
    from NAS_ALARMS
    where source='***.***.***.***'
    group by severity
    union all --edit, of course it's quicker
    select
        'No Alarms','1'
    where NOT EXISTS (SELECT * FROM NAS_ALARMS  where source='***.***.***.***')



  • 5.  Re: Correct query for device without alarms

    Posted Dec 28, 2017 05:03 PM

    Hi Gene,

     

    Thanks for the help. The new query its working.

     

    Regards

     

    Jose