Check disk space on CloudTest servers

Document created by DPM Admin Employee on Jul 21, 2017Last modified by B-F-F08DRX on Dec 27, 2017
Version 4Show Document
  • View in full screen mode

Check disk space on CloudTest servers


To determine your root drive usage, you can run the following command, which will return the usage percentage:

df -h | head -n 3 | tail -n 1 | awk '{print $4}'


To get the usage percentage of the data folder which is usually the last drive to show up using the df command:

df -h | tail -n 1 | awk '{print $5}' 


You can then capture this percentage and use if statement to send email to the admin using sendmail command.


This script will implement the code above, to use run: [Maximum Percentage] [admin email]


For example to send alerts if the disk usage is above 80%: 80