cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 10

Custom query widget that only references the current object

Jump to solution

Trying to create a custom query widget in Node Details, Interface details, etc. in which the query results only reflect that specific object. For example, in the following query, when I bring up Node Details for Host A, the widget should show only Host A interfaces automatically. When I bring up Host B node details, only those interfaces would be shown.

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

Labels (2)
0 Kudos
1 Solution

You need to include in the WHERE Statement something similar to:

WHERE n.NodeID = ${NodeID}
- David Smith

View solution in original post

2 Replies

You need to include in the WHERE Statement something similar to:

WHERE n.NodeID = ${NodeID}
- David Smith

View solution in original post

Thank you so much, David!

0 Kudos