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){
chomp($switch);
print "$switch - Total number of ports\n";
my $ssh = Net::SSH2->new();
        if(!$ssh->connect($switch)){
                print("Connection Failed\n");
                exit(1);
        }
        if(!$ssh->auth_password($user,$password)){
                print("Authentication Failed");
                exit(1);
        }
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;
	$channel->close;
my @data = split (/\n/,$buf);
$len=@data;
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.

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

Advertisements

How to check your Brocade SAN Switch is ready to use for 8 GBps?

Its time to say bye to 1-2-4 GBps and say hi to 8 GBps. So how do you know whether your SAN switch is ready to plugin 8 GBps SFP’s?

Here is the command

slotshow -m

Above command show the info about the blades connected to the slots, no. of ports in each blade and the port speed. “FC8” means 8 GBps “FC4” means 4 GBps supported by the switch blades. Remember, if you have 1 GBps / GBICs then we cant use them with 8 GBps supported Blades.

How to learn the basics of SAN from the internet?

I wonder how many times I tried to learn and acquire knowledge of storage area networking (SAN) from the internet…

Nowadays I find that its easy to Google it for the sites to fetch the cutting edge info on the SAN. I thought of making a list of websites from where we can get information on the SAN. Since I’m working as a SAN Admin (and I love to work on EMC products), I personally go through these websites to remember the basics and important stuffs in SAN!

SAN related websites:

  1. Clariion LUN allocation
  2. DMX Basic SymCLI
  3. SAN Switch’s CLI
  4. StorageNerve

Above are the sites which I refer, I’ll update the above list if I find an interesting site of this category.