Net-snmp load a third-party MIB Library
. Netcc ++ C # Unix
The MIB file we downloaded may be suffixed with. MIB. For clarity, you may need to change the name. It is generally changed to mib_name.txt.
For example,/usr/share/snmp/mibs/IP-MIB.txt contains the following line
IP-MIB definitions: = begin
The specific definition of this mib_name is the first row in the MIB file that contains definitions. The word before definitions is mib_name.
However, the name of this MIB file is not important. It is important to include the "module" name defined in the definitions line.
Some documents on the Internet say that adding a new MIB file is to copy the MIB file to '/usr/share/snmp/mibs/'. In fact, this is not correct!
First, copy the MIB file to '/usr/share/snmp/mibs /'.
However, in the past, the light copy operation did not take effect. 'snmpget' will not automatically load all MIB files in the/usr/share/snmp/mibs/directory!
If the MIB file cannot be correctly loaded, an error such as "unknown object identifier" will occur.
Therefore, after the MIB file is copied to '/usr/share/snmp/mibs/', you need to modify/usr/share/snmp. conf and add the following line:
Mibfile/usr/share/snmp/mibs/DS11INTEG-MIB.txt
Or
Mibs + DS11INTEG-MIB
Alternatively, you can enter
# Export mibs = all
In this way, we can reference the newly added MIB file. For example:
# Snmpget-V1-C public 192.168.49.253 BREEZECOM-DOT11EXT-MIB: roamquality.1
BREEZECOM-DOT11EXT-MIB: roamquality.1 = integer: 3
Alternatively
# Snmpget-V1-C public 192.168.49.253 roamquality.1
BREEZECOM-DOT11EXT-MIB: roamquality.1 = integer: 3
Use the 'snmptranslate' command to obtain the oId value corresponding to a text item.
# Snmptranslate-on BREEZECOM-DOT11EXT-MIB: roamquality
. 1.3.6.1.4.1.710.7.1.5.1.23.1.7
You can also use the 'snmptranslate' command to query a specified object.
# Snmptranslate-IR roamquality
BREEZECOM-DOT11EXT-MIB: roamquality
You can also use the snmptranslate command to convert the oId into a text description.
# 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
You can also use the snmptranslate command to obtain all the details of an object from the MIB file.
# 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 specified ed beacons of the BSS and depends
On the selected quality indicator. the semantics of
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 useful command is snmpwalk.
# Snmpwalk-V1-C public 192.168.49.253 dot11counterstable
IEEE802dot11-MIB: dot11transmittedfragmentcount. 1 = integer: 122172497
: 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: dot111_edfragmentcount. 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 that when using the snmpget command, you must add. 0 or. 1 at the end of the oId to be queried. Otherwise, an error will be reported.
# 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
In Unix systems, the system is case sensitive. Therefore, do not write an error when writing an oId.