LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
LinkBack Search this Thread
Old 04-20-2013, 01:52 PM   #1
theondr
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Rep: Reputation: 0
Disk Usage I need to create a script sends an email message to the user specified on


Disk Usage

I need to create a script sends an email message to the user specified on the command line if

any of the filesystems are at more than 70% of capacity. The script should not process special

filesystems as /proc. It should only process filesystems which are either locally mounted or are

mounted via NFS.

An individual email should be sent for each filesystem which is at the warning level. There should

be a subject on the email with a message "Warning: Filesystem <put filesystem the>here is at

<X>% of capacity" If the filesystem is at greater than 90% of capacity, the "Warning" should be

changed to "Critical Warning".

I may use any scripting language including /bin/sh, ksh, bash, awk or perl but not C-Shell. This

will be done on my own Linux/UNIX system.

Thank you,

Theo
 
Old 04-20-2013, 01:55 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 1,703

Rep: Reputation: 426Reputation: 426Reputation: 426Reputation: 426Reputation: 426
Have you enabled quotas?

They already give a user messages about being over a soft limit, and then again over a hard limit (at which point they can't create new files).
 
Old 04-20-2013, 04:02 PM   #3
PierreB.
Member
 
Registered: Apr 2012
Location: Grenoble
Distribution: Rhel[456],CentOS[56],fedora18
Posts: 33

Rep: Reputation: Disabled
Hi theondr,

I got something that does kind of exactly what you are asking for, you might want to check it out. I did this some time ago, might not be the most concise script i wrote but it is still on duty now, which makes me think it is not too bad...

Check this page

Let me know (here or through the blog) how it goes, i may have an updated version of this script at work, if you are interested in getting your hands on.


Regards,


Pier.

Last edited by PierreB.; 04-20-2013 at 04:05 PM.
 
Old 04-21-2013, 08:36 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
These will help you with bash
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 04-24-2013, 03:06 AM   #5
h.dilshad
LQ Newbie
 
Registered: Jan 2013
Posts: 17

Rep: Reputation: Disabled
Quote:
Originally Posted by theondr View Post
Disk Usage

I need to create a script sends an email message to the user specified on the command line if

any of the filesystems are at more than 70% of capacity. The script should not process special

filesystems as /proc. It should only process filesystems which are either locally mounted or are

mounted via NFS.

An individual email should be sent for each filesystem which is at the warning level. There should

be a subject on the email with a message "Warning: Filesystem <put filesystem the>here is at

<X>% of capacity" If the filesystem is at greater than 90% of capacity, the "Warning" should be

changed to "Critical Warning".

I may use any scripting language including /bin/sh, ksh, bash, awk or perl but not C-Shell. This

will be done on my own Linux/UNIX system.

Thank you,

Theo


I suggest you to use NAGIOS. This is a very powerful opensource software. With this you can monitor one server to thousands of servers...
 
Old 04-24-2013, 08:33 AM   #6
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Slack14_64_Multilib
Posts: 2,726
Blog Entries: 3

Rep: Reputation: 628Reputation: 628Reputation: 628Reputation: 628Reputation: 628Reputation: 628
and I'm gonna "suggest" you NOT install any software for something you can write yourself.
http://en.wikipedia.org/wiki/Snmp
Linux SNMP OIDs for CPU,Memory and Disk Statistics
Net-SNMP tutorial
 
Old 04-25-2013, 02:23 AM   #7
PierreB.
Member
 
Registered: Apr 2012
Location: Grenoble
Distribution: Rhel[456],CentOS[56],fedora18
Posts: 33

Rep: Reputation: Disabled
Agree but ...

Quote:
Originally Posted by Habitual View Post
and I'm gonna "suggest" you NOT install any software for something you can write yourself.
http://en.wikipedia.org/wiki/Snmp
Linux SNMP OIDs for CPU,Memory and Disk Statistics
Net-SNMP tutorial
I'd say i totally agree with that point of view BUT not everyone has either the skills the will or simply the time to write script, even the simpler one.

Last edited by PierreB.; 04-25-2013 at 02:59 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to disable disk usage email alerts on CentOS 5.5 AhMatt Linux - Server 3 04-24-2012 11:57 AM
Script to give the disk usage in GB for each user. Tekken Linux - Server 2 09-08-2009 07:00 AM
trying to create shell script to monitor logfile size and email an alert message cat555 Programming 3 11-13-2008 01:59 AM
Cron.daily sends me a logrotate Kill usage message. pollardd Linux - General 1 09-02-2005 12:18 PM


All times are GMT -5. The time now is 05:44 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration