Skip to content

Commit ea9b528

Browse files
committed
feat: add multi-backend watch monitors (docker events, systemd, pm2)
- add Monitor interface with docker/systemd/pm2 implementations - docker monitor uses event streaming for pre-death log capture - systemd monitor polls systemctl state + journalctl logs - pm2 monitor tracks restart_time + error log tail - extend Target with kind/unit fields (backward compatible) - add --kind flag to watch add command - watch start launches monitors per backend in parallel goroutines
1 parent 1e2f565 commit ea9b528

11 files changed

Lines changed: 1808 additions & 8 deletions

README.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ This is what homebutler + [OpenClaw](https://github.com/openclaw/openclaw) looks
7373
- **Backup Drill** — Verify backups actually work by booting them in isolated containers
7474
- **MCP Server** — Works with Claude Desktop, ChatGPT, Cursor, and any MCP client
7575
- **Web Dashboard** — Beautiful dark-themed web UI with `homebutler serve`
76-
- **TUI Dashboard** — Real-time terminal monitoring with `homebutler watch` (btop-style)
76+
- **Watch & History** — Track Docker container restarts, capture post-restart logs, browse restart history (`homebutler watch`)
77+
- **TUI Dashboard** — Real-time terminal monitoring with `homebutler watch tui` (btop-style)
7778
- **Wake-on-LAN** — Power on machines remotely
7879
- **Port Scanner** — See what's listening and which process owns it
7980
- **Network Scan** — Discover devices on your LAN
@@ -119,13 +120,27 @@ homebutler serve --demo # Demo mode with realistic sample data
119120

120121
</details>
121122

123+
### 🔄 Docker Restart Watch
124+
125+
`homebutler watch` tracks whether Docker containers have restarted. When a restart is detected, it captures logs and saves the record under `~/.homebutler/watch/`.
126+
127+
```bash
128+
homebutler watch add nginx # Add container to watch list
129+
homebutler watch list # Show watched containers
130+
homebutler watch check # One-shot restart check
131+
homebutler watch start # Continuous monitoring loop (default 30s)
132+
homebutler watch history # List restart history
133+
homebutler watch show <id> # Show restart details with logs
134+
homebutler watch remove nginx # Stop watching a container
135+
```
136+
122137
### 🖥️ TUI Dashboard
123138

124139
<p align="center">
125140
<img src="demo/demo-tui.gif" alt="homebutler TUI dashboard" width="800">
126141
</p>
127142

128-
> **`homebutler watch`** — A terminal-based dashboard powered by Bubble Tea. Monitors all configured servers with real-time updates, color-coded resource bars, and Docker container status. No browser needed.
143+
> **`homebutler watch tui`** — A terminal-based dashboard powered by Bubble Tea. Monitors all configured servers with real-time updates, color-coded resource bars, and Docker container status. No browser needed.
129144
130145
### 🧠 AI-Powered Management (MCP)
131146

@@ -148,7 +163,8 @@ homebutler init
148163

149164
# Run
150165
homebutler status
151-
homebutler watch # TUI dashboard (all servers)
166+
homebutler watch tui # TUI dashboard (all servers)
167+
homebutler watch start # Docker restart monitor (foreground)
152168
homebutler serve # Web dashboard at http://localhost:8080
153169
homebutler docker list
154170
homebutler wake desktop
@@ -261,7 +277,10 @@ Commands:
261277
docker list List running containers
262278
install <app> Install a self-hosted app (docker compose)
263279
alerts Show current alert status
264-
watch TUI dashboard (monitors all configured servers)
280+
watch tui TUI dashboard (monitors all configured servers)
281+
watch add/list/remove Manage watched containers
282+
watch check/start One-shot or continuous restart detection
283+
watch history/show Browse restart history
265284
serve Web dashboard (browser-based, go:embed)
266285
267286
Flags:
@@ -281,7 +300,14 @@ Run `homebutler --help` for all commands.
281300
Commands:
282301
init Interactive setup wizard
283302
status System status (CPU, memory, disk, uptime)
284-
watch TUI dashboard (monitors all configured servers)
303+
watch tui TUI dashboard (monitors all configured servers)
304+
watch add <name> Add container to restart watch list
305+
watch list Show watched containers
306+
watch remove <name> Remove container from watch list
307+
watch check One-shot restart check
308+
watch start Continuous restart monitoring loop
309+
watch history List restart history (alias: incidents)
310+
watch show <id> Show restart details with logs
285311
serve Web dashboard (browser-based, go:embed)
286312
docker list List running containers
287313
docker restart <n> Restart a container
@@ -345,13 +371,31 @@ homebutler serve --demo # demo mode with sample data
345371

346372
</details>
347373

374+
<details>
375+
<summary>🔄 Docker Restart Watch</summary>
376+
377+
`homebutler watch` tracks whether Docker containers have restarted and stores the history with captured logs under `~/.homebutler/watch/`.
378+
379+
```bash
380+
homebutler watch add myapp # register container
381+
homebutler watch start # continuous monitoring (default 30s)
382+
homebutler watch start --interval 1m # custom interval
383+
homebutler watch check # one-shot check
384+
homebutler watch history # list restart incidents
385+
homebutler watch show <id> # show incident details + post-restart logs
386+
```
387+
388+
Each incident captures the last 100 lines of container logs at the time of detection.
389+
390+
</details>
391+
348392
<details>
349393
<summary>🖥️ TUI Dashboard</summary>
350394

351-
`homebutler watch` launches an interactive terminal dashboard (btop-style):
395+
`homebutler watch tui` launches an interactive terminal dashboard (btop-style):
352396

353397
```bash
354-
homebutler watch # monitors all configured servers
398+
homebutler watch tui # monitors all configured servers
355399
```
356400

357401
Auto-refreshes every 2 seconds. Press `q` to quit.

0 commit comments

Comments
 (0)