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.

Top Errors and Discards This Hour (SWQL)

There is a need to customize the Top 10 Errors and Discards this Hour widget into a custom one.  It gave me more control over the filtering and placement of additional fields.

This is the out-of-the box:

pastedImage_0.png

The customized:

pastedImage_1.png

select top 10

SUBSTRING(n.caption,1,case when charindex('.',n.caption,1) <=4  then length(n.caption) else (charindex('.',n.caption,1)-1) end) AS [Node]

,n.DetailsUrl AS [_LinkFor_Node]

,'/Orion/images/StatusIcons/Small-' + n.StatusIcon AS [_IconFor_Node]

,i.caption as [Interface]

,i.DetailsUrl as [_LinkFor_Interface]

,'/Orion/images/StatusIcons/Small-' + i.StatusIcon AS [_IconFor_Interface]

,sum(i.Errors.InErrors) as [RxErr]

,case when sum(i.Errors.InErrors) > 0 then '/Orion/images/StatusIcons/Small-Critical.gif' end as [_iconfor_RxErr]

,concat('/Orion/Charts/CustomChart.aspx?ChartName=InterfaceErrors&NetObject=I:',i.InterfaceID,'&Period=PastHour&SampleSize=15') as [_LinkFor_RxErr]

,sum(i.errors.InDiscards) as [RxDis]

,case when sum(i.Errors.InDiscards) > 0 then '/Orion/images/StatusIcons/Small-Critical.gif' end as [_iconfor_RxDis]

,concat('/Orion/Charts/CustomChart.aspx?ChartName=InterfaceDiscards&NetObject=I:',i.InterfaceID,'&Period=PastHour&SampleSize=15') as [_LinkFor_RxDis]

,sum(i.errors.OutErrors) as [TxErr]

,case when sum(i.Errors.OutErrors) > 0 then '/Orion/images/StatusIcons/Small-Critical.gif' end as [_iconfor_TxErr]

,concat('/Orion/Charts/CustomChart.aspx?ChartName=InterfaceErrors&NetObject=I:',i.InterfaceID,'&Period=PastHour&SampleSize=15') as [_LinkFor_TxErr]

,sum(i.errors.OutDiscards) as [TxDis]

,case when sum(i.Errors.OutDiscards) > 0 then '/Orion/images/StatusIcons/Small-Critical.gif' end as [_iconfor_TxDis]

,concat('/Orion/Charts/CustomChart.aspx?ChartName=InterfaceDiscards&NetObject=I:',i.InterfaceID,'&Period=PastHour&SampleSize=15') as [_LinkFor_TxDis]

from Orion.Nodes n

join Orion.NPM.Interfaces i on n.nodeid=i.NodeID

where i.errors.DateTime >= ADDDATE('hour',0,ADDdate('hour',hourDIFF(0,getdate()),0))

group by n.caption, n.DetailsUrl, n.StatusIcon, i.Caption, i.DetailsUrl, i.StatusIcon, i.InterfaceID

having (sum(i.Errors.InErrors)+sum(i.errors.InDiscards)+sum(i.errors.OutErrors)+sum(i.errors.OutDiscards))>0

order by sum(i.Errors.InErrors)+sum(i.errors.InDiscards)+sum(i.errors.OutErrors)+sum(i.errors.OutDiscards) desc

THank you,

Amit