Skip to content

Watchdog

fleet watchdog

Check all registered apps and the docker-databases service for health issues. If any failures are found, send an alert via the configured notification adapters (Telegram).

Designed to be run on a cron schedule (e.g. every 5 minutes). Exits with code 1 if any services are unhealthy.

Usage

Terminal window
fleet watchdog [--motd]

Flags

FlagDescription
--motdDisplay failures only, do not send alerts. Always exits 0. Useful for SSH login banners.

Examples

All healthy:

Terminal window
$ fleet watchdog
All 4 services healthy

With failures:

Terminal window
$ fleet watchdog
! 2 service(s) unhealthy
worker: down (systemd: failed)
api: degraded (containers down: api-web-1; http check failed)
Alert sent

With --motd (no alerts):

Terminal window
$ fleet watchdog --motd
! 1 service(s) unhealthy
worker: down (systemd: failed)

What watchdog checks

  1. docker-databases systemd unit status
  2. For each registered app:
    • systemd unit state (must be active)
    • Container running status
    • HTTP health endpoint (if healthPath is set in the registry)

Notification configuration

Watchdog reads notify config from /etc/fleet/notify.json. It supports Telegram:

{
"telegram": {
"botToken": "123456:ABC-DEF...",
"chatId": "-100..."
}
}

Running on a cron schedule

/etc/cron.d/fleet-watchdog
*/5 * * * * root /usr/local/bin/fleet watchdog

Running as an MOTD script

/etc/update-motd.d/98-fleet-watchdog
#!/bin/bash
/usr/local/bin/fleet watchdog --motd