From 2617aa5dabe74a7c8b55792f8fb2081e3f2b1674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20Lindstr=C3=B6m?= Date: Mon, 3 Apr 2023 10:01:25 +0200 Subject: [PATCH] Fix MongoDB replication headroom query (#342) The query was changed to use `mongodb_oplog_stats_start` and `mongodb_oplog_stats_end` in #291 but these metrics does not represent the start and end of the oplog. The original head and tail metrics are calculated from the oplog and are consistent with the output of `db.getReplicationInfo()`. --- _data/rules.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/rules.yml b/_data/rules.yml index 17f5c0b..f57c347 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -792,7 +792,7 @@ groups: severity: critical - name: MongoDB replication headroom description: MongoDB replication headroom is <= 0 - query: 'sum(avg(mongodb_oplog_stats_start - mongodb_oplog_stats_end)) - sum(avg(mongodb_rs_members_optimeDate{member_state="PRIMARY"} - on (set) group_right mongodb_rs_members_optimeDate{member_state="SECONDARY"})) <= 0' + query: 'sum(avg(mongodb_mongod_replset_oplog_head_timestamp - mongodb_mongod_replset_oplog_tail_timestamp)) - sum(avg(mongodb_rs_members_optimeDate{member_state="PRIMARY"} - on (set) group_right mongodb_rs_members_optimeDate{member_state="SECONDARY"})) <= 0' severity: critical - name: MongoDB number cursors open description: Too many cursors opened by MongoDB for clients (> 10k)