Receive alerts from external sources in Kibana Universal Alerting
Send alerts from Datadog or another monitoring tool to the Alerts page, where you can triage them and include them in action policies like the alerts from your rules.
If you already monitor your services with another tool, you can keep its monitors and still work with their alerts in Kibana. For Datadog, you set up a connector and a webhook, and a managed workflow creates the alerts. For other tools that can send a JSON webhook, such as Zabbix, you also create the workflow that turns each request into an alert.
To receive alerts from external sources, your role needs the privileges for external alerts, and your subscription must include workflows. Refer to the subscriptions for Elastic Cloud and self-managed deployments.
The managed workflow Datadog alert translation creates alerts from the monitor webhooks that Datadog connectors receive.
The managed workflow creates one alert for each monitor and scope, which is the group that triggered it, such as a host. A monitor that fires for two hosts creates two alerts. Transitions that start with Recovered close the alert, and every other transition opens it or keeps it open. The alerts have no severity, but their data includes the monitor's priority as priority.
You don't need to create or turn on the Datadog alert translation workflow. Kibana installs this managed workflow automatically, so the setup only involves the connector and the webhook.
To receive alerts from Datadog:
- Set up a Datadog connector to receive events.
- In Datadog, create a webhook that sends monitor alerts to Kibana, then add it to your monitors.
- To check the setup, trigger a monitor or send a test from the Datadog webhook integration. An alert appears on the Alerts page, with the title of the Datadog event in the Rule column. If no alert appears, check the response that Datadog received from Kibana.
After setup, the Datadog alert translation workflow creates or updates an alert each time Datadog sends one. You don't receive alerts that fired before you added the webhook.
Any source that can send a webhook with a JSON body, such as Zabbix, can send alerts to an Inbound Webhook connector.
Create an Inbound Webhook connector. When you save it, Kibana generates a Webhook URL and an Ingest token for the connector and shows them in the flyout. Copy both before you close the flyout, because Kibana doesn't show the token again. If you lose the token, open the connector and select Rotate ingest token to get a new one.
Open Workflows from the navigation menu or the global search field. If you already have workflows, select Create workflow. Then select Start manually to open the editor with a sample workflow.
Replace the sample workflow with the following one:
name: Receive alerts from an external source enabled: true triggers: - type: inboundWebhook.received connector-id: "<connector-id>" steps: - name: create_alert_from_webhook type: alerting.create_alert with: source: "<source-name>" fingerprint: "{{ event.body.<alert-id-field> }}" alert_status: '{% if event.body.<status-field> == "<resolved-value>" %}inactive{% else %}active{% endif %}' severity: "{{ event.body.<severity-field> | default: 'info' }}" data: rule_name: "{{ event.body.<rule-name-field> }}" source_alert_url: "{{ event.body.<url-field> }}"The
inboundWebhook.receivedtrigger runs this workflow for each request that your connector receives, and thealerting.create_alertstep turns each request into an alert. Replace each placeholder, such as<connector-id>, with a value from your connector or from the source, as the following annotations describe:Replace
<connector-id>with the value in your connector's Connector ID field. You can also remove"<connector-id>", press Ctrl + Space, and select the connector from the list. To run the workflow for every Inbound Webhook connector in the space, select All connectors of this type from that list, which sets the value to"*".Replace
<source-name>with a name for the source, such aszabbix. Every alert that the workflow creates gets this name in the Source column on the Alerts page. The name can't start withelastic.Replace
<alert-id-field>with the field that identifies the alert. Requests with the samefingerprintupdate the same alert, so use a field whose value stays the same while a problem lasts. If no single field identifies the alert, replacefingerprintwithfingerprint_fields, a list of fields indatawhose values together identify it. The step also acceptsrule_id, the source's own rule ID, as a last resort. It fails if you set none of the three. Alerts from different sources or spaces stay separate, even when their fingerprints match.Replace
<status-field>with the field that holds the alert's state, and<resolved-value>with the value that marks the problem as resolved.activeopens the alert, or updates it if it's already open, andinactivecloses it. If the source reports the problem again after the alert closes, a new alert opens. If you leave outalert_status, the step usesactive. The step also acceptspendingandrecovering.Replace
<severity-field>with the field that holds the alert's severity. The value must beinfo,low,medium,high, orcritical. Any other value, including an empty one, makes the step fail, so map the source's values when they differ. Thedefaultfilter setsinfowhen the request has no severity. If the source never sends one, remove this line.Replace
<rule-name-field>with the field that names the rule, monitor, or check that raised the alert in the source. Kibana showsrule_namewhere it shows the names of its own rules, such as the Rule column on the Alerts page. Unlikesource, which stays the same for every alert,rule_namecomes from each request, so it can describe what raised each alert. You can also add other fields from the request todata, up to 100 fields in total.Replace
<url-field>with the field that holds a link to the alert in the source. In the alert's details flyout, View in source system opens this link, so you can go straight to the alert there. The link works only for URLs that start withhttp://orhttps://. If the source doesn't send a link, remove this line.For View in source system to appear, name the field in this line alert_urlinstead ofsource_alert_url.
The workflow reads each field in the source's request body as
event.body.<field>, so look at a request from the source to find the field names. For example, a source might send this body:{ "id": "disk-web-1", "name": "Disk almost full", "state": "firing", "severity": "high", "url": "https://monitoring.example.com/alerts/disk-web-1" }For that body,
<alert-id-field>isid,<status-field>isstate,<severity-field>isseverity,<rule-name-field>isname, and<url-field>isurl.<resolved-value>is the value ofstatethat marks the problem as resolved, such asresolved. If the source sends several alerts in one request, use aforeachstep to create an alert for each one.Select Save. The workflow sets
enabled: true, so it runs for each request as soon as you save it.In the source that sends the alerts, such as a monitoring tool, set up a webhook with these values:
URL: The Webhook URL that you copied in step 1.
Method: Use
POST.Body: The alert as JSON, with a
Content-Type: application/jsonheader.Authentication: An
Authorization: Bearer <ingest-token>header, where<ingest-token>is the Ingest token that you copied from the connector in step 1. If the source can't set headers, add?token=<ingest-token>to the end of the URL instead. Prefer the header, because URLs and logs can expose the token.ImportantProtect the ingest token like a password. Anyone who has it can start the connector's workflows.
To check that the connector and the workflow work, have the source send an alert. Then open the workflow and select Executions to see its execution history. Each request that Kibana accepts starts a run:
- If the run succeeded, the alert is on the Alerts page.
- If the run failed, open it to find the step that failed and why.
- If no run appears, check the HTTP status that the source received. A
202status means that Kibana accepted the request, so make sure that the workflow is enabled, is in the same space as the connector, and has your connector's ID inconnector-id. A404status means that Kibana rejected the URL or the ingest token.
For status codes, refer to Troubleshoot webhook requests.
How you stop receiving alerts depends on the source:
- Datadog: Open the Datadog connector, turn off Receive events, and save. Kibana stops accepting Datadog's requests immediately, so the managed workflow and any other workflows that the connector starts stop running.
- Other sources: Turn off the workflow that the source's connector starts. To also reject the source's requests, delete the connector.
xpack.actions.inboundEvents.enabled to false in kibana.yml, then restart Kibana. This turns off incoming requests for every connector, including connectors that start other workflows.