Promhub Logo promhub_

MongoDB replication headroom
critical

Description MongoDB replication headroom is <= 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
				
			
    
Query Explanation

The rule computes the total size of each replica set’s oplog window (head timestamp – tail timestamp) and subtracts the replication lag between the primary and its secondaries (primary optime – secondary optime). If the resulting value is ≤ 0, it means the primary’s latest data is already at or beyond the oldest entry still retained in the oplog, i.e., there is no replication headroom left, triggering the alert.

Exporters Used

Get Alert✕
Download
Copy to Clipboard