Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb_exporter.service TLS is disabled #291

Open
l0rdaxel opened this issue Feb 13, 2024 · 1 comment
Open

mongodb_exporter.service TLS is disabled #291

l0rdaxel opened this issue Feb 13, 2024 · 1 comment

Comments

@l0rdaxel
Copy link

l0rdaxel commented Feb 13, 2024

Hello everyone, I have a problem with the mongodb_exporter.service to export metrics to Grafana.

It is configured as follows:

###############################à
[Unit]
Description=MongoDB Exporter
User=prometheus

[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://mongodb_exporter:collaudo@xxx:27017/admin?ssl=true

[Install]
WantedBy=multi-user.target
###############################

But when I start mongodb_exporter.service, I get this output:

###############################
● mongodb_exporter.service - MongoDB Exporter
Loaded: loaded (/usr/lib/systemd/system/mongodb_exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2024-02-13 11:46:08 CET; 4s ago
Main PID: 17623 (mongodb_exporte)
Tasks: 6 (limit: 52426)
Memory: 7.0M
CGroup: /system.slice/mongodb_exporter.service
└─17623 /usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://mongodb_exporter:collaudo@xxx:27017/admin?ssl=true

Feb 13 11:46:08 xxx systemd[1]: Started MongoDB Exporter.
Feb 13 11:46:08 xxx mongodb_exporter[17623]: level=info ts=2024-02-13T10:46:08.912Z caller=tls_config.go:274 msg="Listening on" address=0.0.0.0:92>
Feb 13 11:46:08 xxx mongodb_exporter[17623]: level=info mongodb://mongodb_exporter:collaudo@xxx:27017/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=truets=2024-02-13T10:46:08.912Z caller=tls_config.go:277 msg="TLS is disabled." http2=false ad
###############################

My MongoDB cluster is configured on 3 nodes (one primary and two secondary) and SSL connection is enabled.

In fact, if I try to connect with a client with the following string, I can connect without problems mongodb://mongodb_exporter:collaudo@xxx:27017/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=true

My prometeus.yml is:

###############################

global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

alerting:
alertmanagers:
- static_configs:
- targets:

  • job_name: "prometheus"

    static_configs:

    • targets: ["x.x.x.x:9090"]
  • job_name: 'mongodb_exporter'
    static_configs:

    • targets: ['x.x.x.x:9216']
      labels:
      alias: mongodb_exporter
      ###############################

Could you please help me solve this issue?
Thanks!

@fsimonjetz
Copy link

Hi there,
did you ever figure this out? We seem to have exactly the same problem with a very similar setup. I can connect to the db manually with mongosh, but mongodb exporter fails to do so (socket was unexpectedly closed: EOF), and in the mongodb logs it shows SSLHandshakeFailed and The server is configured to only allow SSL connections. It almost looks like SSL gets disabled somehow even though it's explicitly set to true in the uri? Any hints would be greatly appreciated.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants