From 273d83be64549f1b2924abc1e0b9e9a882ea364f Mon Sep 17 00:00:00 2001 From: Salt Date: Thu, 9 Dec 2021 16:17:49 -0600 Subject: [PATCH] Add a check for old, uncommited PostgreSQL transactions Sometimes reading the blogs of developers whose software you use is worth it --- playbooks/prod_web.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/playbooks/prod_web.yml b/playbooks/prod_web.yml index 4ac2a57..51bbe80 100755 --- a/playbooks/prod_web.yml +++ b/playbooks/prod_web.yml @@ -253,6 +253,10 @@ - name: PSQL Connections command: "check_by_ssh!/usr/lib/nagios/plugins/check_pgsql -H localhost -l nagios -p {{ secret_postgresql_monitoring_password }} -w 2 -c 5 -q 'select (select count(*)::float used from pg_stat_activity) / (select setting::int max_conn from pg_settings where name=\\$\\$max_connections\\$\\$)' -W 0.7-0.8 -C 0.8-1.0" hostgroup: tag-nagios-checkpgsql + # https://rhaas.blogspot.com/2020/02/useless-vacuuming.html + - name: PSQL Old Xacts + command: "check_by_ssh!/usr/lib/nagios/plugins/check_pgsql -H localhost -l nagios -p {{ secret_postgresql_monitoring_password }} -w 2 -c 5 -q 'select count(*)::float from pg_prepared_xacts where age(transaction) > 5000000' -C 1-1000000" + hostgroup: tag-nagios-checkpgsql - name: Unit postgresql.service command: check_by_ssh!/usr/local/bin/monitoring-scripts/check_systemd_unit postgresql.service hostgroup: tag-nagios-checkpgsql