rs_state out of sync with member_state
If I run the exporter and enable it scrape multiple URIs, like
./mongodb_exporter --mongodb.uri=mongodb://127.0.0.1:17000,127.0.0.1:17001,127.0.0.1:17002,[host:port] --mongodb.direct-connect=false --web.listen-address=":9200" --discovering-mode &
and query a metric like mongodb_rs_members_id[5m]
then the labels are shown like this
{member_idx="172.19.0.2:27017", member_state="SECONDARY", rs_nm="cnf-serv", rs_state="1"}
rs_state in the above should be 2 to reflect that it's a secondary
Hi,
Even when the MongoDB driver allows setting several hosts in the URI, the exporter is not designed to support multiple hosts.
Also, mongodb.direct-connect is true by default.
The topology information is being loaded only once per scrape here and you can see it just returns ReplicasetGetStatus.MyState from getDiagnosticData.
Since we are not handling the connection manually, the driver returns the state of the server it is connected to.