hi dave,
ok, here is a packet trace with the script asking twice for .1.3.6.1.4.1.9.5.1.4.1.1.6.1.1:
Source Destination Protocol Info 140.107.74.123 [...].50.5 SNMP GET iso.3.6.1.4.1.9.5.1.4.1.1.6.1.1 140.107.50.5 [...].74.123 SNMP RESPONSE iso.3.6.1.4.1.9.5.1.4.1.1.6.1.1 140.107.74.123 [...].50.5 SNMP GET iso.3.6.1.4.1.9.5.1.4.1.1.6.1.1 140.107.50.5 [...].74.123 SNMP RESPONSE iso.3.6.1.4.1.9.5.1.4.1.1.6.1.1
success!
and here is a packet trace with the script asking twice for: portOperStatus.99:
Source Destination Protocol Info 140.107.74.123 140.107.50.5 SNMP GET iso.3.6.1.4.1.9.5.1.4.1.1.6.99 140.107.50.5 140.107.74.123 SNMP RESPONSE iso.3.6.1.4.1.9.5.1.4.1.1.6.99 140.107.74.123 140.107.50.5 SNMP GET iso.3.6.1.4.1.9.5.1.4.1.1.6.99 140.107.50.5 140.107.74.123 SNMP RESPONSE iso.3.6.1.4.1.9.5.1.4.1.1.6.99
in this case, the contents of the SNMP RESPONSE is NOSUCHOBJECT, of course.
here are the results of a command-line effort:
guru> snmptranslate -On -IR portOperStatus .1.3.6.1.4.1.9.5.1.4.1.1.6 guru> snmptranslate -On -IR portOperStatus.1 .1.3.6.1.4.1.9.5.1.4.1.1.6.1 guru> snmptranslate -On -IR portOperStatus.1.1 .1.3.6.1.4.1.9.5.1.4.1.1.6.1.1 guru> snmptranslate -On -IR portOperStatus.99 Unknown object identifier: portOperStatus.99 guru> snmptranslate -V NET-SNMP version: 5.1.2.rc2 guru>
ahh, hang on a minute. i asked for "portOperStatus.99" in the above trace ... i should have been asking for "portOperStatus.1.99" ... ok, let's do this:
ErrorStr = Error building ASN.1 representation (Can't build OID for variable)
Warning: Unable to retrieve portOperStatus.1.99 from j4-test-esx: Error building ASN.1 representation (Can't build OID for variable)
so i don't see any SNMP GETs on the wire ... but the script emits the error i copy above. right, you suggested this would happen.
how about the command-line tool?
guru> snmptranslate -On -IR portOperStatus.1.99 .1.3.6.1.4.1.9.5.1.4.1.1.6.1.99 guru>
ok, so the command-line tool has no problem translating.
ok, so, from this data, i suspect that you would lean towarda MIB OID translation issue. how about a little more digging ...
guru> cat test #!/opt/local/bin/perl use strict; use warnings; use SNMP; my $obj = "portOperStatus.1.1"; my $oid = SNMP::translateObj($obj); print "oid = $oid\n";
guru> ./test oid = .1.3.6.1.4.1.9.5.1.4.1.1.6.1.1 guru>
now, wait a minute. why does the simple case work?
guru> cat test #!/opt/local/bin/perl use strict; use warnings; use SNMP; my $obj = "portOperStatus.1.99"; my $oid = SNMP::translateObj($obj); print "oid = $oid\n"; guru> ./test oid = .1.3.6.1.4.1.9.5.1.4.1.1.6.1.99 guru>
ok, my real script includes explicit MIB loading ... let's add that, see if it makes a difference:
guru> cat test
#!/opt/local/bin/perl
use strict;
use warnings;
use SNMP;
SNMP::initMib();
SNMP::addMibDirs("/opt/local/share/snmp/mibs");
my $obj = "portOperStatus.1.99";
my $oid = SNMP::translateObj($obj);
print "oid = $oid\n";guru> ./test oid = .1.3.6.1.4.1.9.5.1.4.1.1.6.1.99 guru>
nope, still works.
hmmm, ok, let's go back to my script, turn on debug mode:
[...] Entering main::uplink_status About to issue an snmpget for portOperStatus.1.1 Entering FHCRC::VDOPS::Netops::snmpGet [...] obj = portOperStatus.1.1 val = NOSUCHOBJECT ErrorStr = Leaving FHCRC::VDOPS::Netops::snmpGet [...] Entering main::uplink_status About to issue an snmpget for portOperStatus.1.2 Entering FHCRC::VDOPS::Netops::snmpGet [...] obj = portOperStatus.1.2 val = NOSUCHOBJECT ErrorStr = Leaving FHCRC::VDOPS::Netops::snmpGet
and from the packet trace:
Source Destination Protocol Info 140.107.74.123 140.107.50.5 SNMP GET ccitt.1 140.107.50.5 140.107.74.123 SNMP RESPONSE ccitt.1 140.107.74.123 140.107.50.5 SNMP GET ccitt.2 140.107.50.5 140.107.74.123 SNMP RESPONSE ccitt.2
alright, let's make a simple test script:
vishnu> cat test #!/opt/local/bin/perl use strict; use warnings; use SNMP;
my ($obj, $oid, $sess, $val); $obj = "portOperStatus.1.1"; $oid = SNMP::translateObj($obj); print "oid = $oid\n";
$sess = new SNMP::Session ( Community => "public",
DestHost => "test-esx",
RemotePort => "161",
Retries => "3",
Timeout => "1000000",
Version => "2"
);$val = $sess->get($obj);
print "val = $val\n";
print "ErrorStr = $sess->{ErrorStr}\n";
guru> ./test
oid = .1.3.6.1.4.1.9.5.1.4.1.1.6.1.1
val = NOSUCHOBJECT
ErrorStr =
guru>and the packet trace:
Source Destination Protocol Info 140.107.74.123 140.107.50.5 SNMP GET ccitt.1 140.107.50.5 140.107.74.123 SNMP RESPONSE ccitt.1
ok, i'm having trouble figuring out where to turn next. i'm going to hit send, chew on this some more, and look forward to reading your comments.
just-in-case-this-helps ... here is how i remove a previous version of net-snmp, before installing a new one (i've been toggling between net-5.0.9, which works and which i use in production, and net-snmp-5.1.2.whatever, in order to produce the output i've been sharing with you):
guru> cd /opt/local/lib guru> rm libnetsnmp* guru> cd ../bin guru> rm snmp* guru> cd ../include guru> rm -rf net-snmp guru> cd ../lib/perl5/site*/5*/i686* guru> rm -rf SNMP* NetSNMP* guru> cd auto guru> rm -rf SNMP* NetSNMP* guru> cd Bundle guru> rm -rf NetSNMP* guru> cd ../../../../.. guru> pwd /opt/local/lib/perl5 guru> find . | grep -i snmp ./site_perl/FHCRC/VDOPS/SNMPTools.pm guru>
--sk
On Mon, 2 Aug 2004, Dave Shield wrote:
here is a snippet from the ethereal trace, taken running my script as designed:
Source Destination Protocol Info 140.107.74.123 140.107.50.5 SNMP GET ccitt.1 140.107.50.5 140.107.74.123 SNMP RESPONSE ccitt.1 140.107.74.123 140.107.50.5 SNMP GET ccitt.2 140.107.50.5 140.107.74.123 SNMP RESPONSE ccitt.2
this of course is the same behavior i saw under 5.1.2pre2.
and here is a snippet taken when running my script as modified in the way you suggested, i.e. asking for ".1.3.6.1.4.1.9.5.1.4.1.1.6.1.99" instead of "portOperStatus.1" and "portOperStatus.2".
Source Destination Protocol Info 140.107.74.123 140.107.50.5 SNMP GET iso.3.6.1.4.1.9.5.1.4.1.1.6.1.99<etc>
Hmmm.... Ok - can you please try asking for ".1.3.6.1.4.1.9.5.1.4.1.1.6.1" (i.e. the numeric version of portOperStatus.1) and "portOperStatus.99"
If you see a successful request for the first, followed by a request for "ccitt.99" (or a failure to build the request at all) then that would definitely point the finger at the MIB OID translation. Otherwise we'll have to look elsewhere....
Dave
------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ Net-snmp-users mailing list [EMAIL PROTECTED] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
