LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2008, 03:39 AM   #1
yusufs
Member
 
Registered: Oct 2007
Posts: 162

Rep: Reputation: 30
monitor OS


Dear all,


am monitoring the disk size, how can I write a script that if a particular disk size
reaches a threshold value , it should mail a warning to me.. How can I get this done..
am using the following code to monitor :


*****************************************************************
[root@oracle monitor]# vi sysos.sh

set -xv

LOGFILE=/home/oraprod/monitor/sysos.log

echo "Oracle Production Server system log at $(date)" > "$LOGFILE"
# log vmstat. 3 * 5 second interval. Probably better than 1 second as it
# gives more time to average out the load analysis.


df -h >> $LOGFILE

echo "" >> "$LOGFILE"


cat $LOGFILE | mail -s "System status as of $(date +%d-%b-%Y)" webmail@master.com
***************************************************************************************

how can I add a threshold value.. such that if a particular mount point reaches 75% . it should send the warninig to me. meanwhile, if you can also advise me any enhancements in the above script


any inputs ?


Thanks
Yusuf
 
Old 01-31-2008, 05:22 AM   #2
nautilus
Member
 
Registered: Jun 2007
Location: London, Athens
Distribution: Debian, Ubuntu
Posts: 36

Rep: Reputation: 15
Hello Yusuf,

I would use awk to grab the percentage from the output of df -h and then check if it is greater than 75 (or any other threshold you want) and if so send the warning email.

The awk will be something like

Code:
df -h | awk '{print $5}'

On the other hand there are open source tools that you can use to monitor pretty much everything. If you have many things to look after maybe it is worth having a look at the monit project.


I hope this helps.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
default monitor on nvidia / dual monitor setup fenderog SUSE / openSUSE 3 05-01-2009 05:36 PM
How to automatically disable dual monitor setup when only one monitor is present NielsKM Linux - Laptop and Netbook 1 01-01-2008 11:17 AM
Issue trying to dual monitor with Dell 2005FPW LCD monitor damg Linux - Hardware 2 12-05-2005 10:13 AM
New monitor problems, Fedora Cora 3, Samsung 913N monitor gingermeatboy Linux - Hardware 2 08-23-2005 08:22 AM
Booting to wrong Monitor (w/ dual monitor setup) NeoNostalgia Linux - General 1 06-30-2004 01:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration