feat: send agent.heartbeat on service startup (2.0.5-SAC)

After agent.lifecycle on boot, send heartbeat so SAC marks host online until next interval.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-12 11:51:16 +10:00
parent 42af3b1ae6
commit 4cd1a85b3e
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -7,7 +7,7 @@ IFS=$'\n\t'
# ============================================
CONFIG_FILE="/etc/ssh-monitor.conf"
SSH_MONITOR_VERSION="2.0.4-SAC"
SSH_MONITOR_VERSION="2.0.5-SAC"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then
@@ -1976,6 +1976,7 @@ send_startup_notification() {
lifecycle_details="$(NOTIFICATION_BODY="$message" python3 -c 'import json, os; print(json.dumps({"lifecycle":"started","trigger":"boot","notification_body":os.environ["NOTIFICATION_BODY"]}, ensure_ascii=False))')"
notify_or_sac "agent.lifecycle" "info" "Мониторинг запущен" "ssh-monitor started" "$message" "$lifecycle_details"
write_log "Скрипт мониторинга запущен (белый список: $whitelist_count записей)"
send_heartbeat
}
send_shutdown_notification() {