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.

Note

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:

  1. Set up a Datadog connector to receive events.
  2. In Datadog, create a webhook that sends monitor alerts to Kibana, then add it to your monitors.
  3. 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.

  1. 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.

  2. 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.

  3. 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.received trigger runs this workflow for each request that your connector receives, and the alerting.create_alert step 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:

    1. 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 "*".

    2. Replace <source-name> with a name for the source, such as zabbix. Every alert that the workflow creates gets this name in the Source column on the Alerts page. The name can't start with elastic.

    3. Replace <alert-id-field> with the field that identifies the alert. Requests with the same fingerprint update the same alert, so use a field whose value stays the same while a problem lasts. If no single field identifies the alert, replace fingerprint with fingerprint_fields, a list of fields in data whose values together identify it. The step also accepts rule_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.

    4. Replace <status-field> with the field that holds the alert's state, and <resolved-value> with the value that marks the problem as resolved. active opens the alert, or updates it if it's already open, and inactive closes it. If the source reports the problem again after the alert closes, a new alert opens. If you leave out alert_status, the step uses active. The step also accepts pending and recovering.

    5. Replace <severity-field> with the field that holds the alert's severity. The value must be info, low, medium, high, or critical. Any other value, including an empty one, makes the step fail, so map the source's values when they differ. The default filter sets info when the request has no severity. If the source never sends one, remove this line.

    6. Replace <rule-name-field> with the field that names the rule, monitor, or check that raised the alert in the source. Kibana shows rule_name where it shows the names of its own rules, such as the Rule column on the Alerts page. Unlike source, which stays the same for every alert, rule_name comes from each request, so it can describe what raised each alert. You can also add other fields from the request to data, up to 100 fields in total.

    7. 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 with http:// or https://. 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_url instead of source_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> is id, <status-field> is state, <severity-field> is severity, <rule-name-field> is name, and <url-field> is url. <resolved-value> is the value of state that marks the problem as resolved, such as resolved. If the source sends several alerts in one request, use a foreach step to create an alert for each one.

  4. Select Save. The workflow sets enabled: true, so it runs for each request as soon as you save it.

  5. 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/json header.

    • 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.

      Important

      Protect the ingest token like a password. Anyone who has it can start the connector's workflows.

  6. 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 202 status 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 in connector-id. A 404 status 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.

On self-managed, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes deployments, you can also stop receiving alerts from every source at once. Set 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.