Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I set up an email notification on a Linux server for when a disk/volume exceeds a certain usage quota?

share|improve this question

Option 1:
Write a script that runs df, parses the output for the percent utilization & sends an email when it exceeds a given threshold, then run this script from cron.
(If you're feeling lazy you can find a bunch of pre-written scripts by asking The Knower of All Things for Unix Disk space check script.)

Option 2 (The better solution):
Deploy a monitoring system (Nagios, InterMapper, OpenNMS, etc. -- look around here for lots of suggestions & opinions), and configure it to send you a notification when your disks are filling up. While you're at it configure alerts for other stuff you might be concerned about :-)

share|improve this answer
Option 2 is definitely the better solution. We are mostly using Option 1 now, but if something fills /var too fast, you won't get any email, because it can't spool it. You may also have issues if the volume the script runs out of space, or if it writes to /tmp and it runs out of space. It is still a quick solution that works most of the time and is certainly a lot better than nothing. – Alex Jul 6 '10 at 17:00
Option 1 is great for the short term, but often results in a ton of kruft when you adapt this script to 5 functions on 10 servers. Option 2 is great for the long term, and is simpler to adapt to many server for many different checks. – Stefan Lasiewski Jul 7 '10 at 22:40
Option 1 isn't really intended as a viable a solution (it was offered only for completeness in terms of a quick hack if you're in a "this server keeps filling up, we don't know why, and we need to monitor it YESTERDAY" situation) -- That said, lots of places use it :-) – voretaq7 Jul 8 '10 at 16:00
To be more specific about Option 2, I'd recommend monit. It's the easiest monitoring tool to configure for that purpose. It can do more than that as well, and is simpler to set up IMO than something like Nagios, which is for more complicated scenarios. – Dan Aug 10 '11 at 10:40

One point for solution 2 too ! I recommend you the "Monit" software that is very light and easy to configure :

share|improve this answer
easy to install too: – rubo77 Aug 4 '13 at 3:31

+1 for option 2 above. You may think you only need to monitor disk space right now, but the reality is you almost certainly need monitoring for more than one or two servers. It will benefit you in ways that will amaze you long term.

I'd personally recommend Zenoss, it's F/LOSS, relatively easy to setup and get going, and they have great documentation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.