📋 Overview

When you're running a self-hosted AI assistant, monitoring is crucial. In this post, I'll show you how to set up comprehensive monitoring for your AI infrastructure on Raspberry Pi.

🎯 What We're Monitoring

  • System Resources: CPU, Memory, Temperature, Disk
  • Services: OpenClaw, nginx, Pi-hole, Cloudflare Tunnel
  • Network: Proxy status, Internet connectivity
  • AI Assistant: Response times, API availability

🛠️ Tools Used

ToolPurposePort
Uptime KumaService monitoring & alerts3001
Pi DashboardReal-time system stats8080
Telegram BotInstant notifications-
systemd timersScheduled health checks-

📊 Uptime Kuma Setup

Installation

# Already installed via PM2
pm2 status uptime-kuma

Adding Monitors

Access Uptime Kuma at http://192.168.51.74:3001

  1. Click "Add New Monitor"
  2. Choose monitor type (HTTP, Ping, Port, etc.)
  3. Configure URL/target
  4. Set interval (I use 60 seconds)
  5. Enable notifications

My Monitor Configuration

MonitorTypeTargetInterval
Pi DashboardHTTPhttp://192.168.51.74:8080/admin/60s
WebsiteHTTPhttp://henryjin8s.xyz:8080/60s
OpenClaw GatewayHTTPhttp://127.0.0.1:18789/60s
SSHTCP Port192.168.51.74:2260s
Alibaba Cloud TCPHTTPhttps://dashscope.aliyuncs.com300s

📱 Telegram Notifications

Setup Steps

  1. Create Telegram bot via @BotFather
  2. Get bot token
  3. In Uptime Kuma: Settings → Notifications
  4. Add Telegram notification
  5. Enter bot token and chat ID
  6. Test notification

Notification Script

I created a custom proxy failover monitor that sends Telegram alerts:

#!/bin/bash
# /home/henry/.openclaw/workspace/telegram-proxy-monitor.sh

TELEGRAM_BOT="YOUR_BOT_TOKEN"
CHAT_ID="YOUR_CHAT_ID"

send_alert() {
    curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT}/sendMessage" \
        -d chat_id="${CHAT_ID}" \
        -d text="$1" \
        -d parse_mode="HTML"
}

🖥️ Pi Dashboard (Custom)

I built a custom dashboard that shows:

  • Real-time CPU usage
  • Memory usage
  • Temperature
  • Disk usage
  • Top 5 processes by memory
  • Uptime Kuma monitor status

Access: http://192.168.51.74:8080/admin/

⚙️ Automated Health Checks

Proxy Failover Monitor

Runs every 2 minutes via systemd timer:

# Check status
systemctl status proxy-failover.timer

# View logs
tail -20 /home/henry/.openclaw/workspace/proxy-failover.log

What It Checks

  1. Primary proxy (192.168.51.2:7890)
  2. Backup proxy (192.168.31.11:7890)
  3. Automatically switches if primary fails
  4. Sends Telegram alert on failover

📈 Monitoring Best Practices

1. Set Appropriate Intervals

  • Critical services: 60 seconds
  • External APIs: 300 seconds
  • System resources: Real-time dashboard

2. Configure Smart Alerts

  • Don't alert on every blip
  • Use retry logic (2-3 failures before alert)
  • Set up escalation (email → Telegram → SMS)

3. Monitor What Matters

  • Service availability (up/down)
  • Response times (performance)
  • Resource usage (capacity planning)
  • Proxy status (for China users)

🎯 Key Learnings

  1. Start simple: Begin with uptime monitoring, add metrics later
  2. Alert fatigue is real: Only alert on actionable issues
  3. Test your alerts: Make sure notifications actually arrive
  4. Document everything: You'll forget why you set certain thresholds
  5. Monitor the monitor: Make sure Uptime Kuma itself is monitored

🔗 Useful Links