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.

Report on ports used and unused

I’ve been asked for a report on how many ports we have on our network and how many are used. Without going to each device and running a sh int status command I’m wondering if there are any forms anyone might have for NPM

Parents
  • Do you have NCM? I can see that if you do an SWQL query using NCM.Nodes and NCM.Interfaces you could pull a report by device name with a count on admin status Up/down/total per device.

  • How does that scale to 1000 switches?   Or can you query all at once and see the output in one report?

  • This is something I pulled together real quick using SWQL to display "Device Name, Device IP, then "interface" by Admin Up/Down and Oper Status Up/Down along with Total available. I added a where statement to only return "physical interfaces" because I believe that's what the original intent was of the question on this string. So a device like a Cisco Catalyst 3560 w/ 48 ports would show as 52 interfaces (48 ports + 4 SFP). For scaling the way it's written right now it will return every device in NCM.Nodes. In some enviornments that could mean more than network devices.

    rschroeder​ this returned 1523 rows for me so scale wise it shouldn't be an issue. As long as all the devices you're looking for information on are managed/in NCM. To clarify this is NCM not NPM and it will return all ports/interfaces on the device even those not discovered by NPM/NCM. In my environment we only discover trunk ports and/or "important" ports so using NPM wouldn't return the same results as it would only be able to return discovered ports/interfaces.

    SELECT

      NodeCaption AS [Device Name],

      AgentIP AS [Device IP],

           COUNT(

                CASE WHEN n.Interfaces.AdminStatus = 'Up'

                THEN 1 ELSE NULL END

                )

                     AS [Admin Up],

           COUNT(

                CASE WHEN n.Interfaces.OperStatus = 'UP'

                THEN 1 ELSE NULL END

                )

                     AS [Oper Up],

           COUNT(

                CASE WHEN n.Interfaces.AdminStatus = 'Down'

                THEN 1 ELSE NULL END

                )

                     AS [Admin Down],

           COUNT(

                CASE WHEN n.Interfaces.OperStatus = 'Down'

                THEN 1 ELSE NULL END

                )

                     AS [Oper Down],

           COUNT(

                n.Interfaces.AdminStatus

                )

                     AS [Total]

    FROM

      NCM.Nodes n

    WHERE

      n.Interfaces.PhysicalInterface = 'Y'

    GROUP BY

      NodeCaption, AgentIP

    ORDER BY

      NodeCaption

    pastedImage_1.png

  • Hello pparsaie

    can you please tell me where can i run this query to get the port details.

    I am confused. emoticons_sad.png

  • I like the concise output of your report, but it doesn't provide the information I needed.  I was searching for a method of discovering how long inactive ports have been inactive.  The sole focus is discovering the length of time that inactive ports have stayed inactive, and sorting them by duration of inactivity.

    The goal is to discover ports which have been inactive for a very long time, and then make them available for new devices by unpatching them.

    The method I created here, How to create a report displaying the Last Time Data was Transmitted or Received on a Switch Port , does exactly what I need on a per-switch basis.

    It would be interesting to see a report that provides the same inactive port duration for all switches in an enterprise . . .    It would have to separate out nodes by some criteria (node name, preferably), and scale to hundreds or thousands of switches, each of which could have several hundred ports.  But for now, I'm satisfied with the method I built that collects the duration of port inactivity on a single switch.

Reply
  • I like the concise output of your report, but it doesn't provide the information I needed.  I was searching for a method of discovering how long inactive ports have been inactive.  The sole focus is discovering the length of time that inactive ports have stayed inactive, and sorting them by duration of inactivity.

    The goal is to discover ports which have been inactive for a very long time, and then make them available for new devices by unpatching them.

    The method I created here, How to create a report displaying the Last Time Data was Transmitted or Received on a Switch Port , does exactly what I need on a per-switch basis.

    It would be interesting to see a report that provides the same inactive port duration for all switches in an enterprise . . .    It would have to separate out nodes by some criteria (node name, preferably), and scale to hundreds or thousands of switches, each of which could have several hundred ports.  But for now, I'm satisfied with the method I built that collects the duration of port inactivity on a single switch.

Children
No Data