> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ewake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Alertmanager & Grafana alerts

> Point Alertmanager or a Grafana contact point at ewake. Each alert starts an investigation, with no Slack channel in between.

> [!NOTE]
>
> **What you'll get:** Alertmanager or Grafana sends its alerts straight to ewake. Ewake picks up each alert, starts investigating, and posts an alert card that shows its live plan while it works. No alert bot and no Slack channel in between.

***

## How it works

Alertmanager and a Grafana contact point send the same webhook payload, so one flow takes either sender.

* **One investigation per alert.** A notification can group several alerts. Ewake starts one investigation for each alert in the group.
* **No repeat runs.** Alertmanager sends an open alert again on `group_interval` and `repeat_interval`. Ewake ignores these reminders while the alert stays open.
* **Resolves close the loop.** When the alert resolves, its card turns from red to green.
* **Labels are fields.** Every label and annotation of the alert becomes an attribute that you can filter and route on, for example `attributes.severity` or `attributes.namespace`. The `summary` annotation becomes the title, and `description` becomes the body.

This is different from the [Grafana](https://docs.ewake.ai/integrations/observability/grafana.md) and [Grafana datasources](https://docs.ewake.ai/integrations/observability/grafana-datasources.md) integrations. Those let ewake **read** your metrics and dashboards during an investigation. This page is about how alerts **reach** ewake. Connect both for the best results.

***

## Prerequisites

* **Slack connected**, and ewake invited to the channels where it posts its answers. See [Add Ewake to a channel](https://docs.ewake.ai/get-started/connect-slack.md#add-ewake-to-a-channel).
* Access to `alertmanager.yml`, or permission to edit **Contact points** in Grafana.
* A network path from Alertmanager or Grafana to ewake. See [Which URL to use](#which-url-to-use).

***

## Create the flow in ewake

**1. Start a new event flow**

In your ewake dashboard, click **On-call** in the sidebar, then **New on-call agent**, then **An event**.

**2. Choose how ewake answers**

Pick **Post in an on-call channel**. An alert pushed from Alertmanager or Grafana has no Slack message to reply under, so ewake posts one card per alert in the channels you pick.

**3. Choose Alertmanager / Grafana**

Under **Where do the events come from?**, pick **Alertmanager / Grafana**.

**4. Finish the flow**

Pick what ewake investigates and where it answers, then the report and the follow-ups. See [Create a flow](https://docs.ewake.ai/working-with-ewake/on-call-agent.md#create-a-flow) for each step. Click **Create the flow**.

**5. Copy the endpoint and the token**

The last step shows the endpoint, the token and the connect steps for both senders.

> [!WARNING]
>
> The token shows once. Copy it before you leave the step. You can rotate it later from the flow's page, and the old token stops working at once.

Then connect the sender: [Alertmanager](#connect-alertmanager) or [Grafana](#connect-grafana).

***

## Connect Alertmanager

**1. Add the receiver**

In `alertmanager.yml`, add this entry to the `receivers` list. Ewake fills in the URL and the token for you.

```yaml theme={null}
- name: ewake-<flow-name>
  webhook_configs:
    - url: <webhook URL>
      send_resolved: true
      http_config:
        authorization:
          credentials: <token>
```

Keep `send_resolved: true`. Without it, ewake never learns that the alert resolved, and the card stays red.

> [!TIP]
>
> If `alertmanager.yml` is in git, for example in Helm values, do not commit the token. Mount it from a secret, and replace `credentials` with `credentials_file` and the path of that file.

**2. Add the route**

Add this entry **first** in the `route.routes` list:

```yaml theme={null}
- receiver: ewake-<flow-name>
  matchers:
    - severity="critical"
  continue: true
```

Change the `matchers` so that they select only the alerts ewake should investigate. `continue: true` lets the routes after it match the same alert, so your existing receivers still get it.

> [!WARNING]
>
> Do not remove the `matchers`. A route with no matchers takes every alert away from your default receiver.

**3. Reload Alertmanager**

Reload or restart Alertmanager.

> [!TIP]
>
> Alertmanager is connected. The next alert that matches the route starts an investigation, and its card appears in the channels of the flow.

***

## Connect Grafana

**1. Add a contact point**

In Grafana, go to **Alerting** → **Contact points** and click **Add contact point**. Pick the **Webhook** integration and paste the webhook URL from ewake as the **URL**.

**2. Set the authorization header**

Under **Optional Webhook settings**, set:

| Field | Value |
| - | - |
| **Authorization Header - Scheme** | `Bearer` |
| **Authorization Header - Credentials** | the token from ewake |

Leave **Title**, **Message** and **Custom Payload** empty. Ewake reads Grafana's default payload.

**3. Send alerts to it**

Save the contact point. Then send alerts to it from a **notification policy**, or select it on the alert rule itself.

> [!TIP]
>
> Grafana is connected. The next alert routed to this contact point starts an investigation.

***

## Which URL to use

Alertmanager and Grafana usually run inside your own network. So ewake gives this flow a **Webhook URL** on your dashboard host, which your network already reaches.

When your dashboard host is not the public entry of ewake, as on some self-hosted installs, ewake also shows a **Public URL** below it. Use the public URL if your sender cannot reach the first one, and for **Grafana Cloud**, which runs outside your network.

***

## Troubleshooting

> [accordion] No card appears after an alert fires
>
> * Check that ewake is invited to every channel the flow answers in. Ewake cannot post in a channel it is not a member of.
> * Check that the flow is **On** on the **On-call** page.
> * Check that the alert matches your Alertmanager route, or that your notification policy sends it to the contact point.
> * Check the flow's filter and exclusions. Open the flow and look at **Recent events through this flow**: an alert that ewake received but skipped is counted there.

> [accordion] The card stays red after the alert resolved
>
> Alertmanager sends the resolve only when `send_resolved: true` is set on the receiver. Grafana sends it by default.

> [accordion] Alertmanager logs a 401
>
> The token is wrong, or it was rotated. Rotate it again from the flow's page, then update `credentials` in the receiver, or the credentials of the contact point.

> [accordion] Some alerts of a large group never reach ewake
>
> If you set `max_alerts` on the receiver, Alertmanager leaves the other alerts of the group out of the notification. Ewake never receives them. Remove `max_alerts`, or raise it.

***

Need help setting this up? Contact [support@ewake.ai](https://docs.ewake.ai/support.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.