MongoDB replication headroom
critical

Description MongoDB replication headroom is <= 0
Query
>>>
	
				
					
					
						sum
					
				
			
				
					(
				
			
				
					
					
						avg
					
				
			
				
					(
				
			
				
					
				
			
				
					 - 
				
			
				
					
				
			
				
					)) - 
				
			
				
					
					
						sum
					
				
			
				
					(
				
			
				
					
					
						avg
					
				
			
				
					(
				
			
				
					
				
			
				
					{member_state="PRIMARY"} - on (set) group_right 
				
			
				
					
				
			
				
					{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.

Get Alert✕
Download
Copy to Clipboard