Hello, I have a questions about snmpget and the (error) return codes. In particular I can get a return code 1 or 2 from the snmpget command depending on whether I load the standard mibs in /usr/local/share/snmp/mibs. I do not know if this intended.
I'll explain Take the IP-MIB and ipAdEntAddr in table ipAddrTable. Doing an snmpget on one of our windows2000 machines with address 192.168.248.11 gives the following result. ==== snmpget -d -v 1 -c public 192.168.248.11 1.3.6.1.2.1.4.20.1.1.192.168.248.11 ; myerror=$? && echo "error = "$myerror Sending 51 bytes to 192.168.248.11 0000: 30 31 02 01 00 04 06 70 75 62 6C 69 63 A0 24 02 01.....public.$. 0016: 04 72 88 18 1D 02 01 00 02 01 00 30 16 30 14 06 .r.........0.0.. 0032: 10 2B 06 01 02 01 04 14 01 01 81 40 81 28 81 78 [EMAIL PROTECTED](.x 0048: 0B 05 00 ... Received 55 bytes from 192.168.248.11 0000: 30 35 02 01 00 04 06 70 75 62 6C 69 63 A2 28 02 05.....public.(. 0016: 04 72 88 18 1D 02 01 00 02 01 00 30 1A 30 18 06 .r.........0.0.. 0032: 10 2B 06 01 02 01 04 14 01 01 81 40 81 28 81 78 [EMAIL PROTECTED](.x 0048: 0B 40 04 C0 A8 F8 0B [EMAIL PROTECTED] IP-MIB::ipAdEntAddr.192.168.248.11 = IpAddress: 192.168.248.11 error = 0 ==== ipAdEntAddr is of type IpAddress and each of the numbers of the address can be in the range 0 to 255. If I replace the last octet with 256 I get ==== snmpget -d -v 1 -c public 192.168.248.11 1.3.6.1.2.1.4.20.1.1.192.168.248.256 ; myerror=$? && echo "error = "$myerror 1.3.6.1.2.1.4.20.1.1.192.168.248.256: Unknown Object Identifier (Index out of range: 256 (ipAdEntAddr)) error = 1 ==== The "error == 1" usually means tooBig, which in a sense is true as 256 is greater than the max allowed value. If I now disable the MIB lookup I get ==== snmpget -m : -d -v 1 -c public 192.168.248.11 1.3.6.1.2.1.4.20.1.1.192.168.248.256 ; myerror=$? && echo "error = "$myerror Sending 52 bytes to 192.168.248.11 0000: 30 32 02 01 00 04 06 70 75 62 6C 69 63 A0 25 02 02.....public.%. 0016: 04 63 51 76 E3 02 01 00 02 01 00 30 17 30 15 06 .cQv.......0.0.. 0032: 11 2B 06 01 02 01 04 14 01 01 81 40 81 28 81 78 [EMAIL PROTECTED](.x 0048: 82 00 05 00 .... Received 52 bytes from 192.168.248.11 0000: 30 32 02 01 00 04 06 70 75 62 6C 69 63 A2 25 02 02.....public.%. 0016: 04 63 51 76 E3 02 01 02 02 01 01 30 17 30 15 06 .cQv.......0.0.. 0032: 11 2B 06 01 02 01 04 14 01 01 81 40 81 28 81 78 [EMAIL PROTECTED](.x 0048: 82 00 05 00 .... Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: iso.3.6.1.2.1.4.20.1.1.192.168.248.256 error = 2 ==== This is what I would expect, error == 2, noSuchName, as the OID is not present. thanks & regards Mark Naylor. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users