Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

"Mangers" hardware port count

$
0
0

I have been asked by my manager to provide a port count of what is on our network. So I asked the question, What would you like to see? I want to know the number of switches and what interfaces they each have. Then I ask, What would like to see? A grand Total for each switch, the number of switchports per switch? The answer is a collective yes. So, I worked with a few MVP's and this is what I was able to come up with. If anyone out there has a manager that asks for something like this, please comment below. If anyone may have a suggestion to better the script, please comment below. This is for a custom table report within Orion. I used SWQL ( Solarwinds Studio) to build the report. I had to get specific for what my manager asked for.  Let me know your thoughts?

 

SELECT 2 as aa, [N].NodeCaption as [Device Name],

COUNT(CASE WHEN [P].InterfaceName like 'mgmt%'

THEN 1 ELSE NULL END)

AS [MGT],

COUNT(CASE WHEN [P].InterfaceName like 'Fa%'

THEN 1 ELSE NULL END)

AS [Fa],

COUNT(CASE WHEN [P].InterfaceName like 'Gi%'

THEN 1 ELSE NULL END)

AS [1 Gig],

COUNT(CASE WHEN [P].InterfaceName like 'Te%'

THEN 1 ELSE NULL END)

AS [10 Gig],

COUNT(CASE WHEN [P].InterfaceName like 'Eth%' and [N].Vendor = 'Cisco'

THEN 1 ELSE NULL END)

AS [E10 Gig],

COUNT(CASE WHEN [P].InterfaceHighSpeed = '40000' and [N].Vendor = 'Cisco'

THEN 1 ELSE NULL END)

AS [Fo Gig],

COUNT(CASE WHEN [P].InterfaceHighSpeed = '25000'

THEN 1 ELSE NULL END)

AS [25g],

COUNT(CASE WHEN [P].InterfaceHighSpeed = '100000'

THEN 1 ELSE NULL END)

AS [100g]

 

 

FROM NCM.Interfaces AS [P]

INNER JOIN NCM.Nodes AS [N]

   ON [P].NodeID = [N].NodeID

 

 

WHERE InterfaceDescription Not LIKE '%-Controlled'

and InterfaceDescription not like '%-Uncontrolled'

and InterfaceDescription not like '%Vlan%'

and InterfaceDescription not like '%Stack%'

and InterfaceDescription not like '%Loop%'

and InterfaceDescription not like '%port-channel%'

and InterfaceDescription not like '%Tunnel%'

and InterfaceDescription not like '%Adaptive%'

and InterfaceDescription not like '%SPAN%'

and InterfaceDescription not like '%Null%'

and InterfaceDescription not like '%EOB%'

GROUP BY [N].NodeCaption

 

 

UNION

(SELECT 1 as aa, 'GRAND TOTAL' AS [Device Name],

SUM(CASE WHEN [P].InterfaceName like 'mgmt%'

THEN 1 ELSE NULL END)

AS [MGT],

SUM(CASE WHEN [P].InterfaceName like 'Fa%'

THEN 1 ELSE NULL END)

AS [Fa],

SUM(CASE WHEN [P].InterfaceName like 'Gi%'

THEN 1 ELSE NULL END)

AS [1 Gig],

SUM(CASE WHEN [P].InterfaceName like 'Te%'

THEN 1 ELSE NULL END)

AS [10 Gig],

SUM(CASE WHEN [P].InterfaceName like 'Eth%' and [N].Vendor = 'Cisco'

THEN 1 ELSE NULL END)

AS [E10 Gig],

SUM(CASE WHEN [P].InterfaceHighSpeed = '40000' and [N].Vendor = 'Cisco'

THEN 1 ELSE NULL END)

AS [Fo Gig],

SUM(CASE WHEN [P].InterfaceHighSpeed = '25000'

THEN 1 ELSE NULL END)

AS [25g],

SUM(CASE WHEN [P].InterfaceHighSpeed = '100000'

THEN 1 ELSE NULL END)

AS [100g]

 

 

FROM NCM.Interfaces AS [P]

INNER JOIN NCM.Nodes AS [N]

   ON [P].NodeID = [N].NodeID

 

 

WHERE InterfaceDescription Not LIKE '%-Controlled'

and InterfaceDescription not like '%-Uncontrolled'

and InterfaceDescription not like '%Vlan%'

and InterfaceDescription not like '%Stack%'

and InterfaceDescription not like '%Loop%'

and InterfaceDescription not like '%port-channel%'

and InterfaceDescription not like '%Tunnel%'

and InterfaceDescription not like '%Adaptive%'

and InterfaceDescription not like '%SPAN%'

and InterfaceDescription not like '%Null%'

and InterfaceDescription not like '%EOB%')


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>