Check_postgres is a tool you can use to monitor PostgreSQL. You can download from the link below.
https://github.com/bucardo/check_postgres
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.
1 | mkdir postgres |
Go to newly created directory
1 | cd postgres |
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.
1 | 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.
1 | perl Makefile.PL |
1 | make |
1 | env -i make test |
1 | make install |
After completing these operations we go the check_postgres directory and run the following command. You can set the Warning and Critical values yourself.
1 | 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:
“How To Send Email From Linux“,
“How To Create Crontab Job On Linux“