PowerShell: Query Cisco (Catalyst 4500) Flow Control statistics

Written by Ingmar Verheij on June 1st, 2012. Posted in PowerShell

Last week I attended E2EVC in Vienna, a non-commercial,virtualization community Event, and attended a session of Saša Mašić about an issue he had at a customer. In short, the problems where caused by a switch that couldn’t process IP packets because it overflowed, and therefore Ethernet flow control temporarily stopped the transmission of some attached devices. Although I’m no network expert I do know this might be a serious issue. After reading this article, you might agree.

If you’re looking for the PowerShell script, scroll to the bottom.

RxPause and TxPause

This week I  was asked to troubleshoot performance issues at a customer and got informed that the core switches (Cisco Catalyst 4500) might be over capacity. A quick look in the flow control statistics (# show flowcontrol) indicated there where send numerous RxPause and TxPause packages, a sign Flow Control has been active.

 

Since the IOS (not to confuse with the OS on Apple devices) was recently upgraded the statistics where  “fresh”. In order to troubleshoot I need to collect the metrics over a longer period from multiple (core) switches, I needed an automated solution.

SNMP

The easiest (and most obvious) method would be to use SNMP to query the statistics. I found it the “easiest” way of finding the correct OID by “walking” the values (querying all exposed values) and match it with the values I found in the terminal session (# show flowcontrol).. In short, it wasn’t exposed.

 

PowerShell

I needed an automated solution that queried multiple switches and store to a file it so I can analyze the data later. Since it temporary I didn’t find it necessary to store it in a SQL database, a comma-separated-file (CSV) would be just fine (if you need to store it in SQL, contact me).

I’ve localized the ‘comma’ in the comma-separated-file since this is different in some countries. A Dutch operating system for instance has a semicolon.

The IOS on the core switches didn’t have cryptography so I was unable to use SSH, therefore I used telnet to connect to the switches.

 

Download

FlowControl.ps1

 

Usage: FlowControl.ps1 –remoteHost [–remotePort] [–username] –password  [-enablePassword]  [-timeout]

  • remoteHost  : The host where to connect to (FQDN or IP)
  • remotePort (optional): The port to connect to (default 23)
  • username (optional) : The user to authenticate with (default: admin)
  • password:  The password to authenticate with
  • enablePassword (optional): The enable password (default equal to password)
  • timeout (optional): The timeout in seconds for each action (default 30)

 

Credits

The wheel is round, we all know that, so why should I reinvent it? I used a PowerShell script to do an SNMP telnet test from Glen Scales and worked from there. Appending data to a CSV file is by default not possible, so I’ve used the altered function from Dmitry Sotnikov.

Ingmar Verheij

At the time Ingmar wrote this article he worked for PepperByte as a Senior Consultant (up to May 2014). His work consisted of designing, migrating and troubleshooting Microsoft and Citrix infrastructures. He was working with technologies like Microsoft RDS, user environment management and (performance) monitoring. Ingmar is User Group leader of the Dutch Citrix User Group (DuCUG). RES Software named Ingmar RES Software Valued Professional in 2014.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Tags: , , ,

Comments (2)

  • 5 March 2014 at 10:44 |

    Hi Ingmar,

    It seems $enablePassword is not defined in your script, so it won’t send “enable” to switch. Is this final version of your script?

    Yusuf.

    • 6 March 2014 at 08:57 |

      Hi Yusuf,

      You’re right. It’s not used because there’s no need to go to a priviliged execution mode (enable) to read the flowcontrol statistics .

      You can safely ignore the variable.

      Ingmar

Leave a comment

*

Donate

%d bloggers like this: