[Tfug] A useful Brocade switch hack..

bpoag at comcast.net bpoag at comcast.net
Mon Apr 23 13:52:07 MST 2007


Ran into a little bit of a problem here at work, with a fix worth sharing.. At least worth indexing by Google, to save some poor soul a headache or two. :)

 I'm building a script in Perl that collects information about our SAN, from top to bottom -- This includes poking around on fabric and wringing out all the worthwhile status info I can.

There *is* a Perl module for this task (Net::Telnet::Brcd) , but it's sort of half-assed, and doesn't handle pagination on commands that produce lengthy output. Thats the problem. Many of the truly useful commands (like configShow) are hardcoded to paginate, and theres no way to tell the command to do otherwise. Its like everythings piped to less, and theres no way to turn it off. Worse, it would be a titanic pain to write your script in such a way that it seeks to page breaks, or learns how to anticipate them and sends the appropriate key depending upon circumstance. 


Here's the solution.... Real simple. For any command that tries to force pagination, just encase it within echo:

e.g. instead of:

  BROCADE1:admin> configShow
   /// arrgh.

do

  BROCADE1:admin> echo `configShow`
   /// yaaay!    ===--The More You Know*
 
That way, the #$!?*& hardcoded paginator becomes meaningless since theres no notion of a "page" to paginate. :) It also has the nice side-effect of producing the same output without CR/LF formatting. 

$numStone--; $numBirdsKilled+=2;       

Cheers,
Bowie




More information about the tfug mailing list