dcu / mongodb_exporter

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

I got a error: ..... no reachable servers #118

Open liamliu1986 opened 4 years ago

liamliu1986 commented 4 years ago

My mongodb has a username = xxxx@xxxxxx.cn password=xxx.xxx.xxx I used the command:

mongodb_exporter -mongodb.uri mongodb://xxxx@xxxxxx.cn:xxx.xxx.xxx@mongo02.xxx.com:27017

but , I got the Error notice E0926 16:30:13.003667 44532 connection.go:48] Cannot connect to server using url mongodb://xxxx@xxxxxx.cn:xxx.xxx.xxx@mongo02.xxx.com:27017: no reachable servers

I can use this uri access the mongodb through CIL

cassioseffrin commented 2 months ago

Hello @liamliu1986,

I have same issue with the latest version v1.0.0, the same error.

./mongodb_exporter-v1.0.0 --mongodb.uri=mongodb://mongodb_exporter:password@localhost:27017 --web.listen-address=:9126

Listening on :9126 (scheme=HTTP, secured=no, clientValidation=no) E0710 16:21:24.572022 257980 connection.go:48] Cannot connect to server using url mongodb://mongodb_exporter:password@localhost:27017: no reachable servers

so, i have succed with version 0.7.1:

wget https://github.com/percona/mongodb_exporter/releases/download/v0.7.1/mongodb_exporter-0.7.1.linux-amd64.tar.gz

./mongodb_exporter-v0.7.1 --mongodb.uri=mongodb://mongodb_exporter:password@localhost:27017 --web.listen-address=:9126

mongodb_exporter_build_info{branch="v0.7.1",goversion="go1.11.10",revision="3002738d50f689c8204f70f6cceb8150b98fa869",version="0.7.1"} 1 mongodb_exporter_last_scrape_duration_seconds 0.157312024 mongodb_exporter_last_scrape_error 1 mongodb_exporter_scrape_errors_total 5 mongodb_exporter_scrapes_total 5 mongodb_up 0

I am still to try make the v1.0.1 to work with mongo v7.0.0. PS: (my mongodb server is running with docker in a replica set)