feat(agent): auto-renice top CPU process after 2 consecutive high-CPU reports
- Agent tracks consecutive reports above cpu_threshold (default 90%) - After renice_consecutive reports (default 2 = 60s sustained), runs renice -n 19 on the top CPU process - Reports the action back in the heartbeat payload - Backend sends Telegram alert when renice is applied - All params configurable in agent.yml and install.sh flags Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
fd72eec281
commit
66088ce691
+13
-4
@@ -18,13 +18,19 @@ TOKEN=""
|
||||
API_URL=""
|
||||
INTERVAL=30
|
||||
INSTALL_DIR=""
|
||||
CPU_THRESHOLD=90
|
||||
RENICE_ENABLED=true
|
||||
RENICE_CONSECUTIVE=2
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--token=*) TOKEN="${arg#*=}" ;;
|
||||
--url=*) API_URL="${arg#*=}" ;;
|
||||
--interval=*) INTERVAL="${arg#*=}" ;;
|
||||
--dir=*) INSTALL_DIR="${arg#*=}" ;;
|
||||
--token=*) TOKEN="${arg#*=}" ;;
|
||||
--url=*) API_URL="${arg#*=}" ;;
|
||||
--interval=*) INTERVAL="${arg#*=}" ;;
|
||||
--dir=*) INSTALL_DIR="${arg#*=}" ;;
|
||||
--cpu-threshold=*) CPU_THRESHOLD="${arg#*=}" ;;
|
||||
--renice=*) RENICE_ENABLED="${arg#*=}" ;;
|
||||
--renice-consecutive=*) RENICE_CONSECUTIVE="${arg#*=}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -113,6 +119,9 @@ api_url: ${API_URL}
|
||||
token: ${TOKEN}
|
||||
interval: ${INTERVAL}
|
||||
debug: false
|
||||
cpu_threshold: ${CPU_THRESHOLD}
|
||||
renice_enabled: ${RENICE_ENABLED}
|
||||
renice_consecutive: ${RENICE_CONSECUTIVE}
|
||||
EOF
|
||||
ok "Configuración creada en ${INSTALL_DIR}/agent.yml"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user