HP MSA 1040 HP MSA 1040 CLI Reference Guide (762782-001, March 2014) - Page 15
the output. The output can easily be redirected to a file for archiving.
View all HP MSA 1040 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 15 highlights
} $ipAddr = $ARGV[0]; $username = $ARGV[1]; $password = $ARGV[2]; $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die', Prompt => '/\# $/i'); if ( !cLogin($ipAddr, $username, $password) == 1 ) { print("Error: $username user failed to log in. Exiting.\n"); $telnet->close; exit(0); } For scripting support, the following command can be used to access the XML API and to disable the paging mode that pauses for each full screen of command output. $telnet->cmd("set cli-parameters api-embed pager disabled"); The following code segment shows how to get the entire configuration information from the CLI and print the output. The output can easily be redirected to a file for archiving. @sV = $telnet->cmd("show configuration"); for ($i=0; $inew; $url = 'http://10.0.0.2/api/login/' . $md5_hash; print ("Sending to $url\n"); $req = HTTP::Request->new(GET => $url); $res = $ua->request($req); # Parse the XML content using LibXML to obtain the session key print $res->content; my $parser = XML::LibXML->new(); my $doc = $parser->parse_string( $res->content ); my $root = $doc->getDocumentElement; my @objects = $root->getElementsByTagName('OBJECT'); my @props = $objects[0]->getElementsByTagName('PROPERTY'); Using a script to access the CLI 15