FluxGlow

How do I make a status board for a homelab or home server?

Run one shell script from cron that checks your apps, your disk and your last backup, and writes a node for each. An old tablet or a spare monitor then shows the lot as a grid of orbs.

What it looks like

board.json
{
  "title": "Homelab",
  "nodes": [
    { "id": "jellyfin", "label": "Jellyfin", "state": "ok", "badge": "Up" },
    { "id": "pihole", "label": "Pi-hole", "state": "ok", "badge": "Up" },
    { "id": "nextcloud", "label": "Nextcloud", "state": "bad", "badge": "Not answering" },
    { "id": "disk", "label": "Storage", "state": "warn", "value": "84", "unit": "% used", "badge": "Filling up" },
    { "id": "backup", "label": "Backup", "state": "ok", "badge": "Ran last night" }
  ]
}

What the states mean on a home server

StateOn a home server
ok, greenThe app answers. The disk has room. The backup ran.
warn, amberDeal with it this weekend: the disk is past 80%, a certificate is close to expiring.
bad, redThe app is not answering, the disk is nearly full, or last night's backup is missing.
run, blueA backup or an update is running now.
idle, greySwitched off on purpose.

The script

It needs bash, curl and jq. Each check ends by calling add with an id, a label, a state and a badge, so adding a check of your own is one more line.

homelab.sh
#!/usr/bin/env bash
# Writes a FluxGlow board for a home server. Run it from cron every five minutes.
set -uo pipefail

nodes='[]'
# add ID LABEL STATE BADGE [VALUE UNIT]
add() {
  nodes=$(jq -c --arg id "$1" --arg label "$2" --arg state "$3" --arg badge "$4" \
    --arg value "${5:-}" --arg unit "${6:-}" \
    '. + [{id: $id, label: $label, state: $state, badge: $badge}
          + (if $value == "" then {} else {value: $value, unit: $unit} end)]' <<<"$nodes")
}

# Web apps: up if they answer at all within five seconds.
up() {
  if curl --silent --fail --max-time 5 --output /dev/null "$3"; then
    add "$1" "$2" ok "Up"
  else
    add "$1" "$2" bad "Not answering"
  fi
}
up jellyfin "Jellyfin" http://localhost:8096/health
up pihole "Pi-hole" http://localhost/admin/
up nextcloud "Nextcloud" http://localhost:8080/status.php

# Disk: amber at 80% full, red at 90%.
used=$(df -P /srv | awk 'NR == 2 { print $5 + 0 }')
if [ "$used" -ge 90 ]; then add disk "Storage" bad "Nearly full" "$used" "% used"
elif [ "$used" -ge 80 ]; then add disk "Storage" warn "Filling up" "$used" "% used"
else add disk "Storage" ok "Plenty of room" "$used" "% used"
fi

# Backup: red if last night's archive is missing or more than 26 hours old.
if [ -n "$(find /srv/backups/latest.tar.gz -mmin -1560 2>/dev/null)" ]; then
  add backup "Backup" ok "Ran last night"
else
  add backup "Backup" bad "Missed"
fi

jq -n --argjson nodes "$nodes" --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  '{title: "Homelab", updated: $now, stale_after: 900, nodes: $nodes}' > board.json.tmp
mv board.json.tmp board.json
crontab
*/5 * * * * cd /srv/board && ./homelab.sh

The file sets "stale_after": 900. If the server itself goes down and takes the script with it, the board goes grey after 15 minutes without an update. A wall that stays green while the server is off would be worse than no wall.

Where to serve the file from

The board page needs to read the file over https, with a header that allows other sites to read it.

  • If your apps already sit behind a reverse proxy with certificates, such as Caddy or nginx, have it serve board.json as well. The hosting page has the few lines of configuration for both.
  • If not, have the script finish by copying the file to a storage bucket.

One catch with serving it from the server being watched: when the server is down, the file is out of reach too. The board handles that the same way. It keeps the last picture, goes grey, and says when it last read the file.

More checks worth adding

  • Containers that should be running, from docker ps.
  • The health of a storage pool, from zpool status -x.
  • Days left on a certificate.
  • Whether the internet connection is up, by asking for a page outside the house.
  • The temperature of the processor, as a number in the orb.

If you run an uptime monitor already

Keep it for the history and the alerts. The board is the part that sits on a shelf and can be read from the sofa. See how FluxGlow differs from other tools.

  • Can I use FluxGlow with Home Assistant?

    Yes. A short script reads the entities you choose from Home Assistant's API and writes them as a board file. Show the board on a wall tablet or a TV, or put it inside a Home Assistant dashboard with a Webpage card.

  • How do I run a dashboard on a Raspberry Pi in kiosk mode?

    Plug the Pi into the TV, then add one line to the desktop's autostart file that opens Chromium in kiosk mode at your board's address. From then on the board comes up by itself whenever the Pi has power.

  • Where can I host a board file?

    Anywhere that serves the file over https, lets other websites read it, and does not cache it for long. A storage bucket, a public GitHub repository or a web server you already run will all do.

All questions