IPv6Freely has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, I'm also using an OID that will display the number of interfaces on the switch. When I run the script as is, it works, and the number "53" is output (and is correct). However, if I comment the working line, and uncomment the other line, the script fails with the message:#!/usr/bin/perl use Net::SNMP; my $host = "192.168.0.49"; my $community = "eX0gyN37"; my ($snmp,$snmperror) = Net::SNMP->session( -hostname => $host, -community => $community ); # hostname OID (this line doesnt work) # my $OID = "1.3.6.1.4.1.9.2.1.3"; # number of interfaces OID (this line works) my $OID = "1.3.6.1.2.1.2.1.0"; my $result = $snmp->get_request ( $OID ) or die "FAIL: $! \n"; print $result->{$OID} . "\n";
FAIL: Transport endpoint is not connected
I am sure that the nonworking OID is correct, as you can see from the following result on the command line.
What am I doing wrong? Why does the script work for one OID and not the other? The one and only difference I can see immediately is that the non-working OID has a "STRING" result on the command line, as opposed to the working "INTEGER" OID. Any suggestions? Thanks!$ snmpwalk -v2c -c eX0gyN37 192.168.0.49 1.3.6.1.2.1.2.1.0 IF-MIB::ifNumber.0 = INTEGER: 53 $ snmpwalk -v2c -c eX0gyN37 192.168.0.49 1.3.6.1.4.1.9.2.1.3 SNMPv2-SMI::enterprises.9.2.1.3.0 = STRING: "sw-studentcenter-basement +-1"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SNMP Error using Net::SNMP - Transport endpoint is not connected
by NetWallah (Canon) on Apr 07, 2008 at 23:16 UTC | |
by Anonymous Monk on Apr 10, 2008 at 20:34 UTC | |
by glide (Pilgrim) on Apr 08, 2008 at 14:35 UTC | |
|
Re: SNMP Error using Net::SNMP - Transport endpoint is not connected
by arc_of_descent (Hermit) on Apr 07, 2008 at 22:17 UTC |