Check_postgres is a tool you can use to monitor PostgreSQL. You can download from the link below.
If you downloaded it in zip format, we go to the relevant folder after extracting. We create a folder with the help of the command below while we are in the relevant downloaded directory.
Go to newly created directory
Using the command below, we create a symbolic link to the folder we created with the help of the command below. The following directory may vary depending on the version of check_postgres you have downloaded.
perl /home/faruk/f/check_postgres-2.24.0/check_postgres.pl --symlinks
After running the command above, you should see that it is created in the folder specified as follows.
You need to run the following commands respectively.
env -i make test
After completing these operations we go the check_postgres directory and run the following command. You can set the Warning and Critical values yourself.
check_postgres_database_size --warning='70MB' --critical='71MB'
You can create a sh file and add it to crontab and send email it to yourself.
You can use below articles: