feat: release 2.2.1-SAC — phase 2 manifest verify and quiet SAC updates
Pinned GIT_REF/verify, release manifest, no blind reset --hard; suppress lifecycle and watchdog Telegram during updater; healthcheck via json.dumps.
This commit is contained in:
+18
-5
@@ -7,7 +7,7 @@ IFS=$'\n\t'
|
||||
# ============================================
|
||||
|
||||
CONFIG_FILE="/etc/ssh-monitor.conf"
|
||||
SSH_MONITOR_VERSION="2.1.9-SAC"
|
||||
SSH_MONITOR_VERSION="2.2.1-SAC"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if [ -f "$SCRIPT_DIR/ssh-monitor-perms.sh" ]; then
|
||||
@@ -2018,10 +2018,15 @@ write_health_and_metrics() {
|
||||
ts=$(date '+%s')
|
||||
if [ -n "${HEALTHCHECK_STATUS_FILE:-}" ]; then
|
||||
ssh_monitor_secure_dir "$(dirname "$HEALTHCHECK_STATUS_FILE")" 2>/dev/null || mkdir -p "$(dirname "$HEALTHCHECK_STATUS_FILE")" 2>/dev/null || true
|
||||
printf '{"ts":%s,"hostname":"%s","dry_run":%s}\n' "$ts" "$(hostname | sed 's/"/\\"/g')" "$([[ "${DRY_RUN:-0}" = "1" ]] && echo true || echo false)" >"${HEALTHCHECK_STATUS_FILE}.tmp"
|
||||
ssh_monitor_secure_file "${HEALTHCHECK_STATUS_FILE}.tmp" 2>/dev/null || true
|
||||
mv "${HEALTHCHECK_STATUS_FILE}.tmp" "$HEALTHCHECK_STATUS_FILE" 2>/dev/null || true
|
||||
ssh_monitor_secure_file "$HEALTHCHECK_STATUS_FILE" 2>/dev/null || true
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python3 -c 'import json,sys; print(json.dumps({"ts": int(sys.argv[1]), "hostname": sys.argv[2], "dry_run": sys.argv[3] == "1"}))' \
|
||||
"$ts" "$(hostname)" "${DRY_RUN:-0}" >"${HEALTHCHECK_STATUS_FILE}.tmp"
|
||||
ssh_monitor_secure_file "${HEALTHCHECK_STATUS_FILE}.tmp" 2>/dev/null || true
|
||||
mv "${HEALTHCHECK_STATUS_FILE}.tmp" "$HEALTHCHECK_STATUS_FILE" 2>/dev/null || true
|
||||
ssh_monitor_secure_file "$HEALTHCHECK_STATUS_FILE" 2>/dev/null || true
|
||||
else
|
||||
write_log "WARN: python3 недоступен — HEALTHCHECK_STATUS_FILE пропущен"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${PROMETHEUS_TEXTFILE_DIR:-}" ]; then
|
||||
mkdir -p "$PROMETHEUS_TEXTFILE_DIR" 2>/dev/null || true
|
||||
@@ -2040,6 +2045,10 @@ write_health_and_metrics() {
|
||||
# ============================================
|
||||
|
||||
send_startup_notification() {
|
||||
if ssh_monitor_update_in_progress 2>/dev/null; then
|
||||
write_log "lifecycle startup: пропуск (идёт agent-update)"
|
||||
return 0
|
||||
fi
|
||||
local timestamp
|
||||
timestamp=$(notification_date '+%d.%m.%Y %H:%M:%S')
|
||||
local whitelist_count=$((${#WHITELIST_IPS[@]} + ${#WHITELIST_SUBNETS[@]}))
|
||||
@@ -2067,6 +2076,10 @@ send_startup_notification() {
|
||||
|
||||
send_shutdown_notification() {
|
||||
[ "${SHUTDOWN_NOTIFIED:-0}" = "1" ] && return 0
|
||||
if ssh_monitor_update_in_progress 2>/dev/null; then
|
||||
write_log "lifecycle shutdown: пропуск (идёт agent-update)"
|
||||
return 0
|
||||
fi
|
||||
SHUTDOWN_NOTIFIED=1
|
||||
|
||||
local timestamp
|
||||
|
||||
Reference in New Issue
Block a user