Skip to content

Exporter doesnt work with arbiter #1093

@superset1

Description

@superset1

Describe the bug
MongoDB Exporter 0.44.0 doesn't work wit arbiter in mongodb replicaset cluster.
Last worked version with arbiter 0.11.2!

To Reproduce

  1. Setup mongodb exporter on arbiter node
  2. Create systemd unit /etc/systemd/system/mongodb-exporter.service;
# Ansible managed

[Unit]
Description=Prometheus exporter for MongoDB (https://github.com/percona/mongodb_exporter)
After=network.target mongod.service
Wants=network.target

[Service]
Type=simple
RestartSec=5s
Restart=on-failure
User=mongodb-exporter
Group=mongodb
ExecStart=/usr/local/bin/mongodb-exporter --collect-all --discovering-mode --compatible-mode --mongodb.direct-connect --mongodb.uri="mongodb://mongodbexporter:djskrbbksbdf234vK@127.0.0.1:27017/admin?tls=true&tlsCertificateKeyFile=/etc/ssl/mongodb.pem&tlsCAFile=/etc/ssl/mongodb-ca.pem"
ExecStop=/bin/kill -s SIGINT $MAINPID

[Install]
WantedBy=multi-user.target
  1. systemctl start mongodb-exporter.service

Expected behavior
Work like in version 0.11.2

Logs

Jun 05 19:50:53 test-mongo-cl1-3 systemd[1]: Started Prometheus exporter for MongoDB (https://github.com/percona/mongodb_exporter).
Jun 05 19:50:53 test-mongo-cl1-3 mongodb-exporter[48357]: time="2025-06-05T19:50:53+03:00" level=error msg="Cannot connect to MongoDB: cannot connect to MongoDB: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AuthenticationFailed) Authentication failed."
Jun 05 19:51:02 test-mongo-cl1-3 mongodb-exporter[48357]: time="2025-06-05T19:51:02+03:00" level=error msg="Cannot connect to MongoDB: cannot connect to MongoDB: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AuthenticationFailed) Authentication failed."

Environment

  • Operating System: Debian GNU/Linux 11 (bullseye)
  • Kernel: Linux 6.1.0-0.deb11.21-amd64,
  • environment (VM)
  • MongoDB version 7.0.18

Additional context
I tried:

  • ExecStart=/usr/local/bin/mongodb-exporter --collect-all --discovering-mode --compatible-mode --mongodb.direct-connect --mongodb.uri="mongodb://mongodbexporter:djskrbbksbdf234vK@127.0.0.1:27017/admin?tls=true&tlsCertificateKeyFile=/etc/ssl/mongodb.pem&tlsCAFile=/etc/ssl/mongodb-ca.pem"
  • ExecStart=/usr/local/bin/mongodb-exporter --collect-all --discovering-mode --compatible-mode --mongodb.direct-connect --mongodb.uri="mongodb://mongodbexporter:djskrbbksbdf234vK@127.0.0.1:27017/admin"
  • ExecStart=/usr/local/bin/mongodb-exporter --mongodb.direct-connect --mongodb.uri="mongodb://mongodbexporter:djskrbbksbdf234vK@127.0.0.1:27017/admin"

Not worked.

cat /etc/mongod.conf

# Ansible managed

net:
  bindIp: 0.0.0.0
  ipv6: false
  maxIncomingConnections: 65536
  port: 27017
  tls:
    mode: requireTLS
    certificateKeyFile: /etc/ssl/mongodb.pem
    CAFile: /etc/ssl/mongodb-ca.pem
    allowConnectionsWithoutCertificates: true

processManagement:
  fork: false

replication:
  oplogSizeMB: 4096
  replSetName: rs01

security:
  authorization: enabled
  keyFile: /etc/mongodb-keyfile
  javascriptEnabled: false

storage:
  dbPath: /data/db
  directoryPerDB: false
  engine: wiredTiger
  journal:
    commitIntervalMs: 100
  wiredTiger:
    engineConfig:
      directoryForIndexes: false

systemLog:
  destination: file
  logAppend: true
  logRotate: rename
  path: /var/log/mongodb/mongod.log
  verbosity: 0

operationProfiling:
  slowOpThresholdMs: 100
  mode: off

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions