percona / mongodb_exporter

A Prometheus exporter for MongoDB including sharding, replication and storage engines
Apache License 2.0
1.16k stars 425 forks source link

Using environment variables, startup errors #763

Closed xucong18 closed 8 months ago

xucong18 commented 9 months ago

Describe the bug When using multi-target collection, starting with an environment variable will report an error

To Reproduce export MONGODB_USER=XXX export MONGODB_PASSWORD=YYY mongodb_exporter --mongodb.uri=mongodb://127.0.0.1:17001,mongodb://127.0.0.1:17001

Expected behavior But using this approach it's possible to: mongodb_exporter --mongodb.uri=mongodb://user:pwd@127.0.0.1:17001,mongodb://user:pwd@127.0.0.1:17001

Logs Cannot connect to MongoDB: invalid dsn: error parsing uri: scheme must be \"mongodb\" or \"mongodb+srv\""

pflong commented 9 months ago

@xushiba What's your mongodb exporter version ?

xucong18 commented 8 months ago

@xushiba What's your mongodb exporter version ?

0.40

xucong18 commented 8 months ago

Follow-up: MONGODB_USER varibales cannot be set to mongodb-xxx