tolyan77 has asked for the wisdom of the Perl Monks concerning the following question:
Please help me out. thanks in advance.#!/usr/bin/perl use Net::SNMP; my @ips=(11,21); foreach my $k (@ips) { my $hostname = "10.0.0.$k"; my $password = "public"; my $sysUpTime = "1.3.6.1.2.1.1.3"; my $sysName = "1.3.6.1.2.1.1.5"; my $prtCoverStatus = "1.3.6.1.2.1.43.6.1.1.3"; my $ObjectID1, $ObjectID2 ; my $status; my ( $session, $error ) = Net::SNMP->session ( Hostname => $hostname, + Community => $password ); die "session error: $error" unless ( $session ); $ObjectID1 = $sysName; $result = $session->get_next_request ( varbindlist => [$ObjectID1] ); die "request error: ".$session->error unless ( defined $result ); $ObjectID1 = $sysName; ( $ObjectID1, $name ) = each %$result; unless ( $ObjectID1 =~ /$sysName(.*)/ ) { last; } $ObjectID2 = $prtCoverStatus.$1; $result = $session->get_request ( varbindlist => [$ObjectID2] ); die "request error: ".$session->error unless ( defined $result ); #request error: Received noSuchName(2) error-status at error-index 1 a +t status.pl ... $CoverStatus = "$result->{$ObjectID2}"; $session->close; }
2006-10-09 Retitled by Arunbear, as per Monastery guidelines
Original title: 'net::snmp'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Where is the bug in this Net::SNMP code?
by monarch (Priest) on Oct 09, 2006 at 13:46 UTC | |
by tolyan77 (Novice) on Oct 10, 2006 at 08:42 UTC | |
by tolyan77 (Novice) on Oct 10, 2006 at 10:13 UTC | |
by monarch (Priest) on Oct 10, 2006 at 11:52 UTC | |
by tolyan77 (Novice) on Oct 10, 2006 at 12:09 UTC | |
by tolyan77 (Novice) on Nov 04, 2006 at 12:19 UTC | |
|
Re: Where is the bug in this Net::SNMP code?
by shmem (Chancellor) on Oct 09, 2006 at 12:06 UTC | |
by tolyan77 (Novice) on Oct 09, 2006 at 13:53 UTC |