From d5bbf77506a0a3e3f19a2ac9201b82a0efefd561 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Van <37105868+DaTiMy@users.noreply.github.com> Date: Sun, 1 Sep 2024 18:20:11 +0200 Subject: [PATCH] ilert Integration (#18447) --- src/health/notifications/alarm-notify.sh.in | 62 ++++++++++++++++++- .../notifications/health_alarm_notify.conf | 21 +++++++ src/health/notifications/ilert/metadata.yaml | 55 ++++++++++++++++ 3 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 src/health/notifications/ilert/metadata.yaml diff --git a/src/health/notifications/alarm-notify.sh.in b/src/health/notifications/alarm-notify.sh.in index c7c44cb116a287..d7baa7345022ea 100755 --- a/src/health/notifications/alarm-notify.sh.in +++ b/src/health/notifications/alarm-notify.sh.in @@ -769,6 +769,9 @@ fi # check custom [ -z "${DEFAULT_RECIPIENT_CUSTOM}" ] && SEND_CUSTOM="NO" +# check ilert +[ -z "${ILERT_ALERT_SOURCE_URL}" ] && SEND_ILERT="NO" + # ----------------------------------------------------------------------------- # check the availability of targets @@ -798,7 +801,8 @@ check_supported_targets() { [ "${SEND_DYNATRACE}" = "YES" ] || [ "${SEND_OPSGENIE}" = "YES" ] || [ "${SEND_GOTIFY}" = "YES" ] || - [ "${SEND_NTFY}" = "YES" ]; then + [ "${SEND_NTFY}" = "YES" ] || + [ "${SEND_ILERT}" = "YES" ]; then # if we need curl, check for the curl command if [ -z "${curl}" ]; then curl="$(command -v curl 2>/dev/null)" @@ -828,6 +832,7 @@ check_supported_targets() { SEND_OPSGENIE="NO" SEND_GOTIFY="NO" SEND_NTFY="NO" + SEND_ILERT="NO" fi fi @@ -983,7 +988,8 @@ for method in "${SEND_EMAIL}" \ "${SEND_DYNATRACE}" \ "${SEND_OPSGENIE}" \ "${SEND_GOTIFY}" \ - "${SEND_NTFY}" ; do + "${SEND_NTFY}" \ + "${SEND_ILERT}" ; do if [ "${method}" == "YES" ]; then proceed=1 @@ -2431,6 +2437,50 @@ send_ntfy() { return 1 } +# ----------------------------------------------------------------------------- +# ilert sender + +send_ilert() { + local payload httpcode + [ "${SEND_ILERT}" != "YES" ] && return 1 + + if [ -z "${ILERT_ALERT_SOURCE_URL}" ] ; then + info "Can't send ilert notification, because ILERT_ALERT_SOURCE_URL is not defined" + return 1 + fi + + payload=$(cat <