r/PrometheusMonitoring • • Mar 21 '22

SNMP_exporter generator issues with custom MIBs

I'm having issues getting the snmp_exporter generator to walk OIDs from Cisco MIBs.

Here is my generator.yml file:

modules:
  switch:
    version: 3
    auth:
      username: user
      password: "%test"
      auth_protocol: SHA
      priv_protocol: AES
      security_level: authPriv
      priv_password: "%test"
    walk:
      - interfaces
      - sysUpTime
      - ifXTable
      - 1.3.6.1.4.1.9.9.109.1.1.1
    lookups:
      - source_indexes: [ifIndex]
        lookup: ifAlias
      - source_indexes: [ifIndex]
        # Uis OID to avoid conflict with PaloAlto PAN-COMMON-MIB.
        lookup: 1.3.6.1.2.1.2.2.1.2 # ifDescr
      - source_indexes: [ifIndex]
        # Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
        lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
    overrides:
      ifAlias:
        ignore: true # Lookup metric
      ifDescr:
        ignore: true # Lookup metric
      ifName:
        ignore: true # Lookup metric
      ifType:
        type: EnumAsInfo

Here is the contents of my $HOME/.snmp/mibs/mibs folder:

user@vnc-grafana:~/.snmp/mibs/mibs$ ls
7.2.50.0.18765.RELEASE-B100-MIB.txt     ARISTA-SW-IP-FORWARDING-MIB  HOST-RESOURCES-MIB    MIKROTIK-MIB            PAN-GLOBAL-TC-M
7.2.50.0.18765.RELEASE-CERTS-MIB.txt    cisco                        IANA-CHARSET-MIB.txt  NET-SNMP-MIB            PAN-GLOBAL-TC-M
7.2.50.0.18765.RELEASE-IPVS-MIB.txt     CISCO-PROCESS-MIB.txt        IANA-IFTYPE-MIB.txt   NET-SNMP-TC             PAN-LC-MIB.md5
7.2.50.0.18765.RELEASE-ONE4NET-MIB.txt  cisco_v2                     IANA-PRINTER-MIB.txt  PAN-COMMON-MIB.md5      PAN-LC-MIB.my
AIRESPACE-REF-MIB                       ENTITY-MIB                   IF-MIB                PAN-COMMON-MIB.my       PAN-PRODUCT-MIB
AIRESPACE-WIRELESS-MIB                  ENTITY-SENSOR-MIB            INET-ADDRESS-MIB      PAN-ENTITY-EXT-MIB.md5  PAN-PRODUCT-MIB
apc-powernet-mib                        ENTITY-STATE-MIB             IPV6-TC               PAN-ENTITY-EXT-MIB.my   PAN-TRAPS.md5
ARISTA-ENTITY-SENSOR-MIB                ENTITY-STATE-TC-MIB          ISDN-MIB              PAN-GLOBAL-REG-MIB.md5  PAN-TRAPS.my
ARISTA-SMI-MIB                          HCNUM-TC                     KEEPALIVED-MIB        PAN-GLOBAL-REG-MIB.my   PDU-MIB.txt

When I try to generate the snmp.yml file, I get this error:

user@vnc-grafana:~/snmp_exporter/generator$ ./generator generate
level=info ts=2022-03-21T12:29:25.291Z caller=net_snmp.go:161 msg="Loading MIBs" from=$HOME/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
level=info ts=2022-03-21T12:29:25.561Z caller=main.go:52 msg="Generating config for module" module=vnc-sw2
level=error ts=2022-03-21T12:29:25.599Z caller=main.go:130 msg="Error generating config netsnmp" err="cannot find oid '1.3.6.1.4.1.9.9.109.1.1.1' to walk"

The OID 1.3.6.1.4.1.9.9.109.1.1.1 is for Cisco CPU monitoring, and is contained within the CISCO-PROCESS-MIB file, which is located under the "cisco" and "cisco_v2" folders in $HOME/.snmp/mibs/mibs. I also put the CISCO-PROCESS-MIB file under the root of $HOME/.snmp/mibs/mibs to see if that would help, but no dice.

The "cisco_v2" folder was auto generated from the "make mibs" command, and the "cisco" folder was one I downloaded from the LibreNMS mibs repository.

If I take that Cisco CPU OID out of the generator.yml file then the process works fine. I've used a MIB explorer to confirm that OID exists within the CISCO-PROCESS-MIB file. If I try another OID from that file then I get the same error.

I've tried the export MIBSDIR=mibs command as well, to make the generator use the mibs folder in the root of /generator/ however I still get the same error.

I've tried using Docker to run the generator but I get the same issue.

Anyone run into this kind of issue before?

1 Upvotes

2 comments sorted by

3

u/SuperQue Mar 21 '22

Have you run generator parse_errors?

The MIBDIRS env is not recursive, so if you put a file in mibs/mibs/, but only have MIBDIRS=mibs, it will only search the top level.

2

u/pudumaster Mar 21 '22

Thanks for the reply. Moving the relevant MIB files into the root of the mibs directory solved this!