I have a ubuntu server, and facing frequent space issue, i.e. logs are eating up lot of disk space. So, I want a check to be applied, so that whenever there is less than 5 GB free disk space, I should get an e-mail notification, so that I can delete the logs. How can I configure this. Do I need any other application?
Ubuntu – Notification for Disk-Space Shortage Issue in Server
disk-space-utilizationmonitoringUbuntu
Best Answer
On my Ubuntu server, I have the following script in
/etc/cron.daily
that alerts me by email whenever/dev/sdc
(my/srv
partition) has less than 200MB of free space.It was initially taken and adapted from this blog post on nixCraft. Save this into a file in
/etc/cron.hourly
as root, modify the first 3 lines to suit your server and needs, and make the file executable. If you want to have it executed more often, save it as a script and create a regular cron job.Note that you will need something providing the
mail
command, typically from the packagesqmail-run
orcourier-mta
.