Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Email Thresholding

by bfdi533 (Friar)
on Apr 06, 2015 at 14:17 UTC ( [id://1122560]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Email Thresholding
in thread Email Thresholding

Good thought. The email notification only needs to be rate limited for each event:
  • Event A happens, send email.
  • Event B happens 5 minutes later, send email on Event B.
  • Five minutes later there are 10 more Event A's, do not send email out for these repeated events.
  • Event C happens 30 minutes, send email.
  • Etc.

Replies are listed 'Best First'.
Re^5: Email Thresholding
by aaron_baugher (Curate) on Apr 06, 2015 at 21:33 UTC

    In that case, I'd probably have a config file that saves each event type along with a timestamp of the last email sent for that type. That could be done with any module that can save key/value pairs in a file. Then, in pseudo-code:

    when there is an event, get the type (A) if there is a timestamp saved for A and if the timestamp is less than 1 hour old do nothing otherwise send an email about A and update the timestamp for A with the current time

    Do it like that, and you can run your script as often as you like without getting extra emails.

    Aaron B.
    Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1122560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-19 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found