Skip to content

Commit

Permalink
PMM-12986: PostgreSQL connections in use alert rule template not wo…
Browse files Browse the repository at this point in the history
…rking (#2879)

The expression used for alerting iterates over `pg_settings_max_connections` and compares the results to the sum of *all connections from all instances*.

This commit changes that behaviour to work per instance.
  • Loading branch information
impimp authored Mar 7, 2024
1 parent 9f23aec commit 61d32c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions managed/data/iatemplates/postgresql_too_many_connections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ templates:
version: 1
summary: PostgreSQL connections in use
expr: |-
sum(pg_stat_activity_count{datname!~"template.*|postgres"})
> bool pg_settings_max_connections * [[ .threshold ]] / 100
sum by(agent_id, agent_type, instance, node_id, node_name)
(pg_stat_activity_count{datname!~"template.*|postgres"})
/
on(agent_id, agent_type, instance, node_id, node_name)
pg_settings_max_connections * 100
> [[ .threshold ]]
params:
- name: threshold
summary: A percentage from configured maximum
Expand Down

0 comments on commit 61d32c9

Please sign in to comment.