<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic HP P2000 CLI perl scripting error in Disk Enclosures</title>
    <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790408#M37853</link>
    <description>Hi friends,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a perl script using HP P2000 CLI library to create snapshots and map the snapped volume to host before nightly backup and delete the snapshots after the backup is complete.&lt;BR /&gt;&lt;BR /&gt;I refered HP P2000 CLI reference guide to script this functionality.&lt;BR /&gt;&lt;A href="http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02520779/c02520779.pdf" target="_blank"&gt;http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02520779/c02520779.pdf&lt;/A&gt;&lt;BR /&gt;(page: 14 &amp;amp; 15)&lt;BR /&gt;&lt;BR /&gt;I installed perl software locally in my desktop.&lt;BR /&gt;&lt;BR /&gt;I used below script to connect to storage system and trying to execute "Show configuration" cli command to start with. When i execute the below script. I am getting the "command timed-out at line login.pl in 35". Can any one help out to resolve this?&lt;BR /&gt;&lt;BR /&gt;Perl script: login.pl&lt;BR /&gt;---------------------&lt;BR /&gt;use Net::Telnet;&lt;BR /&gt;sub cLogin {&lt;BR /&gt;$telnet-&amp;gt;open($_[0]);&lt;BR /&gt;$telnet-&amp;gt;waitfor(/(login|username)[: ]*$/i);&lt;BR /&gt;$telnet-&amp;gt;print("$_[1]");&lt;BR /&gt;$telnet-&amp;gt;waitfor(/password[: ]*$/i);&lt;BR /&gt;$telnet-&amp;gt;print("$_[2]");&lt;BR /&gt;# either got a login or a prompt&lt;BR /&gt;@ok = $telnet-&amp;gt;waitfor(/(#|login:*) /i);&lt;BR /&gt;&lt;BR /&gt;if ($debug_commands == 1) { print "-"; print @ok; print "-\n"; }&lt;BR /&gt;if ($ok[1] =~ m/login/gi)&lt;BR /&gt;{&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;$ipAddr = $ARGV[0];&lt;BR /&gt;$username = $ARGV[1];&lt;BR /&gt;$password = $ARGV[2];&lt;BR /&gt;$telnet = new Net::Telnet ( Timeout=&amp;gt;10,Errmode=&amp;gt;'die');&lt;BR /&gt;if ( !cLogin('000.000.00.0000','johnsmith','smithpass') == 1 )&lt;BR /&gt;{&lt;BR /&gt;print("Error: $username user failed to log in. Exiting.\n");&lt;BR /&gt;$telnet-&amp;gt;close;&lt;BR /&gt;exit(0);&lt;BR /&gt;}else{&lt;BR /&gt;print("Info: Login successfull.\n");&lt;BR /&gt;@test = $telnet-&amp;gt;cmd("show configuration");&lt;BR /&gt;print @test;&lt;BR /&gt;&lt;BR /&gt;for ($i=0; $i&lt;SCALAR&gt;&lt;/SCALAR&gt;{&lt;BR /&gt;print ("@test[ $i ]");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output&lt;BR /&gt;------&lt;BR /&gt;C:\Perl\eg&amp;gt;perl login.pl&lt;BR /&gt;Info: Login successfull.&lt;BR /&gt;command timed-out at login.pl line 32&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;Viswa&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 20 May 2011 14:18:08 GMT</pubDate>
    <dc:creator>viswasarathy rajasekara</dc:creator>
    <dc:date>2011-05-20T14:18:08Z</dc:date>
    <item>
      <title>HP P2000 CLI perl scripting error</title>
      <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790408#M37853</link>
      <description>Hi friends,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a perl script using HP P2000 CLI library to create snapshots and map the snapped volume to host before nightly backup and delete the snapshots after the backup is complete.&lt;BR /&gt;&lt;BR /&gt;I refered HP P2000 CLI reference guide to script this functionality.&lt;BR /&gt;&lt;A href="http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02520779/c02520779.pdf" target="_blank"&gt;http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02520779/c02520779.pdf&lt;/A&gt;&lt;BR /&gt;(page: 14 &amp;amp; 15)&lt;BR /&gt;&lt;BR /&gt;I installed perl software locally in my desktop.&lt;BR /&gt;&lt;BR /&gt;I used below script to connect to storage system and trying to execute "Show configuration" cli command to start with. When i execute the below script. I am getting the "command timed-out at line login.pl in 35". Can any one help out to resolve this?&lt;BR /&gt;&lt;BR /&gt;Perl script: login.pl&lt;BR /&gt;---------------------&lt;BR /&gt;use Net::Telnet;&lt;BR /&gt;sub cLogin {&lt;BR /&gt;$telnet-&amp;gt;open($_[0]);&lt;BR /&gt;$telnet-&amp;gt;waitfor(/(login|username)[: ]*$/i);&lt;BR /&gt;$telnet-&amp;gt;print("$_[1]");&lt;BR /&gt;$telnet-&amp;gt;waitfor(/password[: ]*$/i);&lt;BR /&gt;$telnet-&amp;gt;print("$_[2]");&lt;BR /&gt;# either got a login or a prompt&lt;BR /&gt;@ok = $telnet-&amp;gt;waitfor(/(#|login:*) /i);&lt;BR /&gt;&lt;BR /&gt;if ($debug_commands == 1) { print "-"; print @ok; print "-\n"; }&lt;BR /&gt;if ($ok[1] =~ m/login/gi)&lt;BR /&gt;{&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;$ipAddr = $ARGV[0];&lt;BR /&gt;$username = $ARGV[1];&lt;BR /&gt;$password = $ARGV[2];&lt;BR /&gt;$telnet = new Net::Telnet ( Timeout=&amp;gt;10,Errmode=&amp;gt;'die');&lt;BR /&gt;if ( !cLogin('000.000.00.0000','johnsmith','smithpass') == 1 )&lt;BR /&gt;{&lt;BR /&gt;print("Error: $username user failed to log in. Exiting.\n");&lt;BR /&gt;$telnet-&amp;gt;close;&lt;BR /&gt;exit(0);&lt;BR /&gt;}else{&lt;BR /&gt;print("Info: Login successfull.\n");&lt;BR /&gt;@test = $telnet-&amp;gt;cmd("show configuration");&lt;BR /&gt;print @test;&lt;BR /&gt;&lt;BR /&gt;for ($i=0; $i&lt;SCALAR&gt;&lt;/SCALAR&gt;{&lt;BR /&gt;print ("@test[ $i ]");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output&lt;BR /&gt;------&lt;BR /&gt;C:\Perl\eg&amp;gt;perl login.pl&lt;BR /&gt;Info: Login successfull.&lt;BR /&gt;command timed-out at login.pl line 32&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;Viswa&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 May 2011 14:18:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790408#M37853</guid>
      <dc:creator>viswasarathy rajasekara</dc:creator>
      <dc:date>2011-05-20T14:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: HP P2000 CLI perl scripting error</title>
      <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790409#M37854</link>
      <description>&lt;!--!*#--&gt;Hi Viswa,&lt;BR /&gt;&lt;BR /&gt;i faced exactly the same problem. But i think i found a solution. You have to throw away the hole script and define the Prompt.&lt;BR /&gt;&lt;BR /&gt;1.) HP thinks too complicated... :-)&lt;BR /&gt;2.) try this:&lt;BR /&gt;&lt;BR /&gt;use Net::Telnet;&lt;BR /&gt;&lt;BR /&gt;$TARGET_IP = $ARGV[0];&lt;BR /&gt;$USER  = $ARGV[1];&lt;BR /&gt;$PASSWORD = $ARGV[2];&lt;BR /&gt;&lt;BR /&gt;$telnet = new Net::Telnet ( Timeout=&amp;gt;10,Errmode=&amp;gt;'die',Prompt =&amp;gt; '/\# $/i');&lt;BR /&gt;$telnet-&amp;gt;open($TARGET_IP);&lt;BR /&gt;$telnet-&amp;gt;login($USER, $PASSWORD);&lt;BR /&gt;print $telnet-&amp;gt;cmd('show configuration');&lt;BR /&gt;&lt;BR /&gt;For me this works.&lt;BR /&gt;&lt;BR /&gt;cu&lt;BR /&gt;Daniel&lt;BR /&gt;</description>
      <pubDate>Tue, 24 May 2011 08:36:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790409#M37854</guid>
      <dc:creator>Daniel Ruppert</dc:creator>
      <dc:date>2011-05-24T08:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: HP P2000 CLI perl scripting error</title>
      <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790410#M37855</link>
      <description>Hi Daniel,&lt;BR /&gt;&lt;BR /&gt;Your code simple and easy. Thanks for your response.&lt;BR /&gt;&lt;BR /&gt;After a try we got this below to work as well.&lt;BR /&gt;&lt;BR /&gt;use Net::Telnet;&lt;BR /&gt;$telnet = new Net::Telnet ( Timeout=&amp;gt;10,Errmode=&amp;gt;'die',Prompt =&amp;gt; '/\# $/i');&lt;BR /&gt;$return = 0;&lt;BR /&gt;@chkLgn = cLogin("150.123.70.172", "MLC_Admin", "metapass");&lt;BR /&gt;&lt;BR /&gt;if ( !chkLgn == 1 )&lt;BR /&gt;{&lt;BR /&gt; print("Error: $username user failed to log in. Exiting.\n");&lt;BR /&gt; $telnet-&amp;gt;close;&lt;BR /&gt; exit(0);&lt;BR /&gt;} else {&lt;BR /&gt;&lt;BR /&gt;       executeCmd("show volumes");&lt;BR /&gt;       $telnet-&amp;gt;close;&lt;BR /&gt;       exit($return);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sub cLogin {&lt;BR /&gt; $telnet-&amp;gt;open($_[0]);&lt;BR /&gt; $telnet-&amp;gt;waitfor('/(login|username)[: ]*$/i');&lt;BR /&gt; $telnet-&amp;gt;print("$_[1]");&lt;BR /&gt; $telnet-&amp;gt;waitfor('/password[: ]*$/i');&lt;BR /&gt; $telnet-&amp;gt;print("$_[2]");&lt;BR /&gt; # either got a login or a prompt&lt;BR /&gt; @ok = $telnet-&amp;gt;waitfor('/(#|login:*) /i');&lt;BR /&gt; if ($debug_commands == 1) {&lt;BR /&gt;         print "-";&lt;BR /&gt;                print @ok;&lt;BR /&gt;                print "-\n";&lt;BR /&gt;        }&lt;BR /&gt;&lt;BR /&gt; if ($ok[1] =~ m/login/gi)&lt;BR /&gt; {&lt;BR /&gt;  return 0;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt;         return 1;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sub executeCmd {&lt;BR /&gt;&lt;BR /&gt;         @sV = $telnet-&amp;gt;cmd("$_[0]");&lt;BR /&gt;                for ($i=0; $i&lt;SCALAR&gt;&lt;/SCALAR&gt;  {&lt;BR /&gt;                        if("@sV[ $i ]" !~ /Error/){&lt;BR /&gt;                          print ("@sV[ $i ]");&lt;BR /&gt;                        } else {&lt;BR /&gt;                               $return = 1;&lt;BR /&gt;                        }&lt;BR /&gt;                }&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thanks Again&lt;BR /&gt;-Viswa&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 May 2011 12:33:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/4790410#M37855</guid>
      <dc:creator>viswasarathy rajasekara</dc:creator>
      <dc:date>2011-05-24T12:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: HP P2000 CLI perl scripting error</title>
      <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/5866927#M45876</link>
      <description>&lt;P&gt;anybody have any SSH script to the SAN storage I can use? I tried expect,openssh and nothing work, kept getting&lt;/P&gt;&lt;P&gt;this error when I use a command like "show vdisks"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Received disconnect from ipaddress: 2: unsupported command&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 23:26:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/5866927#M45876</guid>
      <dc:creator>cssanangeles</dc:creator>
      <dc:date>2012-11-14T23:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: HP P2000 CLI perl scripting error</title>
      <link>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/5866935#M45877</link>
      <description>&lt;P&gt;btw I can't use Telnet, our IT guys disable telnet.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 23:36:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/disk-enclosures/hp-p2000-cli-perl-scripting-error/m-p/5866935#M45877</guid>
      <dc:creator>cssanangeles</dc:creator>
      <dc:date>2012-11-14T23:36:58Z</dc:date>
    </item>
  </channel>
</rss>

