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:
+2
-1
@@ -7,7 +7,7 @@ IFS=$'\n\t'
|
|||||||
# ============================================
|
# ============================================
|
||||||
|
|
||||||
CONFIG_FILE="/etc/ssh-monitor.conf"
|
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)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then
|
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))')"
|
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"
|
notify_or_sac "agent.lifecycle" "info" "Мониторинг запущен" "ssh-monitor started" "$message" "$lifecycle_details"
|
||||||
write_log "Скрипт мониторинга запущен (белый список: $whitelist_count записей)"
|
write_log "Скрипт мониторинга запущен (белый список: $whitelist_count записей)"
|
||||||
|
send_heartbeat
|
||||||
}
|
}
|
||||||
|
|
||||||
send_shutdown_notification() {
|
send_shutdown_notification() {
|
||||||
|
|||||||
+2
-1
@@ -1 +1,2 @@
|
|||||||
2.0.4-SAC
|
2.0.5-SAC
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user