English
Get started

← All templates · Analytics and monitoring

Deploy Healthchecks in one click

Monitoring for cron jobs and background tasks: each job pings its URL, and you hear when a ping is late

A self-hosted alternative to Cronitor and Dead Man's Snitch.

What is Healthchecks?

Healthchecks is an open-source cron job monitoring tool, run in place of Cronitor to watch jobs that fail without a sound, such as backups and certificate renewals. Each check gets its own ping URL, which the job calls every time it runs. The check's schedule is a period or a cron expression, plus a grace time. If no ping arrives before the grace time runs out, the check goes Down and alerts go out by email, Slack, ntfy, PagerDuty, a webhook or another of its 25-plus integrations.

People self-host Healthchecks to keep job names, ping logs and the output their jobs send on a machine they control. Your own instance allows 10,000 checks per account, and a project can be shared with a team, each person as a Team Member, a Manager or Read-only. Email alerts need a mail provider, while Slack, ntfy and webhook alerts work without one.

This template runs Healthchecks' official image, version 4.4, with a Postgres 18 database that New project makes beside it, or one of yours that you pick, linked before Healthchecks first starts. That start makes its tables there and the account of the email and password you gave. Its email goes through Resend, SendGrid or Amazon SES, whichever you pick in New project, or nowhere until you pick one.

Hosting Healthchecks on Pethost

  1. You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
  2. New project opens at Healthchecks. You fill in what it asks for and click Create project: Email, Admin password.
  3. Email is optional: for Healthchecks to send it, you pick Resend, SendGrid, or Amazon SES in New project and paste in what it gives you.
  4. New project also makes a new database for Healthchecks, and links it before the app first starts: Postgres (256 MB). Or you pick one of your Postgres databases: Healthchecks gets a user and a database of its own in it, which the other apps there cannot read, and the apps in it are backed up and restored together.
  5. In a minute or two Healthchecks is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
  6. It is a project like any other: you or your agent can change it, roll it back or restore it.

Questions about Healthchecks

Is Healthchecks free and open source?

Yes. Healthchecks is under the BSD 3-Clause license, so running your own instance costs only the server. Healthchecks.io is the hosted service of the same project, run by its author.

How do I ping Healthchecks from a cron job?

End the job's crontab line with && curl -fsS -m 10 --retry 5 -o /dev/null followed by the check's ping URL. The && sends the ping only when the job exits successfully.

Can Healthchecks alert when a cron job fails?

Yes. Add /fail to the ping URL, or the job's exit status, where 0 means success and anything else a failure. A /start ping before the job also records how long each run takes.

What is the difference between Healthchecks and an uptime monitor?

An uptime monitor requests your site and alerts when it stops answering. Healthchecks does the opposite: it waits for your jobs' pings and alerts when one is missing, so it watches work that has no address.

Does Healthchecks have an API?

Yes. Its Management API lists, creates, updates, pauses and deletes checks and reads their ping logs. A slug-based ping URL ending in ?create=1 also creates a missing check on its first ping.

How much memory and disk does Healthchecks need?

Healthchecks is light: about 300 MB of memory beside its Postgres of 256 MB, and it keeps only the latest pings of each job. New project gives each of its databases the memory the template recommends, unless you change it: Postgres (256 MB). On Pethost the Starter plan is enough for it, with room for other apps beside it.

Healthchecks Docker Compose file

The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written. The machine writes how the app signs in to its databases there, as it links them. New project writes the email settings picked in it, or leaves them empty when the app sends none.

Containers: healthchecks (healthchecks/healthchecks:v4.4).

Databases, each a project of its own: Postgres (256 MB).

services:
  healthchecks:
    image: healthchecks/healthchecks:v4.4
    restart: unless-stopped
    environment:
      DB: postgres
      DB_HOST: ${DATABASE_HOST:?reload New project to link a Postgres database, or send link_databases with env_prefix DATABASE}
      DB_PORT: ${DATABASE_PORT:?reload New project to link a Postgres database, or send link_databases with env_prefix DATABASE}
      DB_NAME: ${DATABASE_NAME:?reload New project to link a Postgres database, or send link_databases with env_prefix DATABASE}
      DB_USER: ${DATABASE_USER:?reload New project to link a Postgres database, or send link_databases with env_prefix DATABASE}
      DB_PASSWORD: ${DATABASE_PASSWORD:?reload New project to link a Postgres database, or send link_databases with env_prefix DATABASE}
      SECRET_KEY: ${SECRET_KEY}
      SITE_ROOT: ${URL}
      PING_ENDPOINT: ${URL}/ping/
      SITE_NAME: Healthchecks
      DEBUG: "False"
      # Only the account below signs in: nobody signs up by the address.
      REGISTRATION_OPEN: "False"
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      # The mail provider picked in New project, by STARTTLS on its port. With none, the host is
      # empty and Healthchecks sends no mail; the port then stays a number, which it requires.
      EMAIL_HOST: ${SMTP_HOST}
      EMAIL_PORT: ${SMTP_PORT:-587}
      EMAIL_USE_TLS: "True"
      EMAIL_USE_SSL: "False"
      EMAIL_HOST_USER: ${SMTP_USER}
      EMAIL_HOST_PASSWORD: ${SMTP_PASSWORD}
      DEFAULT_FROM_EMAIL: ${SMTP_FROM:[email protected]}
    # The tables and the account are made before the server answers, the account the first time
    # only; a database that does not answer yet fails the start, and the container starts again.
    command:
      - sh
      - -c
      - |
        set -e
        ./manage.py migrate
        ./manage.py shell -c '
        import os, sys
        from django.contrib.auth.models import User
        sys.exit(0 if User.objects.filter(email=os.environ["ADMIN_EMAIL"].lower()).exists() else 1)
        ' || ./manage.py createsuperuser --email "$$ADMIN_EMAIL" --password "$$ADMIN_PASSWORD"
        exec uwsgi /opt/healthchecks/docker/uwsgi.ini

More in Analytics and monitoring