How to translate SNMP MIB to OID

In this article, I will show an example of how to translate SNMP MIB to OID.

First, download the necessary MIBs to the server, and also comment out the mibs line in the /etc/snmp/snmp.conf file so that all MIB files are used:

#mibs :

Download a small database of standard MIBs:

sudo apt install snmp-mibs-downloader
sudo download-mibs

For example, at the time of this writing, I needed to find out several OIDs from the HUAWEI-POWER-MIB file, so I saved it to the /usr/share/snmp/mibs/ directory and ran the command:

snmptranslate -IR -On HUAWEI-POWER-MIB::hwBatteryTestResult

Warnings were displayed that some more files were missing:

MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (HUAWEI-ENVIRONMENT-MIB): At line 12 in /usr/share/snmp/mibs/HUAWEI-POWER-MIB.txt
Cannot find module (HUAWEI-MIB): At line 14 in /usr/share/snmp/mibs/HUAWEI-POWER-MIB.txt
Cannot find module (HUAWEI-DEVICE-MIB): At line 20 in /usr/share/snmp/mibs/HUAWEI-POWER-MIB.txt
Cannot find module (HUAWEI-TC-MIB): At line 21 in /usr/share/snmp/mibs/HUAWEI-DEVICE-MIB.txt

I also found them and saved them to the /usr/share/snmp/mibs/ directory.
If I saw a large database of MIB files here:

After that, OIDs began to be displayed successfully:

snmptranslate -IR -On HUAWEI-POWER-MIB::hwBatteryTestResult

snmptranslate -IR -On HUAWEI-POWER-MIB::hwLoadCurrent

snmptranslate -IR -On HUAWEI-POWER-MIB::hwRectifierCurrent

snmptranslate -IR -On HUAWEI-POWER-MIB::hwRectifierVoltage

snmptranslate -IR -On HUAWEI-POWER-MIB::hwRectifierChargeState


See also my other articles:

Leave a comment

Leave a Reply