Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a simple perl program to get cisco device's sysuptime with Net::Snmp module.And it don't work normal.
I use sniffer to get the trace,the trace is like this:
99.140.12.9---send snmp get_request---->99.1.64.65this is my program: #!/usr/bin/perl use strict; use lib '../lib'; use Net::SNMP; my ($session, $error) = Net::SNMP->session( -hostname => '99.1.64.65', -community => '12345', -port => 161 ); if (!defined($session)) { printf("snmp::session ERROR: %s.\n", $error); exit 1; } my $sysUpTime = '1.3.6.1.2.1.1.3.0'; my $result = $session->get_request( $sysUpTime ); if (!defined($result)) { printf("ERROR: %s.\n", $session->error); $session->close; exit 1; } printf("sysUpTime for host '%s' is %s\n", $session->hostname, $result->{$sysUpTime} ); $session->close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strange snmp question
by insaniac (Friar) on Oct 25, 2004 at 08:21 UTC | |
by Anonymous Monk on Oct 25, 2004 at 08:42 UTC | |
by insaniac (Friar) on Oct 25, 2004 at 08:52 UTC | |
|
Re: strange snmp question
by Anonymous Monk on Oct 25, 2004 at 09:33 UTC | |
by insaniac (Friar) on Oct 25, 2004 at 10:13 UTC | |
by Anonymous Monk on Oct 26, 2004 at 01:11 UTC |