I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated.
ex - 80% , 85% ,90%,95%,100% we should get an email
I tried couple of options using while loop but could not get right one
Any help is highly Appreciated
Last edited by Don Cragun; 03-05-2017 at 02:02 PM..
Reason: Add CODE tags, again.
Just to check something: if the requirement is that you get alerts at 80%, 85%, 90%, 95% and 100%, then all of these are still going to be covered by a threshold of 80%. So unless there is a particular reason you don't want alerts at (for example) 81% or 96%, then will leaving the script just to alert any time usage is above 80% not be sufficient ?
Yes that's what it is doing now
But the requirement changed to do something like this
The script should store value and keep looking if the percebtage increases with out waiting for next cycle of cronjob and send us alert
OK, thanks. The next question that comes to mind then is: if the requirement is now to get alerts more than the cron schedule permits, how are you going to be running this script differently ? If it's going to run automatically on a schedule, then it's still going to need to be run via cron or some other similar mechanism. Would it not just be easier to make the script run more regularly by adjusting its crontab entry ?
Sorry if it seems I'm being difficult, I just want to try to be sure that you're not re-inventing the wheel here needlessly. If the existing script works fine but you just need the alerts more often, the easiest thing would just be to run the script more often.
I need to change the Schudle time and need to write some thing different plan completely
I provide my current code so that to have an idea
But this is not the requirement
Alerting for every 5% increase from
The threshold value
Any suggestions how to plan ?
Quote:
Originally Posted by drysdalk
Hi,
OK, thanks. The next question that comes to mind then is: if the requirement is now to get alerts more than the cron schedule permits, how are you going to be running this script differently ? If it's going to run automatically on a schedule, then it's still going to need to be run via cron or some other similar mechanism. Would it not just be easier to make the script run more regularly by adjusting its crontab entry ?
Sorry if it seems I'm being difficult, I just want to try to be sure that you're not re-inventing the wheel here needlessly. If the existing script works fine but you just need the alerts more often, the easiest thing would just be to run the script more often.
OK, I think I'm starting to understand. Just to clarify: so you only want alerts when the disc space is at 5% increments from the threshold and up - i.e. at 80, 85, 90, 95 and 100 - and not at other times ? So you want an alert when it hits 80%, but don't want an alert again until it hits 85, 90, 95 or 100 ? And would you still want an alert if it was at, say 95%, and then fell to 80% or some other lower value that would normally trigger an alert ?
I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated.
ex - 80% , 85% ,90%,95%,100% we should get an email
I tried couple of options using while loop but could not get right one
Any help is highly Appreciated
Hi anil529,
Ignoring everything that you and drysdalk have been discussing, someone should also note that the script that you have shown us above can't possibly be doing anything useful. Everything marked in red above will cause your script to fail in various ways (mostly syntax error for ifs with not matching fis, [ with no matching ], hershold instead of $Thershold (and why Thershold instead of Threshold?), cut being used to read data from a pipeline when given file operands, and an empty alternative in an ERE. (And, I make no claim that this is a complete list of the problems in your current script!) If you are trying to modify an existing working script; PLEASE show us the actual working script!
Given this directory /web
I need to get the current usage (in %) on Linux and Unix both using the same command on bash shell ?
The command i tried was working on Unix (solaris) but does not filter the desired same value when run of Linux.
My command df -h /web | awk '{print $5}' | sed -n... (5 Replies)
Hi all
can any one help me to script monitoring
CPU load avg when reaches threshold value
and disk usage if it exceeds some %
tried using awk but when df -h out put is in two different lines awk doesnt work for the particular output in two different line ( output for df -h is in two... (7 Replies)
Issue with disk space usage
I have the following line in my "df -h" output:
Filesystem Size Used Avail Capacity Mounted on
/dev/ad4s1a 496M 495M -39M 109% /
What is the issue with having 9% excess utilisation? How can I find out what this partition is... (2 Replies)
Hi all,
FreeBSD7.1 @ sh.
In a backup script I am trying to get the blocks used by the backup once completed.
I am using the function:
#!/bin/sh
spaceused()
{
du -d 0 "${1}" | awk -F"+" '{ print $1 }
}
to return the blocks used of said directory and contents.
Via. command line... (7 Replies)
Some times my disk space is used upto 100% due to the application logs .
So this script is to monitor the disk space usage and wall message to the users about the disk space usage if it exceeds the limit set in the script. Here for example the limit is set to 80%. This job is added in cron to... (2 Replies)
Hi Guys
I am looking for a python / PERL script which will send me email when ever my disk becomes more than 90% full.
By the way my OS is Win XP.
If anybody have already has written same type of script or something very similar kind of script, that will also be very helpful.
Thanks... (1 Reply)