All pastes #971543 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-04 20:41 UTC
rendered paste body
use strict;
use Net::SNMP;
use Socket;

my $MIB1 = "1.3.6.1.2.1.2.2.1";
my $HOST = "128.128.2.10";
my $COMM = "public";
my $SNMP = 'snmpv2c';

my ($session, $error) = Net::SNMP->session(
        -hostname       => $HOST,
        -version        => $SNMP,
        -community      => $COMM
);
#($value) = &snmpwalk("$COMM\@$HOST","$MIB1");
#if ($value) { print "Results MIB1: $value\n"; }
#else { warn "No response from host $HOST\n"; }

my $result = $session->get_table(
    -baseoid => $MIB1
);

foreach (keys %$result)
{
        print(%$result->{$_} . "\n");
}
# Run this with | more