![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Servers, email notifications | drl | Post Here to Contact Site Administrators and Moderators | 1 | 09-15-2007 04:40 PM |
| Locking a file when using VI to prevent multiple-edit sessions by diff users | Browser_ice | AIX | 14 | 11-23-2006 10:43 AM |
| Prevent file from being mailed multiple times from a job | Sree_2503 | Shell Programming and Scripting | 2 | 11-14-2006 12:47 PM |
| Sending Multiple Files through email | nbvcxzdz | Shell Programming and Scripting | 4 | 03-29-2005 09:49 AM |
| trying to turn email notifications off | oombera | Post Here to Contact Site Administrators and Moderators | 2 | 05-21-2003 03:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to prevent multiple email notifications from monitoring script
Hi everyone,
I am in the process of trying to decide the correct way to solve a particular scripting/email issue I have and would appreciate any advice. We have a cronjob running every 10 mins to check disk size on the server and if this exceeds a certain percentage then it will email a notification warning out to relevant people. However once the first email has been sent I would like it to refrain from sending a fresh email every 10 mins until the disk size have been resolved - maybe then just send a reminder every hour or two. The only way I can think of (with my limited scripting knowledge) would be to create a separate file which would be used as a 'checking' file to see when the last email was sent. So if the checking file indicates that an email was sent in the last hour then no emails will be sent etc. Hope this makes sense as did not want to write a long expanse of details. Also this is to run on Solaris 9. Any suggestions gratefully received. Thanks Si |
|
||||
|
I had an HTTP monitoring Perl script written some years ago driven by cron once every 5 minutes with similar reporting facility. What I did was even simpler - to create a state file with just "0" or "1" to indicate whether an alert mail has been sent before. When a later run sees "1", it will not send the mail again (but will still log the error). When the service is up again, the next run will reset the file content to "0". Basically, if there was no file or the file content is "0", a mail will be sent and overwrite the file with a "1" if some tests failed.
As a simple monitoring facility, it worked for me. Of course, you may wish to also save a checksum of the error message and compare against the current message to see whether the error message has changed, in which case I think another message should be sent even though some trouble mail has been sent in the past. |
|
||||
|
Hi cbkihong,
Thank you very much for the swift reply! I had not thought of that method using the error state of the command. Thinking about it this should work fine and will save me from having so many emails. Thanks again. Si |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|