Files
sysmon/deploy-agent.sh
kamaji fb79f81527 Add dashboard summary view, server detail routing, and VM listing
Rearchitect to pure aggregator dashboard (no /proc) with bare agents
on each host. Agents report VM data via sudo virsh (cached 10s).
UI rewritten with hash-based routing: summary card grid and per-server
detail view with CPU grid, memory, load, uptime, and VM table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:28:07 -06:00

50 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
HOST="${1:-console}"
PORT="${2:-8083}"
echo "Deploying sysmon agent to $HOST on port $PORT..."
# Create directory and copy app
ssh "$HOST" 'mkdir -p ~/sysmon-agent/templates'
scp ~/sysmon/app.py "$HOST":~/sysmon-agent/
scp ~/sysmon/templates/index.html "$HOST":~/sysmon-agent/templates/
# Install dependencies and set up systemd service
ssh "$HOST" PORT="$PORT" bash <<'REMOTE'
set -e
pip3 install --break-system-packages --quiet flask gunicorn 2>/dev/null || \
pip3 install --quiet flask gunicorn
# Create systemd service
sudo tee /etc/systemd/system/sysmon-agent.service > /dev/null <<EOF
[Unit]
Description=Sysmon Agent
After=network.target
[Service]
Type=simple
User=kamaji
WorkingDirectory=/home/kamaji/sysmon-agent
Environment=SYSMON_PROC=/proc
ExecStart=/usr/bin/python3 -m gunicorn -b 0.0.0.0:${PORT} -w 1 --threads 2 app:app
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable sysmon-agent
sudo systemctl restart sysmon-agent
echo "Agent status:"
sudo systemctl status sysmon-agent --no-pager -l
REMOTE
echo ""
echo "Verify: curl http://$HOST:$PORT/api/stats"