Micfo.com, LLC. - Official Forums  

Go Back   Micfo.com, LLC. - Official Forums > Webmaster Resource Center > Utilities & Programs

Utilities & Programs Freeware, Shareware, & Commercial programs. Discuss online tools or utility programs related to webmasters

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-12-2009, 11:50 AM
Micfo Newbie
 
Join Date: Dec 2008
Posts: 1
Disk usage monitoring script

It is very important to check the disk space usage of different partitions on Linux box.
Any partition run out fo disk space can cause several known and unknown issues.
Following is a free shell script which can be used in cron to check the disk usage of partition
and notify by sending an alert to provided email ID in script.

Quote:
#!/bin/bash

df -h | grep -v 'Use' | awk '{print $5" : "$6}' | replace '%' '' > /tmp/DiskPercent

for i in `cut -f 1 -d : /tmp/DiskPercent`

do

if [ $i -ge "90" ];

then

echo partition `grep $i /tmp/DiskPercent | cut -f 2 -d :` running out of disk space on `hostname` >> /tmp/disk-overusage

fi

done

if [ -f /tmp/disk-overusage ];
then

mail -s "URGENT `hostname` running out of disk space" support@micfo.com < /tmp/disk-overusage

fi

rm -f /tmp/disk-overusage /tmp/DiskPercent
create a file say (/home/disk-usage.sh ) give executable permissions and add in cron to run after particular time intervals (say 3 hours)
The cron would be like this.

Quote:
0 */3 * * * /home/disk-usage.sh /dev/null 2>&1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Blue Dot this Post!
Reply With Quote
  #2 (permalink)  
Old 01-13-2009, 10:36 PM
Richie's Avatar
Micfo Beginner
 
Join Date: Jan 2009
Posts: 37
Thanks Matthew for that script. I'll soon try it out for me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Blue Dot this Post!
Reply With Quote
  #3 (permalink)  
Old 01-21-2009, 03:58 AM
Moderator.
 
Join Date: Dec 2008
Posts: 82
Thanks Matthew,its surely going to be handy for everyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Blue Dot this Post!
Reply With Quote
Reply

Bookmarks

Tags
free disk partition monitoring script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -8. The time now is 11:03 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2002-2009 Micfo.com, LLC. - All Rights Reserved.