This is a tutorial with examples on how to use 'Net-snmp' on Linux to query network devices. Figuring out all this was a time consuming and frustrating experience. As with a lot of things, it all seems obvious once you know how it works. I hope this will simplify getting to know the important commands for you. Another good tutorial is here. I used the MIB for the 'BreezeCOM DS.11 point-to-point Wireless Link' in these examples. First, I had to correct problems with time-stamps in the MIB file, after getting these errors: Bad month in timestamp (0000030000Z): At line 24 in /usr/share/snmp/mibs/DS11INTEG-MIB.txt Bad month in timestamp (0000030000Z): At line 118 in /usr/share/snmp/mibs/DS11INTEG-MIB.txt Bad month in timestamp (9900030000Z): At line 1217 in /usr/share/snmp/mibs/DS11INTEG-MIB.txt To fix the error in line 24, I changed: LAST-UPDATED "0000030000Z" To: LAST-UPDATED "0001030000Z" presumably the format is 'yymmddhhmm'. Also, I had this problem: # snmpget -v1 -c public 192.168.49.253 dot11FCSErrorCount.1 IEEE802dot11-MIB::dot11FCSErrorCount.1 = Wrong Type (should be Counter32): INTEGER: 831199 # snmptranslate -Td IEEE802dot11-MIB::dot11FCSErrorCount IEEE802dot11-MIB::dot11FCSErrorCount dot11FCSErrorCount OBJECT-TYPE -- FROM IEEE802dot11-MIB SYNTAX Counter32 MAX-ACCESS read-only STATUS current DESCRIPTION "This counter shall increment when an FCS error is detected in a received MPDU." So I edited the mib and changed 'Counter32' to 'Integer32', which seemed to fix it: # snmpget -v1 -c public 192.168.49.253 dot11FCSErrorCount.1 IEEE802dot11-MIB::dot11FCSErrorCount.1 = INTEGER: 831202 When I have more time, I will read this. ### Using textual object identifiers ### Adding a new mib file is NOT as simple as just copying it into '/usr/share/snmp/mibs/' 'snmpget' does not automatically load all the mibs in from that directory. If the correct mib is not loaded, you get errors like "Unknown Object Identifier". The name of the file containing the mib is NOT important or relavent. You need to look in the file for the DEFINITIONS lines, and get the word immediately before it. This is then the name of the mib 'Module'. For example: # cat /usr/share/snmp/mibs/DS11INTEG-MIB.txt | grep DEFINITIONS | awk '{print $1}' BREEZECOM-GLOBAL-REG BREEZECOM-DOT11EXT-MIB BREEZECOM-SNMPGEN-MIB IEEE802dot11-MIB You then need to force the reading of all mibs like this: # export MIBS=ALL Or, alternatively, create '/usr/share/snmp/snmp.conf' and add this line: mibfile /usr/share/snmp/mibs/DS11INTEG-MIB.txt Then use the module name as follows: # snmpget -v1 -c public 192.168.49.253 BREEZECOM-DOT11EXT-MIB::roamQuality.1 BREEZECOM-DOT11EXT-MIB::roamQuality.1 = INTEGER: 3 This should also then work: # snmpget -v1 -c public 192.168.49.253 roamQuality.1 BREEZECOM-DOT11EXT-MIB::roamQuality.1 = INTEGER: 3 Use 'snmptranslate' to get the OID: # snmptranslate -On BREEZECOM-DOT11EXT-MIB::roamQuality .1.3.6.1.4.1.710.7.1.5.1.23.1.7 You can find the module for a given object, using a random access lookup: # snmptranslate -IR roamQuality BREEZECOM-DOT11EXT-MIB::roamQuality Combining the previous two examples: # snmptranslate -IR -On roamQuality .1.3.6.1.4.1.710.7.1.5.1.23.1.7 To convert from numeric to textual, use this: # snmptranslate .1.2.840.10036.2.2.1.12 IEEE802dot11-MIB::dot11FCSErrorCount # snmptranslate -Of .1.2.840.10036.2.2.1.12 .iso.member-body.us.ieee802dot11.dot11mac.dot11CountersTable.dot11CountersEntry.dot11FCSErrorCount To get full details from the mib, on an object: # snmptranslate -Td BREEZECOM-DOT11EXT-MIB:roamQuality BREEZECOM-DOT11EXT-MIB::roamQuality roamQuality OBJECT-TYPE -- FROM BREEZECOM-DOT11EXT-MIB SYNTAX Integer32 MAX-ACCESS read-only STATUS current DESCRIPTION "An indicator for the quality of the BSS. The quality is calculated over the received Beacons of the BSS and depends on the selected quality indicator. The semantics of the indicator is 'low is good quality' and 'high is bad quality'." ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) breezeCOM(710) ds11Products(7) dot11ExtMIB(1) dot11ExtWBUObjs(5) roam(1) roamTable(23) roamEntry(1) 7 } Another usefuls command is 'snmpwalk': # snmpwalk -v1 -c public 192.168.49.253 dot11CountersTable IEEE802dot11-MIB::dot11TransmittedFragmentCount.1 = INTEGER: 122172497 IEEE802dot11-MIB::dot11MulticastTransmittedFrameCount.1 = INTEGER: 45242 IEEE802dot11-MIB::dot11FailedCount.1 = INTEGER: 4009 IEEE802dot11-MIB::dot11RetryCount.1 = INTEGER: 1601483 IEEE802dot11-MIB::dot11MultipleRetryCount.1 = INTEGER: 885859 IEEE802dot11-MIB::dot11FrameDuplicateCount.1 = INTEGER: 543281 IEEE802dot11-MIB::dot11RTSSuccessCount.1 = INTEGER: 0 IEEE802dot11-MIB::dot11RTSFailureCount.1 = INTEGER: 0 IEEE802dot11-MIB::dot11ACKFailureCount.1 = INTEGER: 3971754 IEEE802dot11-MIB::dot11ReceivedFragmentCount.1 = INTEGER: 108826417 IEEE802dot11-MIB::dot11MulticastReceivedFrameCount.1 = INTEGER: 31359 IEEE802dot11-MIB::dot11FCSErrorCount.1 = INTEGER: 831325 IEEE802dot11-MIB::dot11TransmittedFrameCount.1 = INTEGER: 122156588 IEEE802dot11-MIB::dot11WEPUndecryptableCount.1 = INTEGER: 0 Note when using 'snmpget', you may need to append a .0 or a .1 to the OID, or you may get this problem: # snmpget -v1 -c public 192.168.49.253 dot11ACKfailureCount Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: IEEE802dot11-MIB::dot11ACKFailureCount # snmpget -v1 -c public 192.168.49.253 dot11ACKFailureCount.1 IEEE802dot11-MIB::dot11ACKFailureCount.1 = INTEGER: 3971912 Also note that the textual form is 'Case-Sensitive', as expected on a unix type system. So if you use 'failure' instead of 'Failure', it fails! # snmpget -v1 -c public 192.168.49.253 dot11ACKfailureCount.1 dot11ACKfailureCount.1: Unknown Object Identifier (Sub-id not found: (top) -> dot11ACKfailureCount) Note, these examples were done with the following system configuration: # rpm -qa | grep nmp net-snmp-5.0.6-8.80.2 net-snmp-utils-5.0.6-8.80.2 # cat /etc/redhat-release Red Hat Linux release 8.0 (Psyche) Nigel Smith 2004-10-01
| Home | Hints & Tips |