dcu / mongodb_exporter

MongoDB exporter for prometheus.io
MIT License
353 stars 216 forks source link

Unable to comply with mongodb 4.2.2, error: panic: runtime error: invalid memory address or nil pointer dereference #122

Open Atangwy opened 4 years ago

Atangwy commented 4 years ago

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x508228]

goroutine 32 [running]: panic(0x73d340, 0xc42000a0e0) /usr/local/go/src/runtime/panic.go:500 +0x1a1 github.com/dcu/mongodb_exporter/collector.(PreloadStats).Export(0x0, 0xc42010c4e0) /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:363 +0x38 github.com/dcu/mongodb_exporter/collector.(ReplStats).Export(0xc4202875c0, 0xc42010c4e0) /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:352 +0x90 github.com/dcu/mongodb_exporter/collector.(MetricsStats).Export(0xc4201ebdc0, 0xc42010c4e0) /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:435 +0x4c7 github.com/dcu/mongodb_exporter/collector.(ServerStatus).Export(0xc4200f28c0, 0xc42010c4e0) /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/server_status.go:111 +0x1f9 github.com/dcu/mongodb_exporter/collector.(MongodbCollector).collectServerStatus(0xc4200f4500, 0xc4200ddd40, 0xc42010c4e0, 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(0xc4200f4500, 0xc42010c4e0) /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(0xc4200ef540, 0xc42010c4e0, 0x928900, 0xc4200f4500) /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

rkm commented 4 years ago

Hi, I'm also seeing this. Is there a fix available?

WilliamThh commented 4 years ago

+1

rkm commented 4 years ago

Seems like this project is no longer under development. I'm planning migrating to this fork: https://github.com/percona/mongodb_exporter

liying6600 commented 4 years ago

+1

jnet06 commented 4 years ago

+1

ShawnGoethe commented 4 years ago

4.2.6 also has the same problem , someone know how to solve it? cause we can't downgrade our mongo version

mongsil1025 commented 3 years ago

just like @rkm said, try use mongodb_exporter that percona made I had same error, after switching exporter from dcu to percona, it solved

rgaufman commented 2 years ago

+1 Not getting much data, only Oplog lag and getting the same error.

Screenshot 2022-06-03 at 10 30 50

Going to try the fork thank you! (https://github.com/percona/mongodb_exporter)

hloeung commented 2 years ago

Looks like it might be similar to #127 with PR #128 fixing it.