percona / mongodb_exporter

A Prometheus exporter for MongoDB including sharding, replication and storage engines
Apache License 2.0
1.18k stars 423 forks source link

When 2/3 mongodb replicas are down in a replica set the percona exporter is not able to retrieve metrics #638

Open dbernstein1 opened 1 year ago

dbernstein1 commented 1 year ago

Describe the bug When 2/3 mongodb replicas are down in a replica set the percona exporter is not able to retrieve metrics

To Reproduce

/mongodb_exporter --version mongodb_exporter - MongoDB Prometheus exporter Version: vb7c7d00 Commit: b7c7d00 Build date: 2022-10-13T17:02:52Z

command:

Expected behavior

Percona exporter should be able to connect and retrieve metrics from the secondary member up

Logs time="2023-03-24T06:56:24Z" level=error msg="Registry - Cannot get node type to check if this is a mongos : server selection error: context canceled, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: mongodb-0.mongodb.mongodb.svc:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp: lookup mongodb-0.mongodb.mongodb.svc on 200.0.0.2:53: server misbehaving }, { Addr: mongodb-1.mongodb.mongodb.svc:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp: lookup mongodb-1.mongodb.mongodb.svc on 200.0.0.2:53: server misbehaving }, { Addr: mongodb-2.mongodb.mongodb.svc:27017, Type: RSSecondary, Average RTT: 515493 }, ] }"

Environment

darylangg commented 10 months ago

Hello, any updates to this issue? I'm having similar issues when using --mongodb.uri=mongodb://rs1,rs2/ . The behavior I observed is that when I down rs2, the exporter looks good and reports the expected metrics. However when I down rs1, exporter logs report an error with connecting to rs1 and I am unable to retrieve metrics.