diff --git a/_data/rules.yml b/_data/rules.yml index c9f3644..d4b6701 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -555,12 +555,12 @@ groups: query: 'pg_replication_lag > 30 and ON(instance) pg_replication_is_replica == 1' severity: critical - name: Postgresql table not vacuumed - description: Table has not been vacuumed for 24 hours - query: 'time() - pg_stat_user_tables_last_autovacuum > 60 * 60 * 24' + description: Table {{ $labels.relname }} has not been vacuumed for 10 days + query: '(pg_stat_user_tables_last_autovacuum > 0) and (time() - pg_stat_user_tables_last_autovacuum) > 60 * 60 * 24 * 10' severity: warning - name: Postgresql table not analyzed - description: Table has not been analyzed for 24 hours - query: 'time() - pg_stat_user_tables_last_autoanalyze > 60 * 60 * 24' + description: Table {{ $labels.relname }} has not been analyzed for 10 days + query: '(pg_stat_user_tables_last_autoanalyze > 0) and (time() - pg_stat_user_tables_last_autoanalyze) > 24 * 60 * 60 * 10' severity: warning - name: Postgresql too many connections description: PostgreSQL instance has too many connections (> 80%). @@ -629,6 +629,16 @@ groups: query: '((sum (pg_locks_count)) / (pg_settings_max_locks_per_transaction * pg_settings_max_connections)) > 0.20' severity: critical for: 2m + - name: Postgresql bloat index high (> 80%) + description: 'The index {{ $labels.idxname }} is bloated. You should execute `REINDEX INDEX CONCURRENTLY {{ $labels.idxname }};`' + query: 'pg_bloat_btree_bloat_pct > 80 and on (idxname) (pg_bloat_btree_real_size > 100000000)' + severity: warning + for: 1h + - name: Postgresql bloat table high (> 80%) + description: 'The table {{ $labels.relname }} is bloated. You should execute `VACUUM {{ $labels.relname }};`' + query: 'pg_bloat_table_bloat_pct > 80 and on (relname) (pg_bloat_table_real_size > 200000000)' + severity: warning + for: 1h - name: SQL Server exporters: