OpenUptime

Cron job and heartbeat monitoring

A job that silently stops is worse than one that fails loudly. A heartbeat monitor waits for your job to check in, and tells you when it does not.

What each check does

  • Gives you a unique URL. Your job requests it with GET or POST each time it finishes.
  • Expects a ping once per interval, the period your job runs on.

When it alerts

  • No ping within the interval plus the grace period: none, 1, 5 or 15 minutes.
  • Pings close the incident again, after as many as your recovery threshold asks for.
Examplecurl -fsS https://openuptime.app/api/heartbeat/<token>

Good to know

  • Add the ping after the job's command with &&, so a job that fails does not report in.
  • Use a grace period for jobs whose run time varies, such as backups.

On every monitor

  • Alerts by email, Slack, Discord, Teams, Telegram, PagerDuty, webhooks, Lark, ntfy and the mobile app.
  • Recovery thresholds, so an incident closes only after the service has answered several times in a row.
  • Dependencies: a monitor that depends on another stays quiet while that one is down.
  • Maintenance windows, incident history and public status pages built from the same monitors.

Try it on the Free plan

The Free plan includes 3 monitors checked every 5 minutes, with every alert channel. No card needed.

Questions

What can I monitor with a heartbeat?

Anything that runs on a schedule or should keep running: crontab entries, backups, queue workers, data imports, scheduled functions on a cloud platform and CI jobs.

Do pings use my check allowance?

No. A heartbeat monitor counts as one active monitor, but the pings your job sends use no credits.

How do I write the schedule?

Set the monitor's interval to how often the job runs. To read or write a cron expression, use the free cron tools.

定时任务与心跳监控

悄悄停掉的任务比大声报错的任务更糟糕。心跳监控等待你的任务按时报到,没报到就提醒你。

每次检查做什么

  • 给你一个唯一的 URL,任务每次完成时用 GET 或 POST 请求它。
  • 每个间隔期待一次请求,间隔就是任务运行的周期。

什么时候告警

  • 在间隔加宽限期(无、1、5 或 15 分钟)内没有收到请求。
  • 重新收到请求后故障自动结束,所需次数由恢复阈值决定。
示例curl -fsS https://openuptime.app/api/heartbeat/<token>

使用说明

  • 用 && 把请求接在任务命令之后,这样失败的任务就不会报到。
  • 运行时间不固定的任务(例如备份)可以设置宽限期。

所有监控通用

  • 通过邮件、Slack、Discord、Teams、Telegram、PagerDuty、Webhook、飞书、ntfy 和手机 App 告警。
  • 可设置恢复阈值,服务连续多次正常后故障才结束。
  • 依赖关系:依赖另一个监控的监控,在被依赖方宕机期间不会告警。
  • 维护窗口、故障历史,以及由同一组监控生成的公开状态页。

在免费版上试试

免费版包含 3 个监控,每 5 分钟检查一次,可使用全部告警渠道,无需绑定银行卡。

常见问题

心跳可以监控什么?

任何按计划运行或应该持续运行的东西:crontab 任务、备份、队列消费者、数据导入、云平台上的定时函数,以及 CI 任务。

心跳请求会消耗检查额度吗?

不会。心跳监控算作一个活跃监控,但任务发来的请求不消耗额度。

计划时间怎么写?

把监控间隔设为任务运行的频率。要阅读或编写 cron 表达式,可以使用免费的 cron 工具。