Hi Everyone,
we are encountering with the MongoDB Exporter configuration when using TLS authentication. While we have successfully enabled TLS on our MongoDB instance and can access MongoDB using certificates and usernames, but we are facing difficulties when configuring the MongoDB Exporter via system services with the same credentials.
Following is exec start command :/usr/local/bin/mongodb_exporter --mongodb.uri=“mongodb://xx:xx@hostname:27017/?tls=true&tlsCertificateKeyFile=/etc/mongodb/certs/mongodb.pem&tlsCAFile=/etc/mongodb/certs/caToValidateClientCertificates.pem” --log.level=debug
Error :
Can’t create mongo session to mongodb://:@hostname:27017/admin?&sslCAFile=/etc/mongodb/certs/caToValidateClientCertificates.pem&sslClientCertificateKeyFile=/etc/mongodb/mongodb.pem source=“mongodb_collector.go:195”
If anyone have any insights or suggestions regarding this issue, please share
[Unit]
Description=mongo Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri="mongodb://xx:xx@hostname:27017/?tls=true&tlsCertificateKeyFile=/etc/mongodb/certs/mongodb.pem&tlsCAFile=/etc/mongodb/certs/caToValidateClientCertificates.pem" --log.level=debug
[Install]
WantedBy=multi-user.target```
Thanks