# Alertmanager Extractor (`datamule/alertmanager-extractor`) Actor

Point at any Prometheus Alertmanager v2 API and export active/silenced alerts, grouped alerts, silences, receivers and cluster status as clean rows. Labels, annotations, state and ISO-normalized timestamps. One actor over every Alertmanager-compatible host.

- **URL**: https://apify.com/datamule/alertmanager-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 alert records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Alertmanager Extractor

**Point at any Prometheus Alertmanager and export its alerts, silences, and status as clean, tabular rows.**
One actor works against every server that speaks the [Alertmanager HTTP API v2](https://github.com/prometheus/alertmanager/blob/main/api/v2/openapi.yaml) —
Prometheus Alertmanager itself and every API-compatible host (the Cortex / Mimir / Grafana
alertmanagers). Give it a base URL and a mode; get back rows you can pipe into a sheet,
a dataset, a webhook, or another tool.

No Alertmanager UI, no Grafana, no per-server scraper. Just the standard v2 API,
turned into structured data.

### What it does

Five extraction modes, each turning an Alertmanager endpoint into flat rows:

| Mode | Endpoint | One row per… |
|------|----------|--------------|
| `alerts` *(default)* | `/api/v2/alerts` | alert currently known to Alertmanager (labels, annotations, state, starts/ends/updated) |
| `alerts_groups` | `/api/v2/alerts/groups` | alert in the grouped notification view, tagged with its group's labels + receiver |
| `silences` | `/api/v2/silences` | silence (id, state, matchers, schedule window, creator, comment) |
| `receivers` | `/api/v2/receivers` | configured receiver name |
| `status` | `/api/v2/status` | server: cluster status + peers, version, build, uptime, loaded config |

### Example input

```json
{
  "sources": ["https://demo.promlabs.com/alertmanager"],
  "mode": "alerts"
}
```

Only the critical alerts, across several Alertmanagers at once:

```json
{
  "sources": [
    "https://demo.promlabs.com/alertmanager",
    "https://alertmanager.demo.prometheus.io"
  ],
  "mode": "alerts",
  "filter": ["severity=critical"]
}
```

List active silences, inspect the grouped view, or read cluster status:

```json
{ "sources": ["https://demo.promlabs.com/alertmanager"], "mode": "silences" }
```

```json
{ "sources": ["https://demo.promlabs.com/alertmanager"], "mode": "alerts_groups" }
```

```json
{ "sources": ["https://demo.promlabs.com/alertmanager"], "mode": "status" }
```

### Input reference

- **sources** *(required)* — one or more Alertmanager base URLs. Give the bare base
  (`https://demo.promlabs.com/alertmanager`) and the actor appends the right
  `/api/v2` path per mode, or paste a full `/api/v2/alerts` URL. A reverse-proxy
  sub-path (`https://host/alertmanager`) is honored.
- **mode** — one of the five modes above (default `alerts`).
- **filter** — zero or more Alertmanager label matchers applied to
  `alerts` / `alerts_groups` / `silences` (e.g. `severity=critical`,
  `alertname=~Demo.*`, `job=demo`). Each is sent as a repeated `filter=` parameter.
- **active / silenced / inhibited / unprocessed** — booleans that restrict the
  alert set (`alerts` / `alerts_groups`; `unprocessed` is alerts-only). All
  default to true (Alertmanager's own default = every alert).
- **receiver** — an optional receiver-name regex (`alerts` / `alerts_groups`).
- **maxRecords** — a global cap on emitted rows (each row is one event).
- **bearer / extraHeaders** — optional auth for a gated server (never logged).
  `extraHeaders` also carries things like a Cortex/Mimir `X-Scope-OrgID` tenant header.

### Output

Each row is a flat object with a shared schema across all modes — a `_type` /
`_mode` tag, plus the mode-specific columns. For alerts: `alertName`,
`alertState`, `severity`, the full `labels` and `annotations` objects,
`startsAt` / `endsAt` / `updatedAt`, `fingerprint`, `generatorURL`,
`receiverNames`, and `silencedBy` / `inhibitedBy`. Timestamps are RFC3339, so
they're normalized to a canonical ISO-8601 `Z` form (with the original kept in
the matching `*Raw` field). The original API object is preserved losslessly in
`_raw`.

Example (`alerts` mode):

```json
{
  "_type": "alert",
  "_mode": "alerts",
  "fingerprint": "574d7080805ecc54",
  "alertName": "DemoServiceHighErrorRate",
  "alertState": "active",
  "severity": "critical",
  "labels": { "alertname": "DemoServiceHighErrorRate", "job": "demo", "severity": "critical" },
  "annotations": { "title": "High 5xx rate for POST on /api/foo" },
  "startsAt": "2026-07-08T03:15:46.810000Z",
  "endsAt": "2026-07-08T03:48:31.810000Z",
  "receiverNames": ["noop"]
}
```

### Behavior & reliability

- **Multi-source, fault-tolerant.** A source that is auth-gated, unreachable,
  rate-limited, or that doesn't implement the v2 API (a bare Prometheus returns a
  404\) is skipped with a warning; the run continues.
- **Honest failures.** A malformed `filter` matcher makes the API return an HTTP
  400 (`bad matcher format: ...`); the actor surfaces that as a real failure
  rather than silently returning nothing. If *every* source is unreachable, the
  run fails rather than reporting a misleading empty success. A reachable host
  with zero alerts (or zero silences) is a **valid** empty result and exits clean.

### Pricing

Pay-per-event: you're charged per row emitted to the dataset. Point it at a
single Alertmanager or a whole fleet; use `maxRecords` to cap a busy host, and
`filter` to narrow to just the alerts you care about.

### Notes

This actor talks to the **read** side of the Alertmanager HTTP API v2 over plain
HTTP(S) JSON. It needs network reach to the server you point it at (a public
demo, an internal Alertmanager behind a token, a hosted Cortex/Mimir/Grafana
alertmanager). It does not require Grafana or any Prometheus client library. The
v2 API is the current interface; the removed v1 API is not targeted.

# Actor input Schema

## `sources` (type: `array`):

One or more Prometheus Alertmanager base URLs. Any server that speaks the Alertmanager HTTP API v2 works. Give the bare base (https://demo.promlabs.com/alertmanager) and the actor appends the right /api/v2 path per mode, or paste a full /api/v2/alerts URL. A reverse-proxy sub-path (https://host/alertmanager) is honored.

## `mode` (type: `string`):

What to extract. alerts (default): one row per alert at /api/v2/alerts (labels, annotations, state, timestamps). alerts\_groups: the grouped notification view at /api/v2/alerts/groups. silences: one row per silence at /api/v2/silences (matchers, schedule, status). receivers: configured receiver names at /api/v2/receivers. status: cluster + version + config singleton at /api/v2/status.

## `filter` (type: `array`):

Zero or more Alertmanager label matchers to restrict alerts / alerts\_groups / silences. Examples: severity=critical  or  alertname=~Demo.\*  or  job=demo. Each matcher is sent as a repeated filter= parameter. Leave empty to return everything.

## `active` (type: `boolean`):

Whether to include currently-firing (active) alerts (alerts / alerts\_groups modes). Default true.

## `silenced` (type: `boolean`):

Whether to include alerts suppressed by a silence (alerts / alerts\_groups modes). Default true.

## `inhibited` (type: `boolean`):

Whether to include alerts suppressed by an inhibition rule (alerts / alerts\_groups modes). Default true.

## `unprocessed` (type: `boolean`):

Whether to include alerts received but not yet processed into a notification pipeline (alerts mode only). Default true.

## `receiver` (type: `string`):

Optional receiver-name regular expression to restrict alerts / alerts\_groups to alerts routed to matching receivers. Leave empty for all receivers.

## `maxRecords` (type: `integer`):

A GLOBAL cap on the number of rows to emit across all sources (each row is one billable event). Leave empty to emit everything. A busy Alertmanager can hold thousands of alerts, so a cap is useful.

## `bearer` (type: `string`):

Optional bearer token for an Alertmanager behind auth (sent as Authorization: Bearer \*\*\*). Not required for open servers. Never logged.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers as a JSON object, e.g. {"x-scope-orgid": "tenant-a"} (Cortex/Mimir multi-tenant) or a cookie for a gated server. Header values are never logged.

## Actor input object example

```json
{
  "sources": [
    "https://demo.promlabs.com/alertmanager"
  ],
  "mode": "alerts",
  "active": true,
  "silenced": true,
  "inhibited": true,
  "unprocessed": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sources": [
        "https://demo.promlabs.com/alertmanager"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/alertmanager-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "sources": ["https://demo.promlabs.com/alertmanager"] }

# Run the Actor and wait for it to finish
run = client.actor("datamule/alertmanager-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sources": [
    "https://demo.promlabs.com/alertmanager"
  ]
}' |
apify call datamule/alertmanager-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/alertmanager-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/ClrzzR57b3vdKC4k5/builds/3sNEzfpFZNmyNN3e5/openapi.json
