Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Perl comes to rescue once again.

by perl514 (Pilgrim)
on Apr 09, 2013 at 18:54 UTC ( #1027810=perlmeditation: print w/replies, xml ) 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.

Perlpetually Indebted To PerlMonks

use Learning::Perl; use Beginning::Perl::Ovid; print "Awesome Books"; is a boon for Windows.

Replies are listed 'Best First'.
Re: Perl comes to rescue once again.
by sundialsvc4 (Abbot) on Apr 12, 2013 at 00:55 UTC

    “Welcome to Perl.”   Very soon, you will see for yourself why the language has been called “The Swiss Army® Knife of Computer Programming.”   All those many years ago, a fellow named Larry Wall was faced with issues very much like these ... and they are, indeed, universal ... and, well, “one thing led to another,” and The Rest Is History.™   He wrote the tool that he needed, then he released it to the world, and the world took over from there.

    If your exposure to programming, up to this point, was “C/C++,” well, you quite-understandably might have presumed that “to do anything (useful), you must do it yourself.”   As you now see, the truth of the matter is that marvelous programs, such as ... say ... perl ... have been built using those more-primitive language tools.   Therefore, “you can stand upon the shoulders of giants.”

    The “P” in Perl could stand for “practical” or “pragmatic.”   Either one will suffice.   For real-world, boots-on-the-ground, purposes just like the ones that you have encountered ... and just like the ones that so many of all-of-us likewise face every day ... the Perl language is “a helluva power-tool.”

    Welcome aboard!

Re: Perl comes to rescue once again.
by perl514 (Pilgrim) on Apr 12, 2013 at 15:37 UTC


    Thank you for your encouraging words. Yes, indeed, I do feel like I'm "Standing on the shoulders of giants". Especially when I log in here.

    Many a threads here at PerlMonks have literally fast forwarded the learning process. Everyone here is genuinely helpful. Without PerlMonks, the learning process would have indeed been tough.

    Every once in a while, I come across some really fabuluous Perl stuff that just amazes me. Named Captures, split and join, the smart match operator...and many more such things are really really amazing. Two weeks ago, I discovered what a blessing the $/ is. I used that in my script to seperate out certain sections of a record. Thats just one example of how amazingly useful this language is.

    Now. whenever there is some need to do some automation or scripting, I am considered as one of the "scripting guys" and asked if I would like to take a shot at it. Man it feels good.

    Perlpetually Indebted To PerlMonks

    use Learning::Perl; use Beginning::Perl::Ovid; print "Awesome Books"; is a boon for Windows.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1027810]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-06-25 12:27 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.