(c) 2018-2023 SQLEXEC LLC
GNU V3 and MIT licenses are conveyed accordingly.
Bugs can be reported @ [email protected]
Based on pg_report, but only issues email alerts/slack channel msgs and console output, no html output format. Currently the things checked for:
PG host is accepting connections
Waiting or blocked transactions
Long running queries
Idle in transaction
Idle connections
Linux Load state
High number of active connections relative to number of CPUs
Data Directory size > 75%
Streaming replication state
PGBouncer state
PGBackrest last backup state
Python, psql command line tool, postfix service
Make sure mailx is installed.
Make sure postfix service is running.
Make sure there is room for logging mail to root file (/var/spool/mail/root). Consider max size from default=50MB.
Tail /var/log/maillog for errors.
You need to put the slack webhook into a specific file location: UserHomeDirectory/.slackhook
It looks like this:
https://hooks.slack.com/services/ "somekeyvalue without the quotes and leading space"
pg_check.py -h localhost -p 5432 -U sysdba -d mydb -w -l 60 -i 30 -c 48 -e PROD -m -r -x -y
pg_check.py -h localhost -p 5432 -U sysdba -d mydb -o 2440 -e PROD -s
-w 5
--> WAITS and LOCKS checking greater than number of seconds provided
-l 60
--> queries running longer than 60 minutes
-i 30
--> idle in transaction state for more than 30 minutes
-o 2440
--> idle connections more than 2 days
-c 48
--> number of CPUs serving this PG instance (not necessary if db is on localhost)
-e PROD
--> User Context for PG instances that shows up in email subject line
-r
--> Check Replication
-x
--> Check PGBouncer
-y
--> Check PGBackrest
-m
--> Send Mail Notifications
-s
--> Send Slack Notifications