Monitor disk space and get alerts

This guide describes how to monitor disk space and get alerted when a disk reaches a threshold.

Step 1: login to your server, edit file /opt/mistio-collectd/collectd.conf and add this at the end of the file:

<Plugin df>
MountPoint "/"
ValuesPercentage true
Save and exit. This will measure the root filesystem "/" , if you need to monitor another filesystem make sure you specify it there. Example
MountPoint "/opt"

To monitor /opt. You can also specify a Device, example /dev/xvdb1

Device "/dev/xvdb1"	
Step 2: restart collectd
root@server:~# /opt/mistio-collectd/ restart	
Step 3: Enter the page for the machine on, select 'add graph', then 'df' --> 'root' --> then 'percent_bytes'. Choose 'free' and wait a few seconds until the graphs appear. 
Step 4: You can now set a rule to get alerted. Example 
if "df percent root free"  < 10 then alert

As soon as the disk gets filled with 90% we receive an alert email

Instead of receiving an alert we could also add a command to run (eg rm some log files we know that get the disk filled)

Still need help? Contact Us Contact Us