A program to send mails to report when certain threshold are met (such as disk usage)
-
Install the requirements using:
pip3 install -r requirements.txt
-
Copy .env.example as .env and modify it to your needs:
cp .env.example .env nano .env
-
Run the script once to check if everything is working:
python3 /absolute/path/to/simple-machine-reporting/check.py
-
If it works, create a cron job that runs every X minutes. Here we'll choose every 5 minutes:
-
First run:
crontab -e
-
Add the following line at the end (make sure to change the absolute path)
*/5 * * * * python3 /absolute/path/to/simple-machine-reporting/check.py
-
To test if the program is working, you can try creating a fake file with a specific size that would trigger the warning (but avoid actually maxing out your disk). Here's an example for creating a (fake) 10GB file
fallocate -l 10G gentoo_root.img
You can then remove it after receiving the mail as expected.