rfc2324.org - Software projects

Cisco VLAN stats / overview


cisco-stats is a bunch (at the moment two) scripts with what you can get an overview about the vlan infrastructure and port usage on your cisco devices.

These two scripts are described as followes:

  1. getCiscoPortStatus - with a device name and password provided - will download the port list of the device and and save it to disk.
    In fact is automates this:
    1. telnet SWITCH
    2. enter $password
    3. run show interface status or show port status
    4. Save the output to SWITCH.ports

    The content of SWITCH.ports could look like this:
    DEVICE: cat2950-example
    
    Port    Name               Status       Vlan       Duplex  Speed Type
    Fa0/1   " "                connected    106        a-full  a-100 10/100BaseTX
    Fa0/2   myLittleServer     connected    106        a-full  a-100 10/100BaseTX
    Fa0/3   bigIronMainFrame   connected     42        a-full  a-100 10/100BaseTX
    Fa0/4   no comment         connected     23        a-full  a-100 10/100BaseTX
    Fa0/5                      connected    106        a-full  a-100 10/100BaseTX
    Fa0/6                      connected    106        a-full  a-100 10/100BaseTX
    Fa0/7   seven of nine      connected    106        a-full  a-100 10/100BaseTX
    Fa0/8                      connected    106        a-full  a-100 10/100BaseTX
    Fa0/9                      connected    106        a-full  a-100 10/100BaseTX
    Fa0/10  " "                notconnect    45          auto   auto 10/100BaseTX
    [...]
    Gi0/1                      connected    trunk      a-full a-1000 1000BaseSX
    Gi0/2                      disabled     666          auto   auto 1000BaseTX
    
    END DEVICE
    
    
    DEVICE: cat3508
    
    Port    Name               Status       Vlan     Duplex Speed   Type
    ------- ------------------ ------------ -------- ------ ------- ----
    Gi0/1                      connected    trunk      Full    1000 1000BaseSX
    Gi0/2                      connected    trunk    A-Full    1000 1000BaseT
    Gi0/3                      connected    105      A-Full    1000 1000BaseT
    Gi0/4                      connected    106      A-Full    1000 1000BaseT
    Gi0/5                      connected    116      A-Full    1000 1000BaseT
    Gi0/6                      connected    106      A-Full    1000 1000BaseT
    Gi0/7                      connected    106      A-Full    1000 1000BaseT
    Gi0/8                      notconnect   106        Auto    1000 1000BaseT
    
    END DEVICE
    

  2. parseCiscoPortStatus - given the above list - will calculate a tabular overview about the vlans in used and the number of active/inactive/disabled port in them.
    It will also provide information about the devices each vlan is used on and the number of ports for each device.
    Input can be provided via stdin or from a file.

    parseCiscoPortStatus called with the about listing would show the following statistics:
      VLAN        status          count       devices
    --------+-----------------+-----------+---------------
        23  |      connected  |      1    |  cat2950-example( 1 ),
        42  |      connected  |      1    |  cat2950-example( 1 ),
        45  |  not connected  |      1    |  cat2950-example( 1 ),
       105  |      connected  |      1    |  cat3508( 1 ),
       106  |  not connected  |      1    |  cat3508( 1 ),
       106  |      connected  |     10    |  cat2950-example( 7 ), cat3508( 3 ),
       116  |      connected  |      1    |  cat3508( 1 ),
       666  |      disabled   |      1    |  cat2950-example( 1 ),
     trunk  |      connected  |      3    |  cat2950-example( 1 ), cat3508( 2 ),
    --------+-----------------+-----------+---------------
       all  |      connected  |     17
       all  |  not connected  |      2
       all  |      disabled   |      1
       all  |      invalid    |      0
       all  |      all        |     20
    

Download and projectmanagement

Since april 2009 I'm using redmine to manage my projects. Check the project page there for further information, releases and dowloads.

The latest development version can be found in the GIT repository available via gitweb.