HP MSA 2040 CLI Reference Guide
16 Using the CLI
my $sessionKey;
foreach my $prop ( @props ) {
my $name = $prop->getAttribute('name');
print "Property = " . $name . "\n";
if( $name eq 'response' ) {
$sessionKey = $prop->textContent;
}
}
print "Session Key = $sessionKey\n";
# Run a sample command to obtain the disks in the system.
$url = 'http://10.0.0.2/api/show/disks';
$req = HTTP::Request->new(GET => $url);
$req->header('sessionKey' => $sessionKey );
$req->header('dataType' => 'ipa' );
$res = $ua->request($req);
$url2 = 'http://10.0.0.2/api/exit';
$req2 = HTTP::Request->new(GET => $url3);
$req2->header('sessionKey' => $sessionKey );
$req2->header('dataType' => 'api' );
$res2 = $ua->request($req2);
print $res->content;
The next section provides more information about using the XML API.
Using the XML API
The Management Controller provides access for monitoring and management via the Telnet and SSH
protocols for command-line interface semantics, or via the HTTP and HTTPS protocols for XML API
request/response semantics.
You can use an XML parser, such as XML::Parser in Perl, to process the XML output and store this
information as objects.
The output of each CLI command is composed of valid XML data until the CLI prompt (typically #) is
encountered. The output contains a valid XML header followed by the XML elements described in the
following table.