# Know when a host goes dark

> A cron or systemd-timer heartbeat that raises an incident when a machine stops checking in.

Web page: https://infrainbox.app/docs/cookbook/host-down/

**You'll get:** an incident when a server, NAS or Raspberry Pi stops checking in — whether it crashed, lost power, or lost the network — instead of you finding out when you next try to use it.

## Before you start

Create a heartbeat monitor for the host (see [Heartbeat monitors](https://infrainbox.app/docs/sources/heartbeats.md)) and set its expected interval and grace period to match how often you'll ping it — for example, an interval of 5 minutes with a couple of minutes' grace, so one missed network blip doesn't open an incident. Copy the monitor's key, shaped like `iik_hb_…`.

## 1. Ping it on a schedule

From cron, on the host you want watched:

```cron
*/5 * * * * curl -fsS -m 10 --retry 3 https://infrainbox.example.com/v1/heartbeats/iik_hb_XXXXXXXXXXXX >/dev/null 2>&1
```

Or, without cron, a systemd timer:

```ini
# /etc/systemd/system/infrainbox-heartbeat.service
[Unit]
Description=Ping InfraInbox heartbeat

[Service]
Type=oneshot
ExecStart=/usr/bin/curl -fsS -m 10 --retry 3 https://infrainbox.example.com/v1/heartbeats/iik_hb_XXXXXXXXXXXX
```

```ini
# /etc/systemd/system/infrainbox-heartbeat.timer
[Unit]
Description=Ping InfraInbox every 5 minutes

[Timer]
OnBootSec=2min
OnUnitActiveSec=5min

[Install]
WantedBy=timers.target
```

```bash
sudo systemctl enable --now infrainbox-heartbeat.timer
```

A plain ping like this is always a success: it doesn't matter which form you use, as long as it arrives before the interval and grace period run out.

## Check it works

- The monitor shows **Up** in the dashboard within a few minutes of setting this up.
- Stop the timer (or unplug the host, if you're brave): once the interval plus grace period elapses with no ping, the monitor flips to **Down** and an incident opens.
- Bring it back: the next ping resolves the incident automatically.

## The honest limit

> **Warning:** This only proves *the monitored host* is still checking in. It says nothing if it's InfraInbox's own server, or the network path between the two, that goes dark — nothing is left to notice the silence, because the alerting engine that would raise that incident is down too. If you self-host InfraInbox, put it on different power and network paths than the hosts you're watching with it, and consider a genuinely separate, off-site check on InfraInbox's own reachability. An off-site watchdog for exactly this gap is planned for InfraInbox Cloud.
