SNMP::Multi 2.1 review
DownloadSNMP::Multi is a Perl module to perform SNMP operations on multiple hosts simultaneously. SYNOPSIS use SNMP::Multi;
|
|
SNMP::Multi is a Perl module to perform SNMP operations on multiple hosts simultaneously.
SYNOPSIS
use SNMP::Multi;
my $req = SNMP::Multi::VarReq->new (
nonrepeaters => 1,
hosts => [ qw/ router1.my.com router2.my.com / ],
vars => [ [ 'sysUpTime' ], [ 'ifInOctets' ], [ 'ifOutOctets' ] ],
);
die "VarReq: $SNMP::Multi::VarReq::errorn" unless $req;
my $sm = SNMP::Multi->new (
Method => 'bulkwalk',
MaxSessions => 32,
PduPacking => 16,
Community => 'public',
Version => '2c',
Timeout => 5,
Retries => 3,
UseNumeric => 1,
# Any additional options for SNMP::Session::new() ...
)
or die "$SNMP::Multi::errorn";
$sm->request($req) or die $sm->error;
my $resp = $sm->execute() or die "Execute: $SNMP::Multi::errorn";
print "Got response for ", (join ' ', $resp->hostnames()), "n";
for my $host ($resp->hosts()) {
print "Results for $host: n";
for my $result ($host->results()) {
if ($result->error()) {
print "Error with $host: ", $result->error(), "n";
next;
}
print "Values for $host: ", (join ' ', $result->values());
for my $varlist ($result->varlists()) {
print map { "t" . $_->fmt() . "n" } @$varlist;
}
print "n";
}
}
The SNMP::Multi package provides a mechanism to perform SNMP operations on several hosts simultaneously. SNMP::Multi builds on G. Marzot's SNMP Perl interface to the UC-Davis SNMP libraries, using asynchronous SNMP operations to send queries/sets to multiple hosts simultaneously.
Results from all hosts are compiled into a single object, which offers methods to access the data in aggregate, or broken down by host or the individual request.
SNMP::Multi supports SNMP GET, SET, GETNEXT, GETBULK and BULKWALK requests. It also performs PDU packing in order to improve network efficiency, when packing is possible.
Requirements:
Perl
SNMP::Multi 2.1 search tags