mirror of
https://github.com/samber/awesome-prometheus-alerts.git
synced 2026-06-21 08:57:19 +08:00
Fix for Postgres max connections. Postgres does not limit connections by database, but total over the server. Additionally, alert labels didn't match across the pair. Using a min by on the right side deals with the possibility additional labels are present on your exporter. (#376)
This commit is contained in:
parent
15e3131547
commit
94b9f3cfbb
2 changed files with 2 additions and 2 deletions
|
|
@ -619,7 +619,7 @@ groups:
|
|||
severity: warning
|
||||
- name: Postgresql too many connections
|
||||
description: PostgreSQL instance has too many connections (> 80%).
|
||||
query: 'sum by (datname) (pg_stat_activity_count{datname!~"template.*|postgres"}) > pg_settings_max_connections * 0.8'
|
||||
expr: 'sum by (instance, job, server) (pg_stat_activity_count) > min by (instance, job, server) (pg_settings_max_connections * 0.8)'
|
||||
severity: warning
|
||||
for: 2m
|
||||
- name: Postgresql not enough connections
|
||||
|
|
|
|||
2
dist/rules/postgresql/postgres-exporter.yml
vendored
2
dist/rules/postgresql/postgres-exporter.yml
vendored
|
|
@ -50,7 +50,7 @@ groups:
|
|||
description: "Table {{ $labels.relname }} has not been auto analyzed for 10 days\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
||||
|
||||
- alert: PostgresqlTooManyConnections
|
||||
expr: 'sum by (datname) (pg_stat_activity_count{datname!~"template.*|postgres"}) > pg_settings_max_connections * 0.8'
|
||||
expr: 'sum by (instance, job, server) (pg_stat_activity_count) > min by (instance, job, server) (pg_settings_max_connections * 0.8)'
|
||||
for: 2m
|
||||
labels:
|
||||
severity: warning
|
||||
|
|
|
|||
Loading…
Reference in a new issue