Skip to content

Heartbeats (cron jobs)

Jobs ping a URL; late, missing and failed runs alert.

In the console: Console → Monitor → Heartbeats

All guides

A heartbeat is the reverse of a monitor: your job calls AppStatus when it runs. If the call does not come in time, AppStatus alerts. It is the right tool for cron jobs, backups, queue workers and anything that has no URL.

Why use it

  • You run cron jobs, backups, queue workers or scheduled tasks that have no URL to check.
  • You want to know when a job silently stops, runs late, or fails.
  • You want to see how long each run takes.

How it works

  1. 1Each heartbeat has a URL; your job calls it (and optionally /start and /fail).
  2. 2AppStatus expects a ping on the schedule (interval or cron with time zone) plus the grace period.
  3. 3A missing or late ping, or failures in a row, marks it down and alerts; the next good ping recovers it.
  4. 4/start then success measures the run time.

What you get

  • A private ping URL per heartbeat, or a readable URL (…/ping/<name>) authenticated with a project key in a header.
  • /start and /fail signals: run time is measured, and a reported failure counts toward the alert.
  • Schedules as an interval or a cron expression with a time zone, plus a grace period.
  • Ready-to-paste snippets for crontab, Linux, macOS, Windows Task Scheduler, Kubernetes CronJob, GitHub Actions and more.

Set it up

Get Started shows these commands with your key already filled in — copying from there is the quickest path. Here, <your-key> marks where it goes.

  1. 1

    Create the heartbeat

    Heartbeats → Add heartbeat. Give it a name, the schedule (every N minutes, or cron such as 0 2 * * *) and a grace period — how late a ping may be before the job counts as down.

  2. 2

    Add the ping to your job

    Copy the snippet for your platform. The simplest form calls the URL after the job succeeds.

    crontab
    0 2 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 -X POST https://api.appstatus.io/api/v1/heartbeats/ping/<heartbeat-key>
  3. 3

    Measure run time and report failures (optional)

    bash
    URL=https://api.appstatus.io/api/v1/heartbeats/ping/<heartbeat-key>
    curl -fsS -X POST "$URL/start"
    if /usr/local/bin/backup.sh; then
      curl -fsS -X POST "$URL"
    else
      curl -fsS -X POST "$URL/fail"
    fi

Check it works

  1. 1

    Send one ping by hand

    Run the curl line once. The heartbeat turns Up and shows the last ping time.

Use it

  1. 1

    Readable URL with a key

    Choose a project key in the heartbeat’s settings to ping …/ping/<url-name> with the key in a header instead of a secret URL. One key then serves every heartbeat of the project; keep it in the job’s environment as HEARTBEAT_API_KEY.

  2. 2

    Alert after N failures

    “Alert when down for” sets how many reported failures in a row alert. A job that goes silent alerts when its grace period ends.

Uninstall / remove

  1. 1

    Delete the heartbeat

    Heartbeats → select → Delete, then remove the curl line from the job. Pings to a deleted heartbeat are ignored.

Troubleshooting

The problems seen most, each with what to run. Still stuck? See the general Troubleshooting guide.

The job runs but the heartbeat says late

Check the time zone of the cron expression (it must match the server’s schedule) and that the ping is reached — a failing command before && skips it. Add -v to curl once to see the response.

curl: (6) Could not resolve host

The job runs where DNS or outbound HTTPS is not available (a locked-down container). Allow api.appstatus.io on 443.

401 on a readable URL

The URL-name form needs the project key in the X-API-Key header. Use the private URL instead, or set the header from the snippet.

Run time is empty

Run time is measured only when the job sends /start first and then the success ping.

Plan limits

  • Free: 3 heartbeats. Starter: 30. Pro: 100. Business: 300. Enterprise: unlimited.
Compare plans →

Something here does not match what you see in the console? Open Help → Support in AppStatus or write to support@appstatus.io with the page and what you ran.