# Apify Run Monitor - Failed Run Alerts to Slack & Email (`gazidev/apify-run-monitor`) Actor

Scheduled health check for your Apify Actors and tasks: alerts on FAILED, TIMED-OUT or ABORTED runs, runs that never started, missed schedules, empty datasets, cost spikes and success-rate drops via Slack, Discord, Telegram, e-mail or webhook. Daily digest and HTML report.

- **URL**: https://apify.com/gazidev/apify-run-monitor.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 monitor checks

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Apify Run Monitor - Failed Run Alerts to Slack, Telegram & Email

**Apify Run Monitor** checks your own Apify Actors and tasks on a schedule and tells you when something goes wrong: **FAILED, TIMED-OUT or ABORTED runs, runs that never started, missed schedules, empty or too-small datasets, cost spikes, slow runs and success-rate drops**. Alerts go to **Slack, Discord, Telegram, e-mail (SMTP) or any webhook**, or arrive as a **daily digest**. Every check also produces a dataset of findings and an HTML report.

It uses only the official Apify API with your own token. No scraping, no third-party service, and nothing is sent anywhere unless you configure a channel.

### Why use it

- Your scheduled scrapers for clients fail at 3 a.m. and you find out when the client complains.
- A run "SUCCEEDED" but the dataset is empty because the website changed. Apify shows it as green.
- A schedule stopped firing (credit ran out, memory limit, schedule disabled) and nobody noticed.
- One run cost 10x more than usual because of a retry loop.

### What it checks

| Rule | Severity | Description |
|---|---|---|
| `run-failed` | critical | Run ended FAILED |
| `run-timed-out` | critical | Run hit its timeout |
| `run-aborted` | warning | Run ABORTED (can be turned off) |
| `run-not-started` | warning | Run stuck in READY longer than N minutes (usually the memory limit or no credit) |
| `missed-schedule` | critical | No run started in the last N hours, for listed Actors/tasks or every target of your enabled schedules |
| `low-item-count` | critical / warning | SUCCEEDED run with fewer dataset items than your minimum (0 items = critical) |
| `cost-over-limit` | warning | Run cost more than your USD limit |
| `cost-spike` | warning | Run cost N times the median of that Actor's successful runs |
| `slow-run` | warning | Run took (or is still running) longer than N minutes |
| `low-success-rate` | critical | Actor/task success rate in the window is below your percentage |
| `token-scope`, `target-not-found` | info / warning | The token cannot see something you asked for |

Findings already alerted are remembered for 30 days, so an hourly schedule does not repeat the same failed run.

### Quick start

1. Copy your API token from **Console > Settings > API & Integrations** and paste it into **Apify API token**. The field is a secret input: it is stored encrypted and only sent to `api.apify.com`.
2. Optionally list the **Actors** / **Tasks** to watch. Leave both empty to watch every run in the account.
3. Add a channel, for example a Slack incoming webhook URL. You can skip this step and just read the dataset.
4. Click **Save & Start**, then add a **Schedule** to the Actor (or a saved task of it), e.g. hourly (`0 * * * *`) with *Look back* = 24 h.

#### About the token (please read)

The token is needed because an Actor run's own token cannot list your other runs. If you leave the field empty, the Actor falls back to its own run token (`APIFY_TOKEN`). That token runs with **limited permissions** and normally sees only this run's own resources. In practice the check then finds nothing and returns one `token-scope` row explaining this. Such a "blind" check is not charged.

Prefer a token with as little access as possible. If your account offers **scoped API tokens** (Console > Settings > API & Integrations > create a new token and limit its permissions), give it **read** access to Actors, Actor tasks, Actor runs, datasets and schedules, and nothing else. The Monitor only makes GET requests to the Apify API. It never starts, aborts or changes anything.

### Input example

```json
{
  "apifyToken": "apify_api_xxx",
  "actorIds": ["yourname/shop-scraper", "https://console.apify.com/actors/AbCdEf123456789xy"],
  "lookbackHours": 24,
  "excludeOrigins": ["WEB", "DEVELOPMENT"],
  "minItems": 10,
  "maxCostUsd": "0.50",
  "costSpikeFactor": 3,
  "maxDurationMin": 60,
  "minSuccessRate": 80,
  "expectedEveryHours": 25,
  "slackWebhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX",
  "alertMinSeverity": "warning"
}
```

**Daily digest:** set `digestOnly: true` and schedule once a day. You get one message with runs, success rate and cost per Actor, plus all issues, even when everything is healthy.

**Test your setup:** `dryRun: true` builds the message and saves it to the `ALERT_PREVIEW` record without sending anything.

### Output example

One dataset row per finding (view *Findings*) plus one summary row per Actor/task (view *Per Actor / task*):

```json
{
  "kind": "finding",
  "rule": "run-timed-out",
  "severity": "critical",
  "message": "Run TIMED-OUT after 1h00m",
  "actor": "demo-user/news-feed",
  "task": null,
  "runId": "RUN00000000000007",
  "status": "TIMED-OUT",
  "origin": "SCHEDULER",
  "startedAt": "2026-11-02T07:47:15.000Z",
  "durationSec": 3600,
  "itemCount": null,
  "costUsd": 0.3,
  "isNew": true,
  "consoleUrl": "https://console.apify.com/actors/ACTBBBBBBBBBBBBB2/runs/RUN00000000000007",
  "checkedAt": "2026-11-02T09:47:15Z"
}
```

Also in the key-value store:

- `REPORT`: an HTML report with findings and a per-Actor table.
- `OUTPUT`: run summary with counts, the channels used and any alert errors.
- `ALERT_PREVIEW`: the message, written on dry runs.

Alert message (Slack / Telegram / e-mail):

```
Apify Run Monitor (yourname): 3 new issues (2 critical)
Window: last 24 h, checked 2026-11-02T09:47:15Z. 13 runs across 4 Actors/tasks, 7 succeeded.

[CRITICAL] yourname/news-feed: Run TIMED-OUT after 1h00m - 2026-11-02 07:47 UTC ($0.3000)
   https://console.apify.com/actors/.../runs/...
[CRITICAL] yourname/shop-scraper: Run SUCCEEDED but dataset has 0 items (minimum 10) ...
[WARNING] yourname/shop-scraper: Run cost $0.1900 = 9.0x the median $0.0210 ...
```

The webhook receives JSON with `subject`, `text`, `summary` and `findings[]`, ready for Make, Zapier, n8n or a PagerDuty/Opsgenie bridge.

### Pricing

Pay per event, with no monthly fee:

| Event | Price |
|---|---|
| Monitor check (per run, per 50 Actors/tasks watched) | $0.003 |
| Alert delivered (per message per channel) | $0.002 |
| Actor start | $0.00005 |

An hourly check costs about **$2.2/month**, and a daily digest about **$0.15/month**. Platform compute is minimal (256 MB, usually a few seconds).

| Tool | Price | Notes |
|---|---|---|
| **Apify Run Monitor** | $0.003 / check | Slack, Discord, Telegram, e-mail, webhook; cost spikes, missed schedules, empty datasets, digest, only-new memory, HTML report |
| apify/monitoring-runner (monitoring suite) | free | Apify's original monitoring suite, last updated June 2024 |
| apify/monitoring-checker-run-status | free | Run status checker, part of the same suite |

### FAQ

**Is my token safe?** It is a secret input (encrypted at rest, hidden in the UI and in run input). It is never logged, and it is only sent to `api.apify.com` as a Bearer header. Use a scoped read-only token if your account allows it.

**Does it watch Store Actors I run, or only my own Actors?** Both. With empty lists it checks every run in your account, including runs of other developers' Actors and of your tasks.

**Will I get the same alert every hour?** No. Findings are remembered per *State key* for 30 days. If every channel fails, nothing is marked as alerted, so the alert is retried on the next check.

**Can I monitor several clients separately?** Yes. Create one saved task per client, each with its own Actor list, channel and *State key*.

**Why did I get a `token-scope` row?** The token could not list runs. Either no token was given (the run token has limited permissions) or your scoped token lacks read access to runs.

**Organization accounts?** Use a token of the organization (or a member token with access to it).

### Use with AI agents / Apify MCP

This Actor is available through the Apify MCP server (`https://mcp.apify.com`), so Claude, ChatGPT, Cursor and other MCP clients can call it. Example prompt: *"Run gazidev/apify-run-monitor with my token for the last 48 hours and summarise which scrapers failed and why."* The agent reads the `findings` dataset view and the `OUTPUT` summary record.

***

Not affiliated with or endorsed by Apify. Uses the public Apify API with the user's own token.

# Actor input Schema

## `apifyToken` (type: `string`):

Your personal API token (Console > Settings > API & Integrations), stored encrypted and never logged or sent anywhere except api.apify.com. A scoped token with read access to Actors, Actor runs, datasets and schedules is enough. Leave empty to use this run's own token: with the default limited permissions it usually sees only this run's own resources, so the check would find nothing.

## `actorIds` (type: `array`):

Actor IDs, `username/actor-name` or Console URLs. Empty = all runs in your account (all Actors and tasks you ran, including Store Actors).

## `taskIds` (type: `array`):

Saved task IDs or Console task URLs. Empty = no task filter.

## `lookbackHours` (type: `integer`):

Runs started in this window are checked. Use the schedule interval or more (e.g. 24 for a daily check); already-alerted findings are not repeated.

## `excludeOrigins` (type: `array`):

E.g. ignore manual Console runs and only watch scheduled / API production runs.

## `maxRuns` (type: `integer`):

Safety cap for very busy accounts.

## `alertOnAborted` (type: `boolean`):

FAILED and TIMED-OUT runs are always reported.

## `minItems` (type: `integer`):

SUCCEEDED runs whose default dataset has fewer items are reported (0 items = critical). Catches scrapers that silently return nothing.

## `maxCostUsd` (type: `string`):

Report any run that cost more than this, e.g. `0.50`. 0 = off.

## `costSpikeFactor` (type: `integer`):

Report a run that cost N times the median of the same Actor's successful runs in the window (needs 3+ runs, ignores differences under $0.01). 0 = off.

## `maxDurationMin` (type: `integer`):

Report runs that took longer, including runs still RUNNING. 0 = off.

## `notStartedAfterMin` (type: `integer`):

Report runs stuck in READY (never started - usually the account memory limit or no credit). 0 = off.

## `minSuccessRate` (type: `integer`):

Report an Actor/task whose share of SUCCEEDED runs in the window is below this, e.g. 80. 0 = off.

## `minRunsForSuccessRate` (type: `integer`):

Success rate is only judged with at least this many finished runs.

## `expectedEveryHours` (type: `integer`):

Report Actors/tasks with no run started in the last N hours. Applies to the listed Actors/tasks, or - when the lists are empty - to every target of your enabled schedules. 0 = off.

## `slackWebhookUrl` (type: `string`):

https://hooks.slack.com/services/... Nothing is sent unless you fill in a channel.

## `discordWebhookUrl` (type: `string`):

https://discord.com/api/webhooks/...

## `telegramBotToken` (type: `string`):

From @BotFather (123456:ABC...). Send /start to your bot first.

## `telegramChatId` (type: `string`):

Your user, group or channel chat ID.

## `webhookUrl` (type: `string`):

Receives {subject, text, summary, findings\[]} - for Make, Zapier, n8n, PagerDuty/Opsgenie bridges or your own endpoint.

## `webhookAuthHeader` (type: `string`):

Optional, e.g. `Bearer abc123`.

## `emailTo` (type: `array`):

Requires the SMTP settings below.

## `smtpHost` (type: `string`):

E.g. smtp.gmail.com, smtp.office365.com, smtp.sendgrid.net.

## `smtpPort` (type: `integer`):

587 (STARTTLS) or 465 (SSL).

## `smtpSecurity` (type: `string`):

Match the port: STARTTLS for 587, SSL for 465.

## `smtpUser` (type: `string`):

Usually your full e-mail address.

## `smtpPassword` (type: `string`):

For Gmail/Outlook use an app password.

## `emailFrom` (type: `string`):

Defaults to the SMTP username.

## `alertMinSeverity` (type: `string`):

Critical: failed, timed-out, missed schedule, empty dataset, low success rate. Warning: aborted, not started, slow, cost, low item count.

## `onlyNewFindings` (type: `boolean`):

Remember what was already alerted (per state key, 30 days) so an hourly schedule does not repeat the same failed run.

## `digestOnly` (type: `boolean`):

Send one summary message every run - per-Actor runs, success rate, cost and all issues - even when everything is healthy. Schedule it daily for a morning report.

## `maxFindingsPerMessage` (type: `integer`):

Longer lists are cut; the dataset and REPORT always have all findings.

## `dryRun` (type: `boolean`):

Build the alert and save it to the ALERT_PREVIEW record instead of sending it.

## `includeSummaryRows` (type: `boolean`):

One extra dataset row per Actor/task with runs, success rate and cost.

## `stateKey` (type: `string`):

Separate alert memory for different monitors (e.g. one per client).

## Actor input object example

```json
{
  "lookbackHours": 24,
  "maxRuns": 3000,
  "alertOnAborted": true,
  "minItems": 1,
  "maxCostUsd": "0",
  "costSpikeFactor": 3,
  "maxDurationMin": 0,
  "notStartedAfterMin": 15,
  "minSuccessRate": 0,
  "minRunsForSuccessRate": 3,
  "expectedEveryHours": 0,
  "smtpPort": 587,
  "smtpSecurity": "starttls",
  "alertMinSeverity": "warning",
  "onlyNewFindings": true,
  "digestOnly": false,
  "maxFindingsPerMessage": 20,
  "dryRun": false,
  "includeSummaryRows": true,
  "stateKey": "default"
}
```

# Actor output Schema

## `findings` (type: `string`):

No description

## `report` (type: `string`):

No description

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

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/apify-run-monitor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("gazidev/apify-run-monitor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call gazidev/apify-run-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/apify-run-monitor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DZQirXabolg7Bsge7/builds/PKLxd2NrK1hPDcbRn/openapi.json
