Promhub Logo promhub_

PostgreSQLMaxConnectionsReached

Description {{ $labels.instance }} is exceeding the currently configured maximum Postgres connection limit (current value: {{ $value }}s). Services may be degraded - please take immediate action (you probably need to increase max_connections in the Docker image and re-deploy.
Query for 1m
>>>
	
				
					
					
						sum
					
				
			
				
					(
				
			
				
					pg_stat_activity_count
				
			
				
					) by (instance) >= 
				
			
				
					
					
						sum
					
				
			
				
					(
				
			
				
					pg_settings_max_connections
				
			
				
					) by (instance) - 
				
			
				
					
					
						sum
					
				
			
				
					(
				
			
				
					pg_settings_superuser_reserved_connections
				
			
				
					) by (instance)
				
			
    
Query Explanation

The rule sums the current open PostgreSQL sessions (pg_stat_activity_count) for each instance and checks whether this total is greater than or equal to the usable connection capacity, calculated as the configured max_connections minus the reserved superuser connections (pg_settings_superuser_reserved_connections). The alert triggers when an instance’s active connections reach or exceed this usable limit, indicating the instance is at or over its maximum allowed connections.

Exporters Used

Get Alert✕
Download
Copy to Clipboard