Send alerts using mailgun
All Otoroshi alerts can be send on different channels. One of the ways is to send a group of specific alerts via emails.
To enable this behaviour, let’s start by create an exporter of events.
In this tutorial, we will admit that you already have a mailgun account with an API key and a domain.
Create an Mailgun exporter
Let’s create an exporter. The exporter will export by default all events generated by Otoroshi.
- Go ahead, and navigate to http://otoroshi.oto.tools:8080
- Click on the cog icon on the top right
- Then
Exporters
button - And add a new configuration when clicking on the
Add item
button - Select the
mailer
in thetype
selector field - Jump to
Exporter config
and select theMailgun
option - Set the following values:
EU
: false/true depending on your mailgun configuratinMailgun api key
: your-mailgun-api-keyMailgun domain
: your-mailgun-domainEmail addresses
: list of the recipient adresses
With this configuration, all Otoroshi events will be send to your listed addresses (we don’t recommended to do that).
To filter events on Alerts
type, we need to add the following configuration inside the Filtering and projection
section (if you want to deep learn about this section, read this part).
{
"include": [
{ "@type": "AlertEvent" }
],
"exclude": []
}
Save at the bottom page and enable the exporter (on the top of the page or in list of exporters). We will need to wait few seconds to receive the first alerts.
The projection field can be useful in the case you want to filter the fields contained in each alert sent.
The Projection
field is a json where you can list the fields to keep for each alert.
{
"@type": true,
"@timestamp": true,
"@id": true
}
With this example, only @type
, @timestamp
and @id
will be sent to the addresses of your recipients.