How to setup the email alert for low disk space?

If you don't want to setup to a full monitoring solution such as Nagios you can create your own scripts for monitoring the disk space. The following script alerts you when the root partition of server is almost full:

CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
    mail -s 'Disk Space Alert' << EOF
Your root partition remaining free space is critically low. Used: $CURRENT%

The script sends an email when the disk usage cross the percentage specified by the THRESHOLD varialbe (90% here).

To run it daily, for example, save the script to the file in your home directory, change the email address with your email, and add the following line at the end of /etc/crontab file:

@daily ~/

Was this answer helpful?

 Print this Article

Also Read

[/url] missing - Memcached installation error

While Memcached installation on Centos server, I was getting the error as '[/url]

How to setup a WordPress website on plain Centos server?

The following steps have been successfully tested on a plain centos server. Now lets start...

How to install Imagic?

1. # yum install ImageM* netpbm gd gd-* libjpeg libexif gcc coreutils make 2.  # cd...

How to perform LAMP installation on CentOS?

LAMP stands for Linux, Apache, MySQL, and PHP. It is nothing but Linux operating system with...

How to setup PPTP VPN?

A Point-To-Point Tunneling Protocol (PPTP) allows you to implement your own VPN very quickly, and...

Powered by WHMCompleteSolution