Skip to content
Damiano Taverni
IT
← All case studies

Sector: Self-hosting · Personal project

Self-hosted automation and monitoring on Raspberry Pi

Personal 24/7 infrastructure: a Python Telegram bot on a Raspberry Pi Zero 2W for monitoring and alerting with an external dead-man switch, PiKVM for out-of-band remote management, zero exposed ports thanks to Cloudflare Tunnels.

512 MB
Available RAM
24/7
Uptime
0
Exposed ports

Architecture: Pi Zero 2W with the monitoring Telegram bot, Pi 4 with PiKVM behind a Cloudflare Tunnel

Context

A home lab is the best place to practice production-grade habits: high availability, monitoring, secure remote access — but under tighter constraints than any datacenter, starting with the power and memory budget.

What it does

  • A Python Telegram bot monitors the network’s Raspberry Pis around the clock: temperature, disk and RAM usage, load, throttling/undervoltage and uptime, with automatic alerts when thresholds are crossed (temperature, disk and memory) and a daily summary digest.
  • Through chat, the bot answers on-demand commands: full machine status, disk detail, temperature charts generated from the history (up to 30 days on SQLite), remote reboot with double confirmation.
  • Offline detection uses an external dead-man switch: every machine sends a periodic heartbeat with its metrics to an independent healthcheck service — if the ping doesn’t arrive, a notification goes out with the last known stats. That way even a failure of the monitoring system itself gets detected.
  • A Raspberry Pi 4 running PiKVM provides out-of-band remote management: video console, keyboard and power control even when the managed machine’s operating system is unresponsive.
  • Remote access goes through Cloudflare Tunnels: no port open on the router, authentication upstream of the service. External drives complete the picture for backups.

Technical challenges

Memory constraints. Running a monitoring bot reliably in 512 MB demands discipline: minimal dependencies, controlled footprint, attention to leaks across runs that last for weeks.

Who watches the watcher. A monitoring system that monitors itself is a blind spot: delegating offline detection to an independent external service removes the paradox — monitoring keeps working even when the machine running it is off.

Zero exposure. The security goal was to expose no public port at all: tunnels invert the direction of the connection, eliminating the entire attack surface of port forwarding.

Stack

Raspberry Pi Zero 2W / Pi 4 · Python · Telegram Bot API · SQLite · Healthchecks.io · PiKVM · Cloudflare Tunnel · systemd

Let's talk about your project

Tell me what you need: I will reply within 1–2 business days with an honest assessment and, if it makes sense, a quote.