If you are like pretty much everyone I know who lives in the Storage World you seldom know what port on your SAN Fabric a WWN is connected with. With Cisco you end up using device manager or fabric manager to try and find it – it works but I’m a command line kind of guy… So I end up logging into each switch in my fabric and doing the ole “show flogi database” routine.. If you’ve got a switch or two it’s not that painful, but when you grow beyond that it’s just plain annoying.
I’m tired of doing that. I’m tired of logging in to countless switches until I come across the correct switch. I finally got annoyed enough to do something about it. I decided to write a simple Perl script to automate the whole process. Check out the results below:
[box] cincystorage@symcliserver pub $ ./flogi_search.pl 51
So what it just did was log into to each defined switch in the fabric using ssh (more on this in a minute) and executed a “show flogi database |include 51”. It then checked the returned value to make sure it was the end of the wwpn – notice in the above example it only returned results ending in 51. If we did “./flogi_search.pl 10:00” it would only return entries which wwpn ends in “10:00” rather than every Emulex wwpn on the fabric.
This does require a small amount of prep work. First and foremost is the ssh setup on your Cisco switches. In order to login without a password to the Cisco switches two things need to be in place:
- An account on the switches in the fabric with an appropriate role such as network-admin
- An SSH key generated and installed on the switches in the fabric to allow login without a password
I trust my readers will be able to make these things happen or at the very least Google it!
The second part of the setup is the “flogi_search.pl” script needs to know what switches to check. If you look at the script provided at the bottom of this post you’ll see they are defined on line 11:
[box type=”info”] my @switches = (“192.168.1.50”, “192.168.1.51”, “192.168.1.52”, “192.168.1.52”); [/box]
I think you’ll find this an invaluable tool in your work with Cisco fabrics and stay turned for the next part of this mini-series for some more Cisco goodness.