DBTuna Free Trial

Check Free Space on Linux


Proactive monitoring of free space is essential in order to get early warnings to drives or filesystems which could run out of space and affect your application or database. A simple command to check free space on Linux and then integrated into a DBTuna/Alert is as follows:

df -h | grep mysqldata | awk '{print $5}' | sed 's/[[:punct:]]//g'

The logic of this alert is to run df -h to get filesystem information, then grep for a specific filesystem (in this case mysqldata), then awk out the Use% column, then remove the percentage sign using sed, in order to return just a numeric value.

N.B. if the output from df -h displays an lvm which creates a new line due to the length, then switch the column you are awk'ing for to $4 e.g. df -h | grep mysqldata | awk '{print $4}' | sed 's/[[:punct:]]//g'

You can now add this into DBTuna/Alerts and receive a proactive alert as soon as free space becomes an issue e.g. 90% used etc.


Next Step - Improve Your Database Performance now with DBTuna: REQUEST A DEMO START A FREE TRIAL