|laziness, impatience, and hubris|
Perl comes to rescue once again.by perl514 (Pilgrim)
|on Apr 09, 2013 at 18:54 UTC||Need Help??|
I am Storage Administrator on a lookout for finding ways to automate certain tasks. Recently we encountered an issue where a few server HBAs would suddenly log out of a SAN storage array. The problem was random but was happening with storage array from a specific vendor. The storage and the server vendors' analyses of various parameters could not point out to the underlying issue.
Unfortunately, the Storage Array alerting system is not capable of capturing the log outs and many times we were caught unaware.
So, we were on a lookout for a solution that would report this issue. That's where Perl came in. :). Using DWIM Perl, a script was written that would log in to each storage array (Net::SSH2 Module) picking up the IPs from a text file, write the output to a text file, then using regular expressions, only the hosts that had one or more HBAs logged out would be e-mailed to our DL (MIME::Lite). The username/password information, the mail server information, the location of the text files, and the command that would capture the information, was saved in a seperate file and as & when required, the fields were called into the script (Config::Tiny Module).
Another issue was noted with our NAS Arrays where in the Data Movers would reboot/panic and the alert indicating the same would many times not be fired for some reason. Also, the data movers would not reflect that they were a few hours or even days behind each other.
Once again, Perl helped automate the alerting. Using similar methods as above, it would generate e-mails and that ways, avoid issues.
I used to read about how Perl shines at slicing and dicing text files, how the modules make the work easy and such stuff. But only when I started writing the scripts, the power was visible. Perl is truly a great language.
Apart from writing some basic, small C programs, I had never done any programming at all, and the last time I wrote a C Program was about 12 years ago....Not that learning Perl happened in a matter of few days. It did take me quite a while to get some basic comfort level with the language and the eternal learning will continue, but what is amazing is the quickness with which Perl allows one to get a script up and running. The fact that your script is running in your production environment, doing some really useful stuff gives a real different high. What I have written is not rocket science or something that is mind boggling complicated stuff, yet, the satisfaction is immense.
Another advantage, is that Perl rekindled my interest in Linux. Yeah, DWIM Perl on Windowsis amazing and comes pre installed with almost all the modules that one would need, yet, learning Perl on Linux was a quite different experience. And just to get Perl on my system, I installed Linux on my personal laptop. I tried CentOS, Fedora, Ubuntu and started toying around with the OS, with the System Perl that came pre installed in them and such stuff. It helped me get comfortable with Linux, which got me interested in some system admin related stuff, which in turn helped me become a better storage administrator.
To the Perl Community, the creators of DWIM Perl, and ofcourse..PerlMonks, Thank You. Thank You Very Much. It feels good.