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:
https://circitor.fr/Mibs/Mib/H/HUAWEI-POWER-MIB.mib
https://circitor.fr/Mibs/Mibs.php

After that, OIDs began to be displayed successfully:

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

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

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

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

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

...

See also my other articles:
SNMP MIBs and OIDs

Leave a comment

Leave a Reply