How to Configure MongoDB Exporter with SSL/TLS

April 17, 2020
Author
Lalit Choudhary
Share this Post:

configure mongodb exporterPercona provides the mongodb_exporter for monitoring MongoDB. It can feed a Prometheus time-series database by exporting sharding, replication, and storage engine metrics. So basically, it’s the way we monitor MongoDB through Percona Monitoring and Management.

You can download or build mongodb_exporter from the Github repository. It also comes with the pmm-client package, and it’s based on the latest available mongodb_exporter version.

A simple connection method to MongoDB from mongodb_exporter is described in the mongodb_exporter documentation. But the SSL/TLS connection is a bit tricky due to the option changes between versions of MongoDB and mongodb_exporter.

Reference:

https://docs.mongodb.com/manual/reference/connection-string/#tls-options

https://github.com/percona/mongodb_exporter/releases/tag/v0.10.0

This blog post will show how to configure MongoDB Exporter with SSL/TLS options.

Connection Method and Options

mongodb_exporter v 0.9.0

For SSL connection mongodb_exporter and MongoDB, here’s a list of SSL options.

MongoDB server logs:

mongodb_exporter v 0.10.0

Now lets test SSL connection with mongodb_exporter v0.10.0 using the same options.

As we can see, mongodb_exporter v0.10.0 is not able to identify given options in the document. An error occurred due to changes in the mongodb_exporter v.0.10.0 version.

Reference: https://github.com/percona/mongodb_exporter/releases/tag/v0.10.0

  • go.mongodb.org/mongo-driver was updated to v1.1.1.
  • All –mongodb.tls* flags were removed. Use tls-options instead.

Depending on the MongoDB version and the support for SSL/TSL, we will use the following options in mongodb.uri:

SSL Option

TLS Option
sslclientcertificatekeyfile tlscertificatekeyfile
sslclientcertificatekeypassword tlscertificatekeyfilepassword
sslinsecure tlsinsecure
sslcertificateauthorityfile tlscafile

We should refer to MongoDB documentation for additional URI options. We will not see these options under mongodb_exporter –help since they are part of mongodb.uri

Examples

Using TLS Options

MongoDB logs:

Using SSL options

MongoDB logs:

As I mentioned, while the SSL/TLS connection can be a little tricky, I am hopeful that this post helps you properly configure MongoDB Exporter!

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved