# Prometheus alertmanager Migrations

> Guide to migrating Prometheus alertmanager YAML to Last9

Source: https://last9.io/docs/migrating-from-alertmanager/

## Migrating from alertmanager

It is possible to migrate the alert rules YAML file compatible with Prometheus
alertmanager to Last9 compatible alert configuration via an HTTP endpoint.

`POST /v4/organizations/{org_slug}/entities/migrate/alertmanager`

Request Body - The YAML config of alertmanager.

Response - The YAML config is compatible with Last9.

Example:

```bash
# sample.yaml contains the above YAML
curl -XPOST https://app.last9.io/api/v4/organizations/{org_slug}/entities/migrate/alertmanager \
		--data-binary @sample.yaml \
    -H "X-LAST9-API-TOKEN: Bearer $TOKEN"
```

Response:

```yaml
entities:
  - name: payment service
    type: alert-manager
    external_ref: payment service-alert-manager-alert-manager
    entity_class: alert-manager
    indicators:
      - name: "EXPR: HighRequestLatency - breach"
        query: job:request_latency_seconds:mean5m{service="payment"} > 0.5
      - name: "EXPR: HighRequestLatency - threat"
        query: job:request_latency_seconds:mean5m{service="payment"} > 0.1
    alert_rules:
      - name: High request latency
        indicator: "EXPR: HighRequestLatency - breach"
        total_minutes: 10
        bad_minutes: 10
        greater_than: 0
      - name: HighRequestLatency - threat
        indicator: "EXPR: HighRequestLatency - threat"
        total_minutes: 10
        bad_minutes: 10
        greater_than: 0
```

---

## Troubleshooting

Please get in touch with us on [Discord](https://discord.com/invite/Q3p2EEucx9) or [Email](mailto:support@last9.io) if you have any questions.
