2026-06-20 10:59:07 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
# xfce4-genmon panel indicator — polls colibri daemon health.
|
2026-06-20 12:16:11 +02:00
|
|
|
# Wired into a Generic Monitor panel item with 30s refresh.
|
|
|
|
|
# Output: genmon XML with green/red dot + agent count + task count.
|
2026-06-20 10:59:07 +02:00
|
|
|
# 🟢 2 agents · 3 tasks
|
|
|
|
|
# 🔴 daemon down
|
|
|
|
|
|
|
|
|
|
SOCKET="${COLIBRI_SOCKET:-/var/run/colibri/colibri.sock}"
|
|
|
|
|
|
2026-06-20 12:16:11 +02:00
|
|
|
have() {
|
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
|
}
|
2026-06-20 10:59:07 +02:00
|
|
|
|
2026-06-20 12:16:11 +02:00
|
|
|
if ! have nc || ! have python3; then
|
|
|
|
|
echo "<txt>⚠ missing deps</txt>"
|
|
|
|
|
echo "<tool>nc and python3 required for colibri panel indicator</tool>"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -S "$SOCKET" ]; then
|
2026-06-20 10:59:07 +02:00
|
|
|
echo "<txt>🔴 down</txt>"
|
2026-06-20 12:16:11 +02:00
|
|
|
echo "<tool>Colibri daemon not running (no socket at ${SOCKET})</tool>"
|
|
|
|
|
exit 0
|
2026-06-20 10:59:07 +02:00
|
|
|
fi
|
|
|
|
|
|
2026-06-20 12:16:11 +02:00
|
|
|
STATUS=$(printf '{"cmd":"status"}\n' | nc -U "$SOCKET" -w 2 2>/dev/null)
|
|
|
|
|
if [ -z "$STATUS" ]; then
|
|
|
|
|
echo "<txt>🔴 no response</txt>"
|
|
|
|
|
echo "<tool>Colibri socket exists but not responding</tool>"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AGENTS=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['agents'])" 2>/dev/null)
|
|
|
|
|
TASKS=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['tasks']['started'])" 2>/dev/null)
|
|
|
|
|
HOST=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['host'])" 2>/dev/null)
|
|
|
|
|
|
|
|
|
|
echo "<txt>🟢 ${AGENTS:-?} agents · ${TASKS:-?} tasks</txt>"
|
|
|
|
|
echo "<tool>Colibri: ${HOST:-?} | socket: ${SOCKET} | agents: ${AGENTS:-?} | started tasks: ${TASKS:-?}</tool>"
|
2026-06-25 20:03:39 +02:00
|
|
|
echo "<txtclick>kitty -T 'Colibri Status' colibri status</txtclick>"
|