From d6368c86bc949371e904eed3d0a6583ebd53b055 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Wed, 12 Apr 2023 04:01:46 +0300 Subject: 2023-04-12 --- modules/nixos/monitoring/rules/postgres.yaml | 154 +++++++++++++-------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'modules/nixos/monitoring/rules/postgres.yaml') diff --git a/modules/nixos/monitoring/rules/postgres.yaml b/modules/nixos/monitoring/rules/postgres.yaml index 5d360fa..6aee560 100644 --- a/modules/nixos/monitoring/rules/postgres.yaml +++ b/modules/nixos/monitoring/rules/postgres.yaml @@ -10,12 +10,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL is down (instance {{ $labels.instance }}) + summary: PostgreSQL is down at {{ $labels.instance }}. description: |- - Postgresql instance is down. + PostgreSQL instance is down. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlRestarted expr: >- @@ -24,12 +24,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL restarted (instance {{ $labels.instance }}) + summary: PostgreSQL restarted at {{ $labels.instance }}. description: |- PostgreSQL restarted. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlExporterError expr: >- @@ -38,12 +38,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL exporter error (instance {{ $labels.instance }}) + summary: PostgreSQL exporter errors at {{ $labels.instance }}. description: |- - PostgreSQL exporter is showing errors. A query may be buggy in query.yaml. + PostgreSQL exporter is showing errors. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlTableNotAutoVacuumed expr: >- @@ -55,12 +55,12 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL table not auto vacuumed (instance {{ $labels.instance }}) + summary: PostgreSQL table not auto vacuumed at {{ $labels.instance }}. description: |- Table {{ $labels.relname }} has not been auto vacuumed for 10 days. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlTableNotAutoAnalyzed expr: >- @@ -72,57 +72,60 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL table not auto analyzed (instance {{ $labels.instance }}) + summary: PostgreSQL table not auto analyzed at {{ $labels.instance }}. description: |- Table {{ $labels.relname }} has not been auto analyzed for 10 days. - VALUE = {{ $value }} - LABELS = {{ $labels }}" + VALUE = {{ $value }} + LABELS = {{ $labels }}" - alert: PostgresqlTooManyConnections expr: >- - sum by (datname) (pg_stat_activity_count{datname!~"template.*|postgres"}) - > pg_settings_max_connections * 0.8 + sum by (datname) ( + pg_stat_activity_count{datname!~"template.*|postgres"} + ) > pg_settings_max_connections * 0.8 for: 2m labels: severity: warning annotations: - summary: Postgresql too many connections (instance {{ $labels.instance }}) + summary: PostgreSQL with too many connections at {{ $labels.instance }}. description: |- - PostgreSQL instance has too many connections (> 80%). + PostgreSQL instance {{ $labels.instance }} has too many connections. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlNotEnoughConnections expr: >- - sum by (datname) (pg_stat_activity_count{datname!~"template.*|postgres"}) - < 1 + sum by (datname) ( + pg_stat_activity_count{datname!~"template.*|postgres"} + ) < 1 for: 2m labels: severity: warning annotations: - summary: Postgresql not enough connections (instance {{ $labels.instance }}) + summary: PostgreSQL with not enough connections at {{ $labels.instance }}. description: |- - PostgreSQL instance should have more connections (> 1). + PostgreSQL instance {{ $labels.instance }} should have more connections. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlDeadLocks expr: >- - increase(pg_stat_database_deadlocks{datname!~"template.*|postgres"}[1m]) - > 5 + increase( + pg_stat_database_deadlocks{datname!~"template.*|postgres"}[1m] + ) > 5 for: 0m labels: severity: warning annotations: - summary: Postgresql dead locks (instance {{ $labels.instance }}) + summary: PostgreSQL dead-locks at instance {{ $labels.instance }}. description: |- - PostgreSQL has dead-locks. + PostgreSQL shows dead-locks. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlHighRollbackRate expr: >- @@ -136,17 +139,17 @@ groups: (rate(pg_stat_database_xact_commit{datname!~"template.*|postgres",datid!="0"}[3m])) ) ) - > 0.02 + > 0.10 for: 0m labels: severity: warning annotations: - summary: PostgreSQL is at a high rollback rate (instance {{ $labels.instance }}) + summary: PostgreSQL at a high rollback rate at {{ $labels.instance }}. description: |- - Ratio of transactions being aborted compared to committed is > 2%. + Ratio of transactions being aborted compared to committed is too big. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlCommitRateLow expr: >- @@ -156,12 +159,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL commit rate low (instance {{ $labels.instance }}) + summary: PostgreSQL commit rate low at instance {{ $labels.instance }}. description: |- PostgreSQL seems to be processing very few transactions. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlLowXidConsumption expr: >- @@ -171,12 +174,12 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL low XID consumption (instance {{ $labels.instance }}) + summary: PostgreSQL low XID consumption at instance {{ $labels.instance }}. description: |- PostgreSQL seems to be consuming transaction IDs very slowly. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlHighRateStatementTimeout expr: >- @@ -190,8 +193,8 @@ groups: description: |- PostgreSQL transactions showing high rate of statement timeouts. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlHighRateDeadlock expr: >- @@ -201,12 +204,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL high rate deadlock (instance {{ $labels.instance }}) + summary: PostgreSQL high rate dead-lock at {{ $labels.instance }}. description: |- - PostgreSQL detected deadlocks. + PostgreSQL has detected dead-locks. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlUnusedReplicationSlot expr: >- @@ -215,12 +218,12 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL unused replication slot (instance {{ $labels.instance }}) + summary: PostgreSQL unused replication slot at {{ $labels.instance }}. description: |- - Unused Replication Slots. + Unused replication slots. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlTooManyDeadTuples expr: >- @@ -234,12 +237,12 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL too many dead tuples (instance {{ $labels.instance }}) + summary: PostgreSQL too many dead tuples at {{ $labels.instance }}. description: |- PostgreSQL number of dead tuples is too large. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlSslCompressionActive expr: >- @@ -248,13 +251,12 @@ groups: labels: severity: critical annotations: - summary: Postgresql SSL compression active (instance {{ $labels.instance }}) + summary: PostgreSQL SSL compression active at {{ $labels.instance }}. description: |- - Database connections with SSL compression is enabled. This may add a - significant jitter in the replication delay. + Database connections with an SSL compression is enabled. This may add a significant jitter in the replication delay. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlTooManyLocksAcquired expr: >- @@ -268,12 +270,12 @@ groups: labels: severity: critical annotations: - summary: PostgreSQL too many locks acquired (instance {{ $labels.instance }}) + summary: PostgreSQL too many locks acquired at {{ $labels.instance }}. description: |- Too many locks acquired on the database. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlBloatIndexHigh expr: >- @@ -284,13 +286,12 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL bloat index high (> 80%) (instance {{ $labels.instance }}) + summary: PostgreSQL index bloat high at {{ $labels.instance }}. description: |- - The index {{ $labels.idxname }} is bloated. You should execute - `REINDEX INDEX CONCURRENTLY {{ $labels.idxname }};` + The index {{ $labels.idxname }} is bloated. You should execute `REINDEX INDEX CONCURRENTLY {{ $labels.idxname }};`. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} - alert: PostgresqlBloatTableHigh expr: >- @@ -301,10 +302,9 @@ groups: labels: severity: warning annotations: - summary: PostgreSQL bloat table high (> 80%) (instance {{ $labels.instance }}) + summary: PostgreSQL table bloat high at instance {{ $labels.instance }}. description: |- - The table {{ $labels.relname }} is bloated. You should execute - `VACUUM {{ $labels.relname }};` + The table {{ $labels.relname }} is bloated. You should execute `VACUUM {{ $labels.relname }};`. - VALUE = {{ $value }} - LABELS = {{ $labels }} + VALUE = {{ $value }} + LABELS = {{ $labels }} -- cgit v1.2.3