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 😀

Source: http://www.coolcoder.in/2014/02/10-awesome-programming-jokes-of-all-time.html

 

Access Brocade Webtools , Cisco GUI and VNX Unisphere from Linux

Both Brocade webtools, Cisco GUI and VNX Unisphere requires Java enabled browsers to manage and administer the SAN or storage devices. To enable java support on Linux, we need to install platform compatible JRE (Java Runtime environment).

Below command can be used to install JRE on Debian / Ubuntu like Linux systems.

aptitude install icedtea-plugin

After installation of above package along with its dependencies, we can access the respective Java based GUI tools from Debian / Ubuntu Linux. We can use respective package management software to install the same package on Redhat/ Fedora/ CentOS/Suse etc… This enables storage admin like me to use the respective management suite from my favorite OS.

Linux ROCKS!!!

2015-09-10 10_00_32-10.222.5.89 - Remote Desktop Connection

Delete user account on multiple Brocade SAN switches

I work in a SAN environment where we manage about 110+ SAN switches of both Brocade and Cisco models. Due to lucrative market we end up having attrition in the team which leads to clean-up of their user accounts as per security standards or policies. I did not mention how we create a new user’s account when they join our team. I’ll share that script sometime later (so keep browsing my blog…),Thanks to Perl script which takes care of it. Using that Perl script we can create multiple user accounts on multiple switches at one go 🙂

Let’s discuss about deleting an user account which took 6+ productive hours to come up with deletion script !!

user_remove

Since I’m a die-hard fan of Perl, I wanted to do this using Perl but for some reason, Net::SSH2::Expect module did not gel very well with Window$. Brocade CLI expects user to type “YES” for user delete confirmation. So, I had to learn and equip the old is gold “Expect” programming language… After few hours of trial and errors, I’ve finally succeeded with the script to delete user on multiple switches at one go 😀

Here is the script “expect.sh”

#! /bin/expect
set timeout 20
set user [lindex $argv 0]
set password [lindex $argv 1]
set prompt “(%|#|\\$|%\]) $”
;# — main activity
proc dostuff { currentswitch} {

;# do something with currentswitch

send — “userconfig –delete vinay\r”
return
}
set fd [open ./swlist.txt r]
set sws [read -nonewline $fd]
close $fd
foreach sw [split $sws”\n” ] {
spawn /usr/bin/ssh $user@$sw
while (1) {
expect {
“no)? ” {
send — “yes\r”
}
“password: ” {
send — “$password\r”
}
“>” {
send — “userconfig –delete vinay\ryes\r”
break
}
}
}
expect “>”
send — “exit\r”
}
expect eof

I know, hold your breath… Let me try to decode this for you and how to do copy-paste and use this in your setup.

PFB list of things to have, before we run this on management server

1. cygwin – Install cygwin

2. Expect – A good blog on howto install cygwin, Expect and ssh

3. swtlist.txt – A file having IP addresses of SAN switches

Now, copy both expect.sh and swlist.txt to a path e.g. /home/vinay/ [Under C:\ drive look for “cygwin” directory  C:\cygwin\home\<users> if you installed cygwin in C drive]

Launch cygwin and run the command “./expect.sh <username> <password>”

Note: I’ve same username and password across all switches. Hence its friendly to run the scripts. Some of the Brocade firmware versions are not compatible with the command “userconfig –delete <username>”. Please read the manual and replace the command accordingly,

After, you start the script using above command sit back and relax to watch the automation of user deletion!!!

Disclaimer: I’m not responsible for any outages, P1’s, Major Incidents etc by running this script in your setup. Use it with your brains by applying thought (little extra needed here…). Leave a comment if you need help to tweak this script…

Courtesy: iconfinder.com for the image and amsathishkumar.wordpress.com for the blog on cygwin, Expect and ssh installation