Check disk space on CloudTest servers

Document created by DPM Admin Employee on Jul 21, 2017Last modified by Dave Murphy on Oct 18, 2017
Version 3Show 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.

 

The attached script will implement the code above, to use run:

check_diskspace.sh [Maximum Percentage] [admin email]

 

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

check_diskspace.sh 80 admin@email.com

Attachments

    Outcomes