HTTP server handleling webhooks triggered by OpenDistro Alerting and forward them using SMTP emails.
7.5K
An HTTP server which used to handle webhooks triggered by OpenDistro for Elasticsearch Alerting
As for time of writing destination options that ODFE provides are limited.
docker run --rm -p 8080:8080 youtous/odfe-alerts-handler --help
usage: odfe-alerts-handler [<flags>]
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--web.listen-address=":8080"
Address to listen on for incoming HTTP requests.
--smtp.host="localhost" SMTP server hostname.
--smtp.port=25 SMTP server port.
--smtp.username="" SMTP server login username.
--smtp.password="" SMTP server login password.
--smtp.from="opendistro@localhost" SMTP from address.
--smtp.default-subject="Opendistro Alert fired"
SMTP default subject.
--debug Enable debug mode.
Env:
LISTEN_ADDRESS Address to listen on for incoming HTTP requests.
SMTP_HOSTNAME SMTP server hostname.
SMTP_PORT SMTP server port.
SMTP_USERNAME SMTP server login username.
SMTP_PASSWORD SMTP server login password.
SMTP_FROM SMTP from address.
SMTP_DEFAULT_SUBJECT SMTP default subject.
DEBUG Enable debug mode.
Alerting > DestinationsCustom webhookDefine endpoint by URL
email set the url to have path with /email, like http://odfe-server:8080/email(alternatively, useful if the frontend fail to validate hostname) query:
POST _opendistro/_alerting/destinations
{
"name": "smtp",
"type": "custom_webhook",
"custom_webhook": {
"url": "http://alerts-smtp-forwarder:8080/email"
}
}
/email pathMessage body look like below:to: ['[email protected]', '[email protected]']
subject: 'Optional subject param'
---
This is the body of the message
Here you can use the templeting as usual...
subject is optional, if not provided the default one used, see usage.
Licensed under the MIT License. See the LICENSE file for details.
Content type
Image
Digest
Size
10.5 MB
Last updated
over 5 years ago
docker pull youtous/odfe-alerts-handler