Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb exporter crashes #127

Open
vkuznet opened this issue Jun 25, 2020 · 3 comments
Open

mongodb exporter crashes #127

vkuznet opened this issue Jun 25, 2020 · 3 comments

Comments

@vkuznet
Copy link

vkuznet commented Jun 25, 2020

I'm unable to run mongodb exporter it always crashes either on Linux (within k8s) or locally on OSX. The error I got is always the same, see below the output from OSX crash. I run MongoDB locally, it does not have any replicas, etc, very basic setup. But error seems to be related to replica sets which I explicitly turned off. The error occurs every time I start querying the mongodb_exporter server via curl command. Any ideas?

mongodb_exporter-darwin-amd64 -mongodb.uri "mongodb://localhost:8230" -mongodb.collect.replset=false -mongodb.collect.oplog=false -alsologtostderr
Listening on :9001 (scheme=HTTP, secured=no, clientValidation=no)
I0625 15:22:31.202532   13887 mongodb_collector.go:63] Collecting Server Status
I0625 15:22:31.222753   13887 mongodb_collector.go:84] exporting ServerStatus Metrics
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1087c8]

goroutine 22 [running]:
panic(0x344640, 0xc420018100)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/dcu/mongodb_exporter/collector.(*PreloadStats).Export(0x0, 0xc420196180)
	/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:363 +0x38
github.com/dcu/mongodb_exporter/collector.(*ReplStats).Export(0xc420247380, 0xc420196180)
	/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:352 +0x90
github.com/dcu/mongodb_exporter/collector.(*MetricsStats).Export(0xc4201cbf40, 0xc420196180)
	/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:435 +0x4c7
github.com/dcu/mongodb_exporter/collector.(*ServerStatus).Export(0xc4200af720, 0xc420196180)
	/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/server_status.go:111 +0x1f9
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).collectServerStatus(0xc4200165f0, 0xc42007bd40, 0xc420196180, 0x329f00)
	/Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/mongodb_collector.go:85 +0xe3
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).Collect(0xc4200165f0, 0xc420196180)
	/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(0xc42017c0f0, 0xc420196180, 0x534d00, 0xc4200165f0)
	/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
vkuznet added a commit to vkuznet/mongodb_exporter that referenced this issue Jun 26, 2020
@GOrtiz16
Copy link

Hi, I have the same problem. Did you solve it?

@vkuznet
Copy link
Author

vkuznet commented Aug 28, 2020

yes, I applied this change:
vkuznet@9a287e6

@hloeung
Copy link

hloeung commented Sep 12, 2022

#128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants