MongoDB check
mongodb — MongoDB
Replica-set status — primary present, member health, secondary lag — and connection saturation.
checkfleet check mongodb --config checkfleet.yml
Read-only health check for MongoDB via the official driver (any member answers cluster-wide):
- Replica-set status (
replSetGetStatus) —BADif there is no healthyPRIMARY,BADfor any member with health 0 (unreachable), and per-secondary replication lag:WARNoverlag_warn_seconds,BADoverlag_crit_seconds. A standalone node (not a replica set) is reported as reachable and the replica-set checks are skipped. - Connections (
serverStatus) —WARNwhen in-use connections exceedconn_warn_pctof the total available. ERRORif the deployment is unreachable or the status query fails.
Credentials come from env (username + password_env, never in the URI/config);
auth_source defaults to admin. Uses go.mongodb.org/mongo-driver/v2 (a
motivated exception to the zero-dep rule, like pgx for Postgres). The finding
logic is unit-tested with a fake collector — no real database in tests.
mongodb:
lag_warn_seconds: 10
lag_crit_seconds: 60
targets:
- {name: rs0, uri: "mongodb://m1:27017,m2:27017/?replicaSet=rs0", username: monitor, password_env: MONGO_PASSWORD}
See the full module reference for every check, or configuration for the config keys.