To elaborate just a bit on what Trink said, we expose an `alert` module
to our Lua sandbox, meant to be used in SandboxFilter code. It supports
immediate sending of an individual alert message as well as queueing
alerts to be sent out in a batch, and both sending mechanisms include
throttling support. Documentation is here...:
hekad.readthedocs.org/en/v0.8.0/sandbox/index.html#available-sandbox-modules
... and the (very simple) source code is here:
https://github.com/mozilla-services/heka/blob/dev/sandbox/lua/modules/alert.lua
As for integrating the functionality into your system, if you're already
using a SandboxFilter you could probably just require and start using
this alert module directly in your code. If you're not, you could set up
a SandboxFilter that catches your raw alert messages and then makes use
of the alert module to handle the throttling. Or, as Trink suggested,
you could just integrate similar functionality directly into the encoder
that you're already using.
-r
On 11/19/2014 06:27 AM, Michael Trinkala wrote:
We usually throttle them at the source like
<https://github.com/mozilla-services/heka/blob/dev/sandbox/lua/filters/http_status.lua#L85>https://github.com/mozilla-services/heka/blob/dev/sandbox/lua/filters/http_status.lua#L85
but there is nothing to prevent you from adding global throttling or
aggregation in the alert encoder (by host, plugin, application... whatever)
Trink
------------------------------------------------------------------------
*From: *"Klaus Post" <klausp...@gmail.com>
*To: *heka@mozilla.org
*Sent: *Wednesday, November 19, 2014 6:15:39 AM
*Subject: *[heka] Throttling email alerts
Hi!
I have been looking all through the documentation and source code to
see if I could find a way to throttle email sending.
I have a simple setup, where I have a simple matcher for severity <=
3 like this:
[RstEncoder]
[ErrorAlert]
type = "SmtpOutput"
message_matcher = "Severity <= 3"
send_from = "h...@xxx.com <mailto:h...@branderbirkedal.com>"
send_to = ["klausp...@xxx.com <mailto:klausp...@gmail.com>"]
auth = "none"
host = "xxx.com:25 <http://xxx.com:25>"
encoder = "RstEncoder"
However, there is the issue that if something goes wrong, various
subsystems like syslog, individual applications start spewing out
errors at a steady rate, often resulting in thousands of mails being
sent.
Is there a way to limit the number of emails with configuration or
does anyone have a lua script that can do this?
Also, thanks for the great work on heka!
Regards, Klaus Post
http://www.klauspost.com
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka