fix: heartbeat only to SAC, never Telegram/email
agent.heartbeat bypasses NOTIFY_CHAIN in all UseSAC modes; SAC ingest only. Bump to 1.2.3-SAC.
This commit is contained in:
@@ -292,6 +292,10 @@ print(json.dumps(out) if out else "")
|
|||||||
PY
|
PY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sac_is_heartbeat_only_event() {
|
||||||
|
[ "${1:-}" = "agent.heartbeat" ]
|
||||||
|
}
|
||||||
|
|
||||||
# notify_or_sac type severity title summary telegram_message [details_json]
|
# notify_or_sac type severity title summary telegram_message [details_json]
|
||||||
notify_or_sac() {
|
notify_or_sac() {
|
||||||
local event_type="$1"
|
local event_type="$1"
|
||||||
@@ -307,6 +311,22 @@ notify_or_sac() {
|
|||||||
local mode
|
local mode
|
||||||
mode="$(sac_normalize_mode "${UseSAC:-off}")"
|
mode="$(sac_normalize_mode "${UseSAC:-off}")"
|
||||||
|
|
||||||
|
# Периодический heartbeat — только SAC (браузер), без Telegram/email в любом режиме.
|
||||||
|
if sac_is_heartbeat_only_event "$event_type"; then
|
||||||
|
case "$mode" in
|
||||||
|
off)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
exclusive|dual|fallback)
|
||||||
|
sac_send_event "$event_type" "$severity" "$title" "$summary" "$details_json"
|
||||||
|
return $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
off)
|
off)
|
||||||
notify_send "$telegram_message"
|
notify_send "$telegram_message"
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ IFS=$'\n\t'
|
|||||||
# ============================================
|
# ============================================
|
||||||
|
|
||||||
CONFIG_FILE="/etc/ssh-monitor.conf"
|
CONFIG_FILE="/etc/ssh-monitor.conf"
|
||||||
SSH_MONITOR_VERSION="1.2.2-SAC"
|
SSH_MONITOR_VERSION="1.2.3-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
|
||||||
|
|||||||
Reference in New Issue
Block a user