📊 Setting Up AI Monitoring on Raspberry Pi
📋 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
| Tool | Purpose | Port |
|---|---|---|
| Uptime Kuma | Service monitoring & alerts | 3001 |
| Pi Dashboard | Real-time system stats | 8080 |
| Telegram Bot | Instant notifications | - |
| systemd timers | Scheduled 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
- Click "Add New Monitor"
- Choose monitor type (HTTP, Ping, Port, etc.)
- Configure URL/target
- Set interval (I use 60 seconds)
- Enable notifications
My Monitor Configuration
| Monitor | Type | Target | Interval |
|---|---|---|---|
| Pi Dashboard | HTTP | http://192.168.51.74:8080/admin/ | 60s |
| Website | HTTP | http://henryjin8s.xyz:8080/ | 60s |
| OpenClaw Gateway | HTTP | http://127.0.0.1:18789/ | 60s |
| SSH | TCP Port | 192.168.51.74:22 | 60s |
| Alibaba Cloud TCP | HTTP | https://dashscope.aliyuncs.com | 300s |
📱 Telegram Notifications
Setup Steps
- Create Telegram bot via @BotFather
- Get bot token
- In Uptime Kuma: Settings → Notifications
- Add Telegram notification
- Enter bot token and chat ID
- 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
- Primary proxy (192.168.51.2:7890)
- Backup proxy (192.168.31.11:7890)
- Automatically switches if primary fails
- 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
- Start simple: Begin with uptime monitoring, add metrics later
- Alert fatigue is real: Only alert on actionable issues
- Test your alerts: Make sure notifications actually arrive
- Document everything: You'll forget why you set certain thresholds
- Monitor the monitor: Make sure Uptime Kuma itself is monitored