kliewc has asked for the wisdom of the Perl Monks concerning the following question:

I am a NOOB at perl (infact scriptng over all), I need some guidence and help to create a scipt that will log into multiple IP Addresses(HP MSA's), each MSA has a different Password and after logging in will run a certain command and then exit. I have 148 MSA's, each one has a different password so I thought of having it read from a CSV, txt, or excel file. The script will read the ip address, user name and password run the command, exit and move to the next ip address. Any help with this would save me so much time. THANKS!
  • Comment on Need Wisdom on Creating Script to login Mutiple MSA's

Replies are listed 'Best First'.
Re: Need Wisdom on Creating Script to login Mutiple MSA's
by marto (Cardinal) on Aug 04, 2009 at 18:24 UTC

    How do you normally connect to a MSA? If it is via a web interface see WWW:Mechanize, if it is via ssh see Net::SSH.

    If those suggestions were no help perhaps you could explain the connection mechanism, along with any other problems you have.

    Since you are new to Perl I'd suggest reading some of the tutorials regarding reading the basics.

    Martin

      For what I need to do on this, i connect via ssh using putty. Thanks for your helpp and for the tutorials!
Re: Need Wisdom on Creating Script to login Mutiple MSA's
by Marshall (Canon) on Aug 05, 2009 at 01:31 UTC
    The script will read the ip address, user name and password run the command, exit and move to the next ip address.

    The data file part appears to be simple. Perl is excellent at parsing text data files. I'm not sure what an "MSA" is versus an IP address. I would space separated tokens if that is feasible (and I think that it is as whitespaces (\n\t\r\s\f) aren't normally allowed for ip address, user name or password). If "pass phrase" is allowed, minor adjustments can be made below to allow that.

    use strict; use warnings; while (<DATA>) { my ($ip,$name,$pwd) = split; print "$ip $name $pwd\n"; # do the command on those params here # } #prints #128.45.123.1 bob qwert #129.1.25.86 jane asfd)(*&^ __DATA__ 128.45.123.1 bob qwert 129.1.25.86 jane asfd)(*&^
      Thanks for your help, I will work with this. I appreciate everyone's help.
Re: Need Wisdom on Creating Script to login Mutiple MSA's
by raisputin (Scribe) on Aug 04, 2009 at 20:09 UTC
    for my work I do a lot of perl work that involves using Net::SSH and Net::SSH::Expect, so if you need some help with that, I may be able to shed some light on it