Welcome to Blog – iRedlof

Random Post Refresh

iRedlof Google Analytics Stats [Wordpress Plugin] Updated v2.0

Current Version: 2.0 [Updated 10-May-09] Snapshots: iRedlof GA Stats Snapshot 1 iRedlof GA Stats Snapshot 2 iRedlof GA Stats Snapshot 3 Description: iRedlof Google Analytics(GA) Stats is a wordpess admin panel...
Read More ...
Help

If you need any help, leave a comment here or mail me »

Member Login
Not a member yet? Sign Up!

Math Required!
What is the sum of: 10 + 9    

Forgot Password !

Powered by

6

Apr

2009

Shell Script To Monitor UNIX / Linux Server Disk Space

By admin. Posted in Linux Shell Script

6 Comments »   |   Share   |  


Shell script to monitor or watch the disk space and send an email alert if the (free avilable) percentage of space is >= 90%

[shell]#!/bin/sh
# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free avilable) percentage
# of space is >= 90%
# ————————————————————————-
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# ————————————————————————-
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# ———————————————————————-
# Linux shell script to watch disk space (should work on other UNIX oses )
# SEE URL: http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
# set admin email so that you can get email
ADMIN="me@somewher.com"
# set alert level 90% is default
ALERT=90
df -H | grep -vE ‘^Filesystem|tmpfs|cdrom’ | awk ‘{ print $5 " " $1 }’ | while read output;
do
#echo $output
usep=$(echo $output | awk ‘{ print $1}’ | cut -d’%’ -f1 )
partition=$(echo $output | awk ‘{ print $2 }’ )
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
mail -s "Alert: Almost out of disk space $usep" $ADMIN
fi
done[/shell]

VN:F [1.8.4_1055]
Rating: 10.0/10 (1 vote cast)
VN:F [1.8.4_1055]
Rating: +1 (from 1 vote)
Shell Script To Monitor UNIX / Linux Server Disk Space10.0101

admin Email this author | All posts by admin | Subscribe to Entries (RSS)

 

6 Responses to “Shell Script To Monitor UNIX / Linux Server Disk Space”

  1. 1
    How I Lost Thirty Pounds in Thirty Days Says:

    Hi, nice post. I have been pondering this issue,so thanks for posting. I will definitely be subscribing to your blog.

    UN:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.4_1055]
    Rating: 0 (from 0 votes)
  2. 2
    admin Says:

    Thanxs,
    you can try subscribing to email feature right side on of his page..
    cos there is some issues with post rss feature… will fix it soon..

    UA:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UA:A [1.8.4_1055]
    Rating: 0 (from 0 votes)
  3. 3
    Serviced Apartment Bangkok Says:

    You have inspired me. Thank you very much. Good luck with your site

    UN:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.4_1055]
    Rating: 0 (from 0 votes)
  4. 4
    admin Says:

    Thank you for your appreciation

    UA:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UA:A [1.8.4_1055]
    Rating: 0 (from 0 votes)
  5. 5
    Knightmayortech Says:

    thanks !! very helpful post!

    UN:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.4_1055]
    Rating: 0 (from 0 votes)
  6. 6
    john Says:

    what if your both partitions will run out of space? you will receive 2 mails. if you have more partitions, then you will receive more mails. how you do to receive all messages in one mail?

    UN:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.4_1055]
    Rating: 0 (from 0 votes)
 

Leave a Reply

You must be logged in to post a comment.

You can buy xeloda here