@cryptotaxi247 / netdata-1 / commits / d6995cabc

feat(health): add Postgres alarms (#13671)

Ilya Mashchenko committed Sep 19, 2022 at 15:26 UTC d6995cabcf5fa021385ccaf194315c886836403d
1 file changed +199 -1
health/health.d/postgres.conf
+199 -1
@@ -1,6 +1,6 @@
1 # you can disable an alarm notification by setting the 'to' line to: silent
2
3 - template: total_connection_utilization
3 + template: postgres_total_connection_utilization
4 on: postgres.connections_utilization
5 class: Utilization
6 type: Database
@@ -14,3 +14,201 @@ component: PostgreSQL
14 delay: down 15m multiplier 1.5 max 1h
15 info: average total connection utilization over the last minute
16 to: dba
17 +
18 + template: postgres_acquired_locks_utilization
19 + on: postgres.locks_utilization
20 + class: Utilization
21 + type: Database
22 +component: PostgreSQL
23 + hosts: *
24 + lookup: average -1m unaligned of used
25 + units: %
26 + every: 1m
27 + warn: $this > (($status >= $WARNING) ? (15) : (20))
28 + delay: down 15m multiplier 1.5 max 1h
29 + info: average acquired locks utilization over the last minute
30 + to: dba
31 +
32 + template: postgres_txid_exhaustion_perc
33 + on: postgres.txid_exhaustion_perc
34 + class: Utilization
35 + type: Database
36 +component: PostgreSQL
37 + hosts: *
38 + calc: $txid_exhaustion
39 + units: %
40 + every: 1m
41 + warn: $this > 90
42 + delay: down 15m multiplier 1.5 max 1h
43 + info: percent towards TXID wraparound
44 + to: dba
45 +
46 +# Database alarms
47 +
48 + template: postgres_db_cache_io_ratio
49 + on: postgres.db_cache_io_ratio
50 + class: Workload
51 + type: Database
52 +component: PostgreSQL
53 + hosts: *
54 + lookup: average -1m unaligned of miss
55 + calc: 100 - $this
56 + units: %
57 + every: 1m
58 + warn: $this < (($status >= $WARNING) ? (70) : (60))
59 + crit: $this < (($status == $CRITICAL) ? (60) : (50))
60 + delay: down 15m multiplier 1.5 max 1h
61 + info: average cache hit ratio in db $label:database over the last minute
62 + to: dba
63 +
64 + template: postgres_db_transactions_rollback_ratio
65 + on: postgres.db_transactions_ratio
66 + class: Workload
67 + type: Database
68 +component: PostgreSQL
69 + hosts: *
70 + lookup: average -5m unaligned of rollback
71 + units: %
72 + every: 1m
73 + warn: $this > (($status >= $WARNING) ? (0) : (2))
74 + delay: down 15m multiplier 1.5 max 1h
75 + info: average aborted transactions percentage in db $label:database over the last five minutes
76 + to: dba
77 +
78 + template: postgres_db_deadlocks_rate
79 + on: postgres.db_deadlocks_rate
80 + class: Errors
81 + type: Database
82 +component: PostgreSQL
83 + hosts: *
84 + lookup: sum -1m unaligned of deadlocks
85 + units: deadlocks
86 + every: 1m
87 + warn: $this > (($status >= $WARNING) ? (0) : (10))
88 + delay: down 15m multiplier 1.5 max 1h
89 + info: number of deadlocks detected in db $label:database in the last minute
90 + to: dba
91 +
92 +# Table alarms
93 +
94 + template: postgres_table_cache_io_ratio
95 + on: postgres.table_cache_io_ratio
96 + class: Workload
97 + type: Database
98 +component: PostgreSQL
99 + hosts: *
100 + lookup: average -1m unaligned of miss
101 + calc: 100 - $this
102 + units: %
103 + every: 1m
104 + warn: $this < (($status >= $WARNING) ? (70) : (60))
105 + crit: $this < (($status == $CRITICAL) ? (60) : (50))
106 + delay: down 15m multiplier 1.5 max 1h
107 + info: average cache hit ratio in db $label:database table $label:table over the last minute
108 + to: dba
109 +
110 + template: postgres_table_index_cache_io_ratio
111 + on: postgres.table_index_cache_io_ratio
112 + class: Workload
113 + type: Database
114 +component: PostgreSQL
115 + hosts: *
116 + lookup: average -1m unaligned of miss
117 + calc: 100 - $this
118 + units: %
119 + every: 1m
120 + warn: $this < (($status >= $WARNING) ? (70) : (60))
121 + crit: $this < (($status == $CRITICAL) ? (60) : (50))
122 + delay: down 15m multiplier 1.5 max 1h
123 + info: average index cache hit ratio in db $label:database table $label:table over the last minute
124 + to: dba
125 +
126 + template: postgres_table_toast_cache_io_ratio
127 + on: postgres.table_toast_cache_io_ratio
128 + class: Workload
129 + type: Database
130 +component: PostgreSQL
131 + hosts: *
132 + lookup: average -1m unaligned of miss
133 + calc: 100 - $this
134 + units: %
135 + every: 1m
136 + warn: $this < (($status >= $WARNING) ? (70) : (60))
137 + crit: $this < (($status == $CRITICAL) ? (60) : (50))
138 + delay: down 15m multiplier 1.5 max 1h
139 + info: average TOAST hit ratio in db $label:database table $label:table over the last minute
140 + to: dba
141 +
142 + template: postgres_table_toast_index_cache_io_ratio
143 + on: postgres.table_toast_index_cache_io_ratio
144 + class: Workload
145 + type: Database
146 +component: PostgreSQL
147 + hosts: *
148 + lookup: average -1m unaligned of miss
149 + calc: 100 - $this
150 + units: %
151 + every: 1m
152 + warn: $this < (($status >= $WARNING) ? (70) : (60))
153 + crit: $this < (($status == $CRITICAL) ? (60) : (50))
154 + delay: down 15m multiplier 1.5 max 1h
155 + info: average index TOAST hit ratio in db $label:database table $label:table over the last minute
156 + to: dba
157 +
158 + template: postgres_table_bloat_size_perc
159 + on: postgres.table_bloat_size_perc
160 + class: Errors
161 + type: Database
162 +component: PostgreSQL
163 + hosts: *
164 + calc: $bloat
165 + units: %
166 + every: 1m
167 + warn: $this > (($status >= $WARNING) ? (60) : (70))
168 + crit: $this > (($status == $CRITICAL) ? (70) : (80))
169 + delay: down 15m multiplier 1.5 max 1h
170 + info: bloat size percentage in db $label:database table $label:table
171 + to: dba
172 +
173 + template: postgres_table_last_autovacuum_time
174 + on: postgres.table_autovacuum_since_time
175 + class: Errors
176 + type: Database
177 +component: PostgreSQL
178 + hosts: *
179 + calc: $time
180 + units: seconds
181 + every: 1m
182 + warn: $this != nan AND $this > (60 * 60 * 24 * 7)
183 + info: time elapsed since db $label:database table $label:table was vacuumed by the autovacuum daemon
184 + to: dba
185 +
186 + template: postgres_table_last_autoanalyze_time
187 + on: postgres.table_autoanalyze_since_time
188 + class: Errors
189 + type: Database
190 +component: PostgreSQL
191 + hosts: *
192 + calc: $time
193 + units: seconds
194 + every: 1m
195 + warn: $this != nan AND $this > (60 * 60 * 24 * 7)
196 + info: time elapsed since db $label:database table $label:table was analyzed by the autovacuum daemon
197 + to: dba
198 +
199 +# Index alarms
200 +
201 + template: postgres_index_bloat_size_perc
202 + on: postgres.index_bloat_size_perc
203 + class: Errors
204 + type: Database
205 +component: PostgreSQL
206 + hosts: *
207 + calc: $bloat
208 + units: %
209 + every: 1m
210 + warn: $this > (($status >= $WARNING) ? (60) : (70))
211 + crit: $this > (($status == $CRITICAL) ? (70) : (80))
212 + delay: down 15m multiplier 1.5 max 1h
213 + info: bloat size percentage in db $label:database table $label:table index $label:index
214 + to: dba