Brocade SAN switch automated troubleshooting script

What does this Brocade SAN switch automated troubleshooting script do?

  1. Ping the SAN switch IPs and check the connectivity
  2. Perform basic health check by running switchstatusshow command
  3. Check for CRC and EncOut errors by running porterrshow command
  4. If there are CRC and EncOut errors it clears the port statistics and wait for 20 minutes to monitor the incremental errors on the switch ports using portstatsclear and portshow commands
  5. Check and compare Lr_in & Ols_Out and Lr_out and Ols_in values to detect faulty cable and SFP issue
  6. Generate supportsave files which is required to do further analysis or troubleshooting by switch vendor and FTP the files
  7. Capture all the above output to file and generate email alert to further engage an engineer to continue troubleshooting or log a case with switch vendor

I hope this would help us in proactively monitoring SAN switches and iron out false positives without human intervention.

To download the script please click here and select ‘Brocade Troubleshooting’ from the right pane under Topics.


I believe this could be last blog post of the year 2016…

Belated Merry Christmas and Wish you Happy and Prosperous New Year 2017 in advance to all my followers, readers and visitors!!


How to hide your important files from people without making Hidden folders
1. Go to Desktop and create a new folder
2. Name the folder Internet Explorer
3. Change the folder icon to Internet Explorer
4. Keep it in a corner of the desktop

Now, no one will open internet explorer ūüėÄ



Create multiple user’s account on multiple Brocade SAN Switches

This blog is a¬†continuation of the previous blog in which I discussed about “Deleting User accounts from Brocade SAN switches” as well as shared the script to do the same.

We wanted to automate onboard/off-board process which we¬†follow when a new team member/s join or depart from the project. LDAP cannot be implemented¬†in the Multi-Tenant¬†environment¬†and customer owned¬†infra. So we targeted automation. Automation means scripting, scripting means PERL to me ūüôā

Here is the Perl code which¬†would login to all the switches listed¬†in the “switches_ips.txt” file and create all the user accounts listed in the “users.txt” file. Output would be saved in file “Results.txt”.


Sample output:

Creating users on switch IP:
user1- Account user1 has been successfully added.
user2 РAccount user2 has been successfully added.
user3 РAccount kaanatar has been successfully added.
user4 РAccount niravpat has been successfully added.

admin РNamed account already exists

If a user account already exists then it wont create the account again.

Simple, isn’t it? Try it out and let me know if you need help on this…

I wish you all Happy Onam and Happy Varamahalaxmi festivals. God bless you all!

Brocade SAN switches port count

We manage more than 100+ SAN switches in our storage infrastructure. Keeping track of port availability, status and count are hectic capacity management tasks. If we need to get this data manually, we need to login to each switch, run commands, grab output, do the math and tabulate values. Storage admin job is not an easy one to do!!

Using PERL script we can simplify these tasks. Below PERL script would help us to get above information in a matter of seconds. This output can be exported to excel for further beatification ūüôā

use Net::SSH2;
use POSIX;
use MIME::Lite;
open (INPUT, "emc_switch_ips.txt");
my @ip =< INPUT>;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $datestring = sprintf("%02d_%02d_%02d_%02d_%4d",$hour,$min,($mon+1),$mday,($year + 1900));
open OUTPUT, '+>', "emc_result-$datestring.txt" or die $!;
STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; # redirecting the STDOUT to file
open (PASS, "pass");
use constant BUFLEN => 10_0000 ;
my $user = "admin";
my $password = ;
my $cmdlet = ("switchshow | grep id");
foreach $switch(@ip){
print "$switch - Total number of ports\n";
my $ssh = Net::SSH2->new();
                print("Connection Failed\n");
                print("Authentication Failed");
my $channel = $ssh->channel();
my $command = $channel->exec("$cmdlet") or die $_;
	my $read = $channel->read($buf, BUFLEN );
	warn 'More than ', BUFLEN, ' characters in listing' if $read >= BUFLEN;
	print $buf;
my @data = split (/\n/,$buf);
for ($i=0;$i<$len;$i++){
#print "@data[$i] \n";
@on[$i] = grep (/Online/,@data[$i]);
@no[$i] = grep (/No_Light/,@data[$i]);
#print "Online: @on[$i] \n";
#print "Offline: @no[$i] \n";

We need to have a text file with SAN switches IP addresses called “emc_switch_ips.txt” also we need to store user password in a file called “pass”. Thats it! go to shell / CMD and execute the file which gives below output.

– Total number of ports
0 0 010000 id N8 No_Light FC
1 1 010100 id N8 No_Light FC
2 2 010200 id N8 No_Light FC
3 3 010300 id N8 No_Light FC
4 4 010400 id N8 No_Light FC
5 5 010500 id N8 No_Light FC
6 6 010600 id N8 No_Light FC
7 7 010700 id N8 No_Light FC
8 8 010800 id N8 No_Light FC (No POD License) Disabled
9 9 010900 id N8 No_Light FC (No POD License) Disabled
10 10 010a00 id N8 No_Light FC (No POD License) Disabled
11 11 010b00 id N8 No_Light FC (No POD License) Disabled
12 12 010c00 id N8 No_Light FC (No POD License) Disabled
13 13 010d00 id N8 No_Light FC (No POD License) Disabled
14 14 010e00 id N8 No_Light FC (No POD License) Disabled
15 15 010f00 id N8 No_Light FC (No POD License) Disabled
On-line Ports= 0
Offline Ports= 16
Total Ports = 16
Overall Total On-line Ports = 0
Overall Total Offline Ports = 16
Overall Total Ports = 16

Abort Changes made to SAN Switch

Abort changes made to a SAN Switch

Everyone will tend to make mistake some or other day at work. In case of SAN Administration, people like me; do more mistakes than rest. So, I should know how to fix it with out glitches in the production. One day, I was trying to create some new alias, zones etc… on Brocade SAN switch and added them to the configuration. Later, I realised that I shouldn’t have done those changes. What to do now? Should I remove aliases and zones one by one? No… I don’t have patience to do that, even though I made a mistake. So, some genius guy who works with Brocade has added commands to help people like us ūüė¶
cfgtransshow and cfgtransabort:

cfgtransshow will show the transactions and can be cleaned using the cfgtransabort.
So, go ahead and explore yourself! It will come in handy when you want to cover from the SAN zoning mistakes…
Take care!