summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2021-03-17 10:46:48 +0200
committerGitHub <noreply@github.com>2021-03-17 10:46:48 +0200
commit10ed9344f4c53bbd58b00432bf063aa41cefebd8 (patch)
tree340f5f4a871b720f20cc6f5af6da7aae0a0a3402
parent15f0af519084f9e0764b7732193a41609087b3e7 (diff)
add a dump_methods parameter to alarm-notify.sh.in (#10772)
-rwxr-xr-xhealth/notifications/alarm-notify.sh.in21
1 files changed, 21 insertions, 0 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in
index 3bf8db5f6d..3b8fd8a1d2 100755
--- a/health/notifications/alarm-notify.sh.in
+++ b/health/notifications/alarm-notify.sh.in
@@ -209,6 +209,9 @@ if [[ ${1} = "unittest" ]]; then
cfgfile="${3}" # the location of the config file to use for unit testing
status="${4}" # the current status : REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
old_status="${5}" # the previous status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
+elif [[ ${1} = "dump_methods" ]]; then
+ dump_methods=1
+ status="WARNING"
else
roles="${1}" # the roles that should be notified for this event
args_host="${2}" # the host generated this event
@@ -549,6 +552,15 @@ filter_recipient_by_criticality() {
# check stackpulse
[ -z "${STACKPULSE_WEBHOOK}" ] && SEND_STACKPULSE="NO"
+# check msteam
+[ -z "${MSTEAM_WEBHOOK_URL}" ] && SEND_MSTEAM="NO"
+
+# check pd
+[ -z "${DEFAULT_RECIPIENT_PD}" ] && SEND_PD="NO"
+
+# check prowl
+[ -z "${DEFAULT_RECIPIENT_PROWL}" ] && SEND_PROWL="NO"
+
if [ "${SEND_PUSHOVER}" = "YES" ] ||
[ "${SEND_SLACK}" = "YES" ] ||
[ "${SEND_ROCKETCHAT}" = "YES" ] ||
@@ -639,6 +651,15 @@ if [ "${SEND_AWSSNS}" = "YES" ] && [ -z "${aws}" ]; then
fi
fi
+if [ ${dump_methods} ]; then
+ for name in "${!SEND_@}"; do
+ if [ "${!name}" = "YES" ]; then
+ echo "$name"
+ fi
+ done
+ exit
+fi
+
# -----------------------------------------------------------------------------
# find the recipients' addresses per method