Can you reproduce the panic using "curl" to send a request, as per my 
example?  Maybe it's something about the way prometheus is talking to 
snmp_exporter.

Here is your backtrace, reformatted so that it's readable.  It looks to me 
like the pointer *GoSNMP is null.

error getting target 10.17.125.48: recover: runtime error: invalid memory 
address or nil pointer dereference
Stack:goroutine 177 [running]:
github.com/gosnmp/gosnmp.(*GoSNMP).send.func1(0xc0003195c8)
/go/pkg/mod/github.com/gosnmp/[email protected]/marshal.go:326 +0xa5
panic(0x9e4880, 0xe89790)
/usr/local/go/src/runtime/panic.go:969 +0x1b9
github.com/gosnmp/gosnmp.(*GoSNMP).send(0xc0000da900, 0xc0001e82a0, 
0xc000bd0101, 0x0, 0xb34ee0, 0xc000c0a020)
/go/pkg/mod/github.com/gosnmp/[email protected]/marshal.go:372 +0x20e
github.com/gosnmp/gosnmp.(*GoSNMP).Get(0xc0000da900, 0xc000c70b60, 0x2, 
0x2, 0x0, 0x0, 0xc000c3c1b0)
/go/pkg/mod/github.com/gosnmp/[email protected]/gosnmp.go:363 +0x159
main.ScrapeTarget(0xb40660, 0xc00043a200, 0xc00034201c, 0xc, 0xc0001912c0, 
0xb34f40, 0xc0003b9e00, 0x0, 0x0, 0x0, ...)
/app/collector.go:133 +0x5be
main.collector.Collect(0xb40660, 0xc00043a200, 0xc00034201c, 0xc, 
0xc0001912c0, 0xb34f40, 0xc0003b9e00, 0xc0000bf140)
/app/collector.go:222 +0xbc
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:446 
+0x1a2
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:457 
+0x5ce

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x7f6b76821eb8, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc000bdc018, 0x72, 0x0, 0x0, 0xa85b68)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Accept(0xc000bdc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:394 +0x1fc
net.(*netFD).accept(0xc000bdc000, 0xc5c19e3f0727fe93, 0x0, 0x0)
/usr/local/go/src/net/fd_unix.go:172 +0x45
net.(*TCPListener).accept(0xc000bc8300, 0x612e0785, 0xc00050fad0, 0x48e3a6)
/usr/local/go/src/net/tcpsock_posix.go:139 +0x32
net.(*TCPListener).Accept(0xc000bc8300, 0xc00050fb20, 0x18, 0xc000000180, 
0x7f8dec)
/usr/local/go/src/net/tcpsock.go:261 +0x65
net/http.(*Server).Serve(0xc000bda000, 0xb3ee20, 0xc000bc8300, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2937 +0x266
github.com/prometheus/exporter-toolkit/web.Serve(0xb3ee20, 0xc000bc8300, 
0xc000bda000, 0x0, 0x0, 0xb34f40, 0xc0002343c0, 0x0, 0xe0)
/go/pkg/mod/github.com/prometheus/[email protected]/web/tls_config.go:192 
+0x1b0
github.com/prometheus/exporter-toolkit/web.ListenAndServe(0xc000bda000, 
0x0, 0x0, 0xb34f40, 0xc0002343c0, 0x0, 0x0)
/go/pkg/mod/github.com/prometheus/[email protected]/web/tls_config.go:184 
+0xfd
main.main()
/app/main.go:248 +0xb71

goroutine 32 [syscall, 1 minutes]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:147 +0x9d
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:23 +0x25
created by os/signal.Notify.func1.1
/usr/local/go/src/os/signal/signal.go:150 +0x45

goroutine 49 [select, 1 minutes]:
main.main.func1(0xc0000be1e0, 0xb34f40, 0xc0002343c0)
/app/main.go:179 +0xe5
created by main.main
/app/main.go:177 +0x7ce

goroutine 53 [select]:
github.com/prometheus/client_golang/prometheus.(*Registry).Gather(0xc0009b01e0, 
0x0, 0x0, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:513 
+0xbbc
github.com/prometheus/client_golang/prometheus/promhttp.HandlerFor.func1(0xb3f0a0,
 
0xc0003500e0, 0xc000571a00)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/http.go:126
 
+0x99
net/http.HandlerFunc.ServeHTTP(0xc00080e460, 0xb3f0a0, 0xc0003500e0, 
0xc000571a00)
/usr/local/go/src/net/http/server.go:2042 +0x44
main.handler(0xb3f0a0, 0xc0003500e0, 0xc000571a00, 0xb34f40, 0xc0002343c0)
/app/main.go:110 +0x6d7
main.main.func2(0xb3f0a0, 0xc0003500e0, 0xc000571a00)
/app/main.go:201 +0x51
net/http.HandlerFunc.ServeHTTP(0xc000bc82a0, 0xb3f0a0, 0xc0003500e0, 
0xc000571a00)
/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0xea0040, 0xb3f0a0, 0xc0003500e0, 
0xc000571a00)
/usr/local/go/src/net/http/server.go:2417 +0x1ad
net/http.serverHandler.ServeHTTP(0xc000bda000, 0xb3f0a0, 0xc0003500e0, 
0xc000571a00)
/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000230500, 0xb40660, 0xc000bd2180)
/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2969 +0x36c

goroutine 262 [IO wait]:
internal/poll.runtime_pollWait(0x7f6b76821208, 0x72, 0xb36220)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc000b6e318, 0x72, 0xb36200, 0xe444f0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000b6e300, 0xc0002a8000, 0xffff, 0xffff, 0x0, 
0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:159 +0x1a5
net.(*netFD).Read(0xc000b6e300, 0xc0002a8000, 0xffff, 0xffff, 0x9bd360, 
0x38, 0x40)
/usr/local/go/src/net/fd_posix.go:55 +0x4f
net.(*conn).Read(0xc0004c0010, 0xc0002a8000, 0xffff, 0xffff, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:182 +0x8e
github.com/gosnmp/gosnmp.(*GoSNMP).receive(0xc000bbe000, 0xc000c600c0, 
0x38, 0x40, 0x38, 0x0)
/go/pkg/mod/github.com/gosnmp/[email protected]/marshal.go:1149 +0x58
github.com/gosnmp/gosnmp.(*GoSNMP).sendOneRequest(0xc000bbe000, 
0xc000a00620, 0xc0001f9501, 0x40e2b8, 0xe0, 0xa703c0)
/go/pkg/mod/github.com/gosnmp/[email protected]/marshal.go:223 +0x437
github.com/gosnmp/gosnmp.(*GoSNMP).send(0xc000bbe000, 0xc000a00620, 
0xc00090e101, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/gosnmp/[email protected]/marshal.go:349 +0xf1
github.com/gosnmp/gosnmp.(*GoSNMP).Get(0xc000bbe000, 0xc0004937c0, 0x2, 
0x2, 0x0, 0x0, 0xc00058e3c0)
/go/pkg/mod/github.com/gosnmp/[email protected]/gosnmp.go:363 +0x159
main.ScrapeTarget(0xb40660, 0xc0007de000, 0xc00034205c, 0xd, 0xc000190870, 
0xb34f40, 0xc00058e090, 0x0, 0x0, 0x0, ...)
/app/collector.go:133 +0x5be
main.collector.Collect(0xb40660, 0xc0007de000, 0xc00034205c, 0xd, 
0xc000190870, 0xb34f40, 0xc00058e090, 0xc0006940c0)
/app/collector.go:222 +0xbc
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:446 
+0x1a2
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:457 
+0x5ce

goroutine 37 [select]:
github.com/prometheus/client_golang/prometheus.(*Registry).Gather(0xc00062e050, 
0x0, 0x0, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:513 
+0xbbc
github.com/prometheus/client_golang/prometheus/promhttp.HandlerFor.func1(0xb3f0a0,
 
0xc000620000, 0xc000570200)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/http.go:126
 
+0x99
net/http.HandlerFunc.ServeHTTP(0xc000b79650, 0xb3f0a0, 0xc000620000, 
0xc000570200)
/usr/local/go/src/net/http/server.go:2042 +0x44
main.handler(0xb3f0a0, 0xc000620000, 0xc000570200, 0xb34f40, 0xc0002343c0)
/app/main.go:110 +0x6d7
main.main.func2(0xb3f0a0, 0xc000620000, 0xc000570200)
/app/main.go:201 +0x51
net/http.HandlerFunc.ServeHTTP(0xc000bc82a0, 0xb3f0a0, 0xc000620000, 
0xc000570200)
/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0xea0040, 0xb3f0a0, 0xc000620000, 
0xc000570200)
/usr/local/go/src/net/http/server.go:2417 +0x1ad
net/http.serverHandler.ServeHTTP(0xc000bda000, 0xb3f0a0, 0xc000620000, 
0xc000570200)
/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc0000d81e0, 0xb40660, 0xc000860000)
/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2969 +0x36c

goroutine 211 [IO wait]:
internal/poll.runtime_pollWait(0x7f6b76821c00, 0x72, 0xb36220)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc00081e298, 0x72, 0xb36200, 0xe444f0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc00081e280, 0xc000bde000, 0

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/04dfff8b-99d3-44f1-a513-ede99c02a974n%40googlegroups.com.

Reply via email to