-
Notifications
You must be signed in to change notification settings - Fork 5
/
rules.yml
40 lines (39 loc) · 1.31 KB
/
rules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
groups:
- name: replication
rules:
# docker-compose exec replica gosu postgres psql -c "SELECT pg_wal_replay_pause()"
# docker-compose exec replica gosu postgres psql -c "SELECT pg_wal_replay_resume()"
- alert: PGReplicationLagXLOG
expr: max(pg_xlog_position) - min(pg_xlog_position) > 1000000000
labels:
severity: critical
annotations:
summary: Replication Lag
- alert: PGReplicationLagTime
expr: pg_replication_replag > 60000
labels:
severity: critical
annotations:
summary: Replication Lag more than 1 min
- alert: PGReplicationLagBytes
expr: pg_replication_replay_lag > 1000000
labels:
severity: critical
annotations:
summary: Replication Lag more than 10 MB
- name: connections
rules:
- alert: TooManyConnections
expr: sum by (exported_server, instance, job, server) (pg_stat_database_numbackends) / pg_settings_max_connections > 0.9
labels:
severity: critical
annotations:
summary: Too many connections
- name: tables
rules:
- alert: PGFatIndex
expr: pg_table_size_index_bytes{schemaname!~"pg_catalog|information_schema"} > (pg_table_size_table_bytes{schemaname!~"pg_catalog|information_schema"} * 10)
labels:
severity: critical
annotations:
summary: Index is far bigger than data, REINDEX needed