Skip to content

heartbeat:deploy

Builds and deploys a special watcher that monitors the execution history of your other watchers and fires a Slack alert if any fail to run on schedule.

Usage

Terminal window
orwell heartbeat:deploy [options]

Options

FlagDefaultDescription
--endpoint <url>$ELASTIC_ENDPOINTElasticsearch URL
--api-key <key>$ELASTIC_API_KEYAPI key authentication
--username <user>$ELASTIC_USERNAMEBasic auth username
--password <pass>$ELASTIC_PASSWORDBasic auth password
--config-path <path>./orwell.jsPath to config file
--base-dir <dir>srcRoot folder for alerts
--dry-runPrint watcher JSON without deploying
--verboseExtra logging

Configuration file

The heartbeat watcher is driven by orwell.js at the project root:

orwell.js
module.exports = {
baseDir: 'src',
heartbeat: {
projectId: 'acme', // optional prefix
alerts: [
'payments/order-failure',
'payments/refund-stuck',
'infra/disk-high',
],
action: {
slack: {
path: process.env.SLACK_HOOK_PATH,
},
},
indices: ['.watcher-history-*'],
interval: '2h',
},
};

Config fields

FieldRequiredDescription
heartbeat.alertsYesArray of {group}/{alert-name} paths to monitor
heartbeat.action.slack.pathYesSlack incoming webhook path (e.g. /services/T.../B.../...)
heartbeat.indicesYesElasticsearch indices for watcher history
heartbeat.intervalYesHow often the heartbeat runs (e.g. 1h, 30m)
heartbeat.projectIdNoPrefixes the heartbeat watcher ID

Deployed watcher ID

{projectId}-heartbeat

If projectId is not set: orwell-heartbeat.

How it works

  1. Reads orwell.js and builds a watcher that:
    • Searches .watcher-history-* for recent executions of each monitored alert.
    • Fires a Slack notification listing any alerts that have not executed in the configured interval.
  2. Deploys the watcher via PUT /_watcher/watch/{id}.

Example

Terminal window
orwell heartbeat:deploy \
--endpoint https://elastic:9200 \
--api-key $ELASTIC_API_KEY \
--config-path ./orwell.js \
--dry-run