mongodb_exporter
mongodb_exporter copied to clipboard
panic: runtime error: invalid memory address or nil pointer dereference
Hi,
on my vm the exporter crashed if i curl the metrics, i get a segfault:
./mongodb_exporter-linux-amd64 -mongodb.uri "mongodb://user:[email protected]:27017/database?replicaSet=rs0&authSource=admin"
Listening on :9001 (scheme=HTTP, secured=no, clientValidation=no)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x508228]
goroutine 22 [running]:
panic(0x73d340, 0xc42000e090)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/dcu/mongodb_exporter/collector.(*PreloadStats).Export(0x0, 0xc420052240)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:363 +0x38
github.com/dcu/mongodb_exporter/collector.(*ReplStats).Export(0xc42020ecc0, 0xc420052240)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:352 +0x90
github.com/dcu/mongodb_exporter/collector.(*MetricsStats).Export(0xc42020bb80, 0xc420052240)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:435 +0x4c7
github.com/dcu/mongodb_exporter/collector.(*ServerStatus).Export(0xc42008f9a0, 0xc420052240)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/server_status.go:111 +0x1f9
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).collectServerStatus(0xc420048f50, 0xc4200f8680, 0xc420052240, 0x7235e0)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/mongodb_collector.go:85 +0xe3
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).Collect(0xc420048f50, 0xc420052240)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/mongodb_collector.go:64 +0x2d4
github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2(0xc420054630, 0xc420052240, 0x928900, 0xc420048f50)
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:433 +0x63
created by github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x326
@Bodenhaltung did you manage to work around this? I got the same problem.
Facing same issue when I curl /metrics path @dcu can you fix the issue, Thanks in advance
I didn't find a work around and switched to https://github.com/percona/mongodb_exporter
@tcurdt Thanks, can you share supported grafana dashboard link.
@tcurdt Thanks, can you share supported grafana dashboard link.
Not yet. Sorry. Probably worth getting in touch with people from the percona project if you don't want to create it yourself.
Looks like it might be similar to #127 with the PR https://github.com/dcu/mongodb_exporter/pull/128