Generate HUAWEI SNMP Exporter Module
Now that we have the SNMP Exporter Configuration Generator setup, we can try and create custom modules to use in the SNMP Exporter.
For this example, I will create a module for a generic HUAWEI device.
I will need to download a HUAWEI MIB and research which OIDs I should walk/get.
First, navigate to the folder where it will be saved. ie, the ./generator/mibs folder
cd ${GOPATH-$HOME/go}/src/github.com/prometheus/snmp_exporter/generator/mibs
Download the HUAWEI MIB
curl http://www.circitor.fr/Mibs/Mib/H/HUAWEI-MIB.mib > HUAWEI-MIB.mib
View the contents of the folder and it should contain the new file HUAWEI-MIB.mib
ls -lh
Now navigate back one folder into the generator folder
cd ..
And we need to edit the generator.yml and add the information for the Huawei device.
sudo nano ./generator.yml
modules
...
hauwei:
walk:
- 1.3.6.1.2.1.10
- 1.3.6.1.2.1.47
version: 2
auth:
community: public
overrides:
ifType:
type: EnumAsInfo
...
After saving the file, create the variable that bash can use that points to the new mibs folder
export MIBDIRS=mibs
The run the generator to generate a new snmp.yml.
./generator generate
If all is correct, then there will be a new node in the snmp.yml named huawei containing instructions on which OIDs to walk/get and which metrics will be made available for Prometheus.
Useful Links
SNMP Exporter Configuration Generator Repository
Circitor.fr MIB files repository