Skip to content

A Perl interface to the Cisco UCS XML API

This does not get enough attention. Perl rocks and Linux rules. PowerShell is all the rage, but Perl is a bit more exciting to the Linux world. After all what is NXOS???

https://github.com/ltp/Cisco-UCS

NAME

Cisco::UCS – A Perl interface to the Cisco UCS XML API

SYNOPSIS

use Cisco::UCS;

my $ucs = Cisco::UCS->new (
            cluster     => $cluster, 
            username    => $username,
            passwd      => $password
            );

$ucs->login();

@errors = $ucs->get_errors(severity=>"critical",ack="no");

foreach my $error_id (@errors) {
    my %this_error = $ucs->get_error_id($error_id);
    print "Error ID: $error_id.  Severity: $this_error{severity}."
        . "  Description: $this_error{descr}\n";
}

print "Interconnect A serial : " 
    . $ucs->interconnect(A)->serial 
    . "\n";

# prints "Interconnect A serial : BFG9000"

foreach my $chassis ($ucs->chassis) {
    print "Chassis " . $chassis->id 
        . " serial : " . $chassis->serial . "\n"
}

# prints:
# "Chassis 1 serial : ABC1234"
# "Chassis 2 serial : ABC1235"
# etc.

print "Interconnect A Ethernet 1/1 TX bytes: " 
    . $ucs->interconnect(A)->card(1)->eth_port(1)->tx_total_bytes;

# prints "Interconnect A Ethernet 1/1 TX bytes: 83462486"

$ucs->logout();
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published.

%d bloggers like this: