-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior
Description
Relevant telegraf.conf
# [...]
# Retrieves SNMP values from remote agents
[[inputs.snmp]]
agents = ["tcp://127.0.0.1:10002"]
# [...]
Logs from Telegraf
2025-07-18T09:20:00Z E! [inputs.snmp] Error in plugin: agent tcp://127.1.0.0:10002: performing get on field XXX: recover: runtime error: invalid memory address or nil pointer dereference Stack:goroutine 565 [running]:
github.com/gosnmp/gosnmp.(*GoSNMP).send.func1()
gosnmp@v1.41.0/marshal.go:437 +0x65
panic({0x8ce38c0?, 0x112e1a70?})
toolchain@v0.0.1-go1.24.0.openbsd-amd64/src/runtime/panic.go:787 +0x132
github.com/gosnmp/gosnmp.(*GoSNMP).send(0xc000df62c0, 0xc001635260, 0x1)
gosnmp@v1.41.0/marshal.go:466 +0x20e
github.com/gosnmp/gosnmp.(*GoSNMP).Get(0xc000df62c0, {0xc00166f300, 0x1, 0xc00169c101?})
gosnmp@v1.41.0/gosnmp.go:434 +0x245
github.com/influxdata/telegraf/internal/snmp.Table.Build({{0x9feae3c, 0x4}, {0x0, 0x0, 0x0}, 0x0, {0xc000481808, 0x35, 0x35}, {0x0, ...}, ...}, ...)
telegraf/internal/snmp/table.go:162 +0x5a2
github.com/influxdata/telegraf/plugins/inputs/snmp.(*Snmp).gatherTable(0xc000ffe960, {0xb0740e0, 0xc000b1e240}, {0xb02fb10, 0xc000df62c0}, {{0x9feae3c, 0x4}, {0x0, 0x0, 0x0}, ...}, ...)
telegraf/plugins/inputs/snmp/snmp.go:130 +0x85
github.com/influxdata/telegraf/plugins/inputs/snmp.(*Snmp).Gather.func1(0xc001018fd0?, {0xc00049d1c1, 0x15})
telegraf/plugins/inputs/snmp/snmp.go:112 +0x20b
created by github.com/influxdata/telegraf/plugins/inputs/snmp.(*Snmp).Gather in goroutine 564
telegraf/plugins/inputs/snmp/snmp.go:98 +0x66
System info
telegraf v1.31.3 (but also older versions and oder master; also tested with manually patched version of gosnmp), OpenBSD 7.6, SNMP over TCP
Docker
No response
Steps to reproduce
- Configure SNMP over TCP
- Wait a couple of SNMP requests
- Anytime soon, the server will close the connection during a SNMP GET request
- The Underlying GoSNMP library will dereference a nil pointer and result in a panic
Expected behavior
No panics occur during SNMP over TCP requests.
Actual behavior
Panics occur during SNMP over TCP requests.
Additional info
This GoSNMP Bug was fixed in, gosnmp v1.42.1
[1], see also gosnmp/gosnmp#521.
Metadata
Metadata
Assignees
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior