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


Root access in cyanogenmod 12

If you want to enable root access in cyanogenmod based roms then go to Settings > Developer Options > Root Access
Select Apps and ADB

Whenever any app requires root access privacy guard would prompt you whether to give root access or not.