Package: prometheus-mongodb-exporter
Version: 1.0.0+git20180522.e755a44-1
Severity: important
Tags: patch

Dear maintainer:

On a replica set where mongodb 4.0 and prometheus-mongodb-exporter used
to work ok, an upgrade to mongodb 4.2 makes prometheus-mongodb-exporter
to crash as soon as a request from prometheus is received:

prometheus-mongodb-exporter.service: Main process exited, code=exited, 
status=2/INVALIDARGUMENT
prometheus-mongodb-exporter.service: Unit entered failed state.
prometheus-mongodb-exporter.service: Failed with result 'exit-code'.
prometheus-mongodb-exporter.service: Service hold-off time over, scheduling 
restart.

My /etc/default/prometheus-mongodb-exporter is like this:

ARGS='-mongodb.uri="mongodb://user:password@localhost:27017" -log_dir 
/var/log/prometheus -web.listen-address :9201'

And this is what I do to trigger a segfault:

curl localhost:9201/metrics


I found a solution here:

https://www.bountysource.com/issues/65886524-nil-pointer-panic-when-monitoring-a-mongodb-with-no-username-and-password-set

The attached patch, based on the post above, solves the problem for
me, and I believe it is otherwise harmless for anybody who does not
have the problem. I tested it by applying the patch to the package in
stretch-backports.

Maybe another option would be to switch to this upstream which is said
to be more up-to-date:

https://github.com/percona/mongodb_exporter

but I have not tested it.

Thanks.
--- a/collector/metrics.go
+++ b/collector/metrics.go
@@ -349,7 +349,9 @@ func (replStats *ReplStats) Export(ch chan<- 
prometheus.Metric) {
        replStats.Apply.Export(ch)
        replStats.Buffer.Export(ch)
        replStats.Network.Export(ch)
-       replStats.PreloadStats.Export(ch)
+       if replStats.PreloadStats != nil {
+               replStats.PreloadStats.Export(ch)
+       }
 }
 
 // PreloadStats are the stats associated with preload operation.
_______________________________________________
Pkg-go-maintainers mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-go-maintainers

Reply via email to