influxdata / influxdata/telegraf
gosmi translator fails to initialize snmp_trap plugin with large MIB collections containing syntax errors
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
### Relevant telegraf.conf
```toml
[global_tags]
type = "snmpTrap"
[agent]
interval = "15s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
snmp_translator = "gosmi" # Fails with gosmi, works with netsnmp
logfile = ""
debug = true
quiet = false
hostname = "$HOSTNAME"
omit_hostname = false
[inputs]
[inputs.internal]
collect_memstats = true
[inputs.snmp_trap]
auth_password = "${AUTH_PASSWORD}"
auth_protocol = "SHA"
path = ["/usr/share/snmp/mibs", "/mibs"]
priv_password = "${PRIV_PASSWORD}"
priv_protocol = "AES"
sec_level = "authPriv"
sec_name = "stingertraps"
service_address = "udp://:162"
version = "3"
[inputs.snmp_trap.tags]
severity = "critical"
```
### Logs from Telegraf
```text
2026-01-16T00:07:13Z I! Starting Telegraf 1.37.0 brought to you by InfluxData the makers of InfluxDB
2026-01-16T00:07:13Z I! Available plugins: 243 inputs, 9 aggregators, 35 processors, 26 parsers, 67 outputs, 8 secret-stores
2026-01-16T00:07:13Z I! Loaded inputs: internal snmp_trap
2026-01-16T00:07:13Z I! Loaded aggregators:
2026-01-16T00:07:13Z I! Loaded processors: lookup
2026-01-16T00:07:13Z I! Loaded secretstores:
2026-01-16T00:07:13Z I! Loaded outputs: file health prometheus_client
2026-01-16T00:07:13Z I! Tags enabled: host=8721d5f47c50 type=snmpTrap
2026-01-16T00:07:13Z I! [agent] Config: Interval:15s, Quiet:false, Hostname:"8721d5f47c50", Flush Interval:10s
2026-01-16T00:07:13Z W! [agent] The default value of 'skip_processors_after_aggregators' will change to 'true' with Telegraf v1.40.0! If you need the current default behavior, please explicitly set the option to 'false'!
2026-01-16T00:07:13Z D! [agent] Initializing plugins
```
### System info
Telegraf 1.37.0 (git: HEAD@f80cc596)
### Docker
telegraf-snmptrap:
image: hub.docker.internal.cba/telegraf:1.37.0
profiles: ["core"]
environment:
- MIMIR_BASE_URL=http://mimir:9009
ports:
- "162:162/udp"
networks:
- management
env_file:
- "./docker/telegraf_snmptrap/.env"
volumes:
- "./docker/telegraf_snmptrap/:/etc/telegraf/:ro"
- "./mibs:/mibs:ro"
command: ["--debug", "--config-directory", "/etc/telegraf/"]
### Steps to reproduce
1. Set up a large MIB collection (1689+ .my files) containing [Cisco MIBs](https://github.com/cisco/cisco-mibs/tree/main/v2) with various syntax issues
2. Configure snmp_trap input with snmp_translator = "gosmi"
3. Start Telegraf
### Expected behavior
Telegraf should start successfully and listen for SNMP traps, gracefully handling MIB files with syntax errors **(similar to netsnmp behavior).**
Can confirm if changing the snmp_translator to netsnmp telegraf starts successfully.
### Actual behavior
Telegraf hangs indefinitely at "Initializing plugins" and never completes startup. The process must be killed and restarted.
### Additional info
Total MIB files: 1,689 .my files
Source: Cisco MIB collection with various versions and modules
Known problematic MIBs: Multiple files with syntax errors, including:
Files with multiple DEFINITIONS ::= BEGIN statements
Files with parsing errors (unexpected tokens, missing dependencies)
Files with ASN.1 syntax issues
Contributor guide
Research direction
Reproduce the hang with the supplied telegraf.conf, the snmp_trap input, gosmi, and the large Cisco MIB collection. Start by tracing snmp_trap initialization and gosmi MIB parsing, focusing on how syntax errors are handled. Done means Telegraf completes startup and listens for SNMP traps without hanging, while malformed MIBs are handled like the netsnmp path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100