Send webhook
This commit is contained in:
parent
fe8131f743
commit
3e69304f0f
@ -125,6 +125,7 @@ function notify_error() {
|
|||||||
SUBJECT="${WATCHDOG_SUBJECT}: ${1}"
|
SUBJECT="${WATCHDOG_SUBJECT}: ${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Send mail notification if enabled
|
||||||
if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]]; then
|
if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]]; then
|
||||||
IFS=',' read -r -a MAIL_RCPTS <<< "${WATCHDOG_NOTIFY_EMAIL}"
|
IFS=',' read -r -a MAIL_RCPTS <<< "${WATCHDOG_NOTIFY_EMAIL}"
|
||||||
for rcpt in "${MAIL_RCPTS[@]}"; do
|
for rcpt in "${MAIL_RCPTS[@]}"; do
|
||||||
@ -158,6 +159,23 @@ function notify_error() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Send webhook notification if enabled
|
||||||
|
if [[ ! -z ${WATCHDOG_NOTIFY_WEBHOOK} ]]; then
|
||||||
|
if [[ -z ${WATCHDOG_NOTIFY_WEBHOOK_BODY} ]]; then
|
||||||
|
log_msg "No webhook body set, skipping webhook notification..."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WEBHOOK_BODY=$(echo "${WATCHDOG_NOTIFY_WEBHOOK_BODY}" | envsubst '$SUBJECT,$BODY')
|
||||||
|
|
||||||
|
curl -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d ${WEBHOOK_BODY} \
|
||||||
|
${WATCHDOG_NOTIFY_WEBHOOK}
|
||||||
|
|
||||||
|
log_msg "Posted notification to webhook"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_container_ip() {
|
get_container_ip() {
|
||||||
|
Loading…
Reference in New Issue
Block a user