0

I am building a new CentOS 6.4 server.

I was wondering if there is a way I can receive a warning email when the use of any partition exceeds 80% in the server.

Thanks in advance.

Xin
  • 187
  • 5

3 Answers3

2

You could always create a bash script & then have it email you:

usage=$(df | awk '{print $1,$5}' | tail -n +2 | tr -d '%');
echo "$usage" | while read FS PERCENT; do [ "$PERCENT" -ge "80" ] && echo "$FS has used ${PERCENT}% Disk Space"; done;

Obviously instead of the && echo "$FS has used ${PERCENT}% Disk Space" you would send the warning email. 

Aaron Digulla
  • 974
  • 3
  • 15
  • 25
Sayajin
  • 169
  • 2
  • 10
  • You should also check INODE usage - and it should be generic as well. So a script will get more complex than this. – Nils Jan 29 '14 at 09:35
2

Install a monitoring service like Nagios.

Aaron Digulla
  • 974
  • 3
  • 15
  • 25
1

THer are tons of products - commercial and open source - that can be used to track resource utilization in a server farm. THere is scripting with a cron job running every x minutes that a professional admin would put up in 5 minutes or less to check that and send an email when needed. So, that are two distinct ways - get a proper management suite, or do what admins do and write a script.

We do not do product recommendations here (as per FAQ) and - we assume people are not admin beginners (As per rules of this site).

TomTom
  • 51,649
  • 7
  • 54
  • 136