LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Disk Usage I need to create a script sends an email message to the user specified on (https://www.linuxquestions.org/questions/linux-newbie-8/disk-usage-i-need-to-create-a-script-sends-an-email-message-to-the-user-specified-on-4175458920/)

theondr 04-20-2013 01:52 PM

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

jpollard 04-20-2013 01:55 PM

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).

PierreB. 04-20-2013 04:02 PM

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.

chrism01 04-21-2013 08:36 PM

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/

h.dilshad 04-24-2013 03:06 AM

Quote:

Originally Posted by theondr (Post 4935429)
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...

Habitual 04-24-2013 08:33 AM

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

PierreB. 04-25-2013 02:23 AM

Agree but ...
 
Quote:

Originally Posted by Habitual (Post 4937968)
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.


All times are GMT -5. The time now is 05:22 PM.