Telegraf SNMP trap plugin: Traps received with default MIBs only, but OIDs resolve only when custom MIBs are added

Hi,
I’m using Telegraf 1.34-alpine on Kubernetes with the snmp_trap input plugin. MIBs are mounted via a ConfigMap at runtime, and traps are sent to a Kubernetes Service on UDP port 7200.

Here’s the behavior I’m seeing:

  • With only the default MIBs (no MIBS/MIBDIRS env set):

    1. SNMP traps are received and logged
    2. OIDs are not resolved — errors like: Error resolving OID oid=.1.3.6.1.x.x, source=…: not found
  • When I add custom MIBs and set MIBS=ALL, MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs_custom:

    1. OID resolution works inside the pod using snmptranslate
    2. But Telegraf logs no indication of traps being received after a Helm upgrade

Only one pod runs at a time, and traps are sent to the Service, not a Pod IP. The goal is to have Telegraf receive traps consistently and resolve OIDs using both default and custom MIBs together.

Any help to get both working at the same time would be appreciated!

Thanks!

@shrsth Welcome to Influxdata community!

Try this configuration approach that often resolves the issue:

# In your ConfigMap/Deployment
env:
- name: MIBDIRS
  value: "/usr/share/snmp/mibs:/usr/share/snmp/mibs_custom"
- name: MIBS
  value: "+ALL"  # Add custom MIBs to defaults rather than replacing

Or be more selective:

env:
- name: MIBDIRS
  value: "/usr/share/snmp/mibs:/usr/share/snmp/mibs_custom"
- name: MIBS
  value: "SNMPv2-MIB:IF-MIB:YOUR-CUSTOM-MIB-NAME"

Telegraf config:

[[inputs.snmp_trap]]
  service_address = "udp://:7200"
  timeout = "5s"
  version = "2c"
  
  # Optional: Add community string if needed
  # community = "public"

The key is avoiding MIB conflicts while ensuring the UDP listener starts correctly. Try the selective MIB loading first, then gradually add more MIBs while monitoring the logs for any loading errors.