vCanopy will automatically notify you once your server disk space exceeds 80% capacity. This first notification happens one time, and then another will happen if your disk spaces exceed 85% capacity. This is a good time to start looking at freeing up some space on your server.
After 90%, notifications will start happening with increased frequency until the issue is resolved. This is where issues can start to happen as your system needs some free disk space to operate efficiently.
- At > 90% you’ll receive a notification once per hour
- At > 95% you’ll receive a notification every 30 minutes
- At > 98% you’ll receive a notification every 5 minutes
- At > 99% you’ll receive a notification every 60 seconds
If you exceed 90% then it’s really time to look at either freeing up some space, or increase the size of your server.
By the time you get above 95% you may begin experiencing major issues to the point where your server simply can’t function properly anymore.
These settings are pretty ideal as they are, and it’s not at all necessary to change them. However, we have received a couple of requests on how to go about setting up your own disk space warnings, and this article will show you how to do this.
If that’s of interest to you, continue below!
Step 2. SSH into your server
Please see the following articles to get started:
Step 1. Generate your SSH Key
Step 2. Add your SSH Key to vCanopy (also see Add default SSH Keys)
Step 3. Connect to your server by SSH as Root user (we like and use Termius)
Step 2. Set your notifications
The disk space notifications are handled in /etc/monit/conf.d/filesystem
. To view them, run the following command:
cat /etc/monit/conf.d/filesystem
The notification settings look as follows:
CHECK FILESYSTEM system PATH /
if space usage > 80%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 80 warning"
if space usage > 85%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 85 warning"
if space usage > 90%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 90 warning"
AND repeat every 60 cycles
if space usage > 95%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 95 warning"
AND repeat every 30 cycles
if space usage > 98%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 98 error"
AND repeat every 5 cycles
if space usage > 99%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 99 error"
AND repeat every 1 cycles
As you can see above, the 90% and above warnings each contain an instruction to repeat every X cycles. To translate that, this line is telling Monit/Slack to send a notification every X minutes, with 1 cycle equaling 1 minute.
You can use the syntax above to craft your own notifications. For example, to set a notification for when a server goes over 70%, you could add the following two lines:
if space usage > 70%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 70 warning"
If you wanted to setup a notification for once per day at 75% you could add:
if space usage > 75%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 75 warning"
AND repeat every 1440 cycles
1440 being equal to the minutes in one day.
ADDING OUR NEW NOTIFICATIONS
Now that you’ve decided what notifications you’d like to set up, we need to edit the file with the following command:
nano /etc/monit/conf.d/filesystem
Here’s how mine looks with our 2 rules for 70% and 75% added (leaving the rest as they are by default):
CHECK FILESYSTEM system PATH /
if space usage > 70%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 70 warning"
if space usage > 75%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 75 warning"
AND repeat every 1440 cycles
if space usage > 80%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 80 warning"
if space usage > 85%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 85 warning"
if space usage > 90%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 90 warning"
AND repeat every 60 cycles
if space usage > 95%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 95 warning"
AND repeat every 30 cycles
if space usage > 98%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 98 error"
AND repeat every 5 cycles
if space usage > 99%
then exec "/usr/local/bin/gpmonitor FILESYSTEM 99 error"
AND repeat every 1 cycles
Make sure your syntax is correct:
We now need to save the file with CTRL+O followed by Enter, and then exit nano with CTRL+X.
Step 3. Reload Monit
To make your changes take effect, you need to reload Monit with the following command:
monit reload
Nice work! You’re all set.