@cryptotaxi247 / netdata-1 / commits / 10ed9344f

add a dump_methods parameter to alarm-notify.sh.in (#10772)

Emmanuel Vasilakis committed Mar 17, 2021 at 10:46 UTC 10ed9344f4c53bbd58b00432bf063aa41cefebd8
1 file changed +21
health/notifications/alarm-notify.sh.in
+21
@@ -209,6 +209,9 @@ if [[ ${1} = "unittest" ]]; then
209 cfgfile="${3}" # the location of the config file to use for unit testing
210 status="${4}" # the current status : REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
211 old_status="${5}" # the previous status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
212 +elif [[ ${1} = "dump_methods" ]]; then
213 + dump_methods=1
214 + status="WARNING"
215 else
216 roles="${1}" # the roles that should be notified for this event
217 args_host="${2}" # the host generated this event
@@ -549,6 +552,15 @@ filter_recipient_by_criticality() {
552 # check stackpulse
553 [ -z "${STACKPULSE_WEBHOOK}" ] && SEND_STACKPULSE="NO"
554
555 +# check msteam
556 +[ -z "${MSTEAM_WEBHOOK_URL}" ] && SEND_MSTEAM="NO"
557 +
558 +# check pd
559 +[ -z "${DEFAULT_RECIPIENT_PD}" ] && SEND_PD="NO"
560 +
561 +# check prowl
562 +[ -z "${DEFAULT_RECIPIENT_PROWL}" ] && SEND_PROWL="NO"
563 +
564 if [ "${SEND_PUSHOVER}" = "YES" ] ||
565 [ "${SEND_SLACK}" = "YES" ] ||
566 [ "${SEND_ROCKETCHAT}" = "YES" ] ||
@@ -639,6 +651,15 @@ if [ "${SEND_AWSSNS}" = "YES" ] && [ -z "${aws}" ]; then
651 fi
652 fi
653
654 +if [ ${dump_methods} ]; then
655 + for name in "${!SEND_@}"; do
656 + if [ "${!name}" = "YES" ]; then
657 + echo "$name"
658 + fi
659 + done
660 + exit
661 +fi
662 +
663 # -----------------------------------------------------------------------------
664 # find the recipients' addresses per method
665