MongoDB Exporter for TLS/SSL not working via systemctl services

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

Team some can look into this pls

(post deleted by author)

Team we are seeing issues for mongodb exporter with TLS

Command : /usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://xx:xx@hostname:27017/?tls=true&tlsCAFile=/etc/mongodb/certs/caToValidateClientCertificates.pem&tlsPEMKeyFile=/etc/mongodb/certs/mongodb.pem --log.level=debug

Error: mongodb_exporter[19237]: time=“2024-05-12T04:49:58Z” level=error msg=“Problem gathering the mongo server version: server selection error: server selection timeout\ncurrent topology: Type: Single\nServers:\nAddr: hostname:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection(hostname:27017[-8605]) connection is closed\n” source=“mongodb_collector.go:203”

can some one lookinto this ??