diff --git a/sac-client.sh b/sac-client.sh index e4c163f..30158f4 100644 --- a/sac-client.sh +++ b/sac-client.sh @@ -228,7 +228,7 @@ sac_send_event() { SAC_DETAILS_JSON="$details_json" \ SAC_AGENT_ID="$(sac_agent_instance_id)" \ SAC_PRODUCT_VERSION="${SSH_MONITOR_VERSION:-unknown}" \ - SAC_SERVER_DISPLAY_NAME="${SERVER_DISPLAY_NAME:-}" \ + SAC_SERVER_DISPLAY_NAME="$(server_display_name_with_ip)" \ SAC_HOST_IPV4="${SERVER_IPV4:-}" \ python3 <<'PY' import json, os, socket, uuid diff --git a/ssh-monitor b/ssh-monitor index cb54578..d6abc95 100644 --- a/ssh-monitor +++ b/ssh-monitor @@ -7,7 +7,7 @@ IFS=$'\n\t' # ============================================ CONFIG_FILE="/etc/ssh-monitor.conf" -SSH_MONITOR_VERSION="1.2.12-SAC" +SSH_MONITOR_VERSION="1.2.13-SAC" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then @@ -1962,9 +1962,10 @@ send_startup_notification() { message="${message}⚪ Белый список: ${whitelist_count} IP/подсетей"$'\n' message="${message}❤️ Heartbeat будет отправляться каждые 12 часов"$'\n' message="${message}📢 Каналы уведомлений (все по списку): $(notify_chain_human)" + message="$(message_ensure_server_line "$message")" local lifecycle_details - lifecycle_details='{"lifecycle":"started","trigger":"boot"}' + 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 записей)" } @@ -1977,8 +1978,11 @@ send_shutdown_notification() { timestamp=$(notification_date '+%d.%m.%Y %H:%M:%S') local message=" ⚠️ СКРИПТ МОНИТОРИНГА ОСТАНОВЛЕН "$'\n' message="${message}🕐 Время остановки: ${timestamp}" + message="$(message_ensure_server_line "$message")" - notify_or_sac "agent.lifecycle" "info" "Мониторинг остановлен" "ssh-monitor stopped" "$message" '{"lifecycle":"stopped","trigger":"shutdown"}' + local lifecycle_details + lifecycle_details="$(NOTIFICATION_BODY="$message" python3 -c 'import json, os; print(json.dumps({"lifecycle":"stopped","trigger":"shutdown","notification_body":os.environ["NOTIFICATION_BODY"]}, ensure_ascii=False))')" + notify_or_sac "agent.lifecycle" "info" "Мониторинг остановлен" "ssh-monitor stopped" "$message" "$lifecycle_details" write_log "Скрипт мониторинга остановлен" } diff --git a/version.txt b/version.txt index 4676e97..e052b72 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.12-SAC +1.2.13-SAC