diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-18 15:22:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-18 15:22:04 +0000 |
commit | 608af7bf0232448f73e76e62a75c8a2e77655101 (patch) | |
tree | 65ff9e4da7675e8713b7fb149f674ffe1a8742d1 /health/notifications | |
parent | Adding upstream version 1.29.1. (diff) | |
download | netdata-608af7bf0232448f73e76e62a75c8a2e77655101.tar.xz netdata-608af7bf0232448f73e76e62a75c8a2e77655101.zip |
Adding upstream version 1.29.2.upstream/1.29.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | health/notifications/alarm-notify.sh.in | 8 | ||||
-rwxr-xr-x | health/notifications/health_alarm_notify.conf | 1 | ||||
-rw-r--r-- | health/notifications/opsgenie/README.md | 6 |
3 files changed, 10 insertions, 5 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 456e20cc..3bf8db5f 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -411,6 +411,8 @@ else done fi +OPSGENIE_API_URL=${OPSGENIE_API_URL:-"https://api.opsgenie.com"} + # If we didn't autodetect the character set for e-mail and it wasn't # set by the user, we need to set it to a reasonable default. UTF-8 # should be correct for almost all modern UNIX systems. @@ -853,7 +855,7 @@ send_email() { fi [ -n "${sender_email}" ] && opts+=(-f "${sender_email}") - [ -n "${sender_name}" ] && opts+=(-F "${sender_name}") + [ -n "${sender_name}" ] && sendmail --help 2>&1 | grep -q "\-F " && opts+=(-F "${sender_name}") if [ "${debug}" = "1" ]; then echo >&2 "--- BEGIN sendmail command ---" @@ -2052,7 +2054,7 @@ send_dynatrace() { local dynatrace_url="${DYNATRACE_SERVER}/e/${DYNATRACE_SPACE}/api/v1/events" local description="NetData Notification for: ${host} ${chart}.${name} is ${status}" local payload="" - + payload=$(cat <<EOF { "title": "NetData Alarm from ${host}", @@ -2179,7 +2181,7 @@ send_opsgenie() { EOF ) - httpcode=$(docurl -X POST -H "Content-Type: application/json" -d "${payload}" "https://api.opsgenie.com/v1/json/integrations/webhooks/netdata?apiKey=${OPSGENIE_API_KEY}") + httpcode=$(docurl -X POST -H "Content-Type: application/json" -d "${payload}" "${OPSGENIE_API_URL}/v1/json/integrations/webhooks/netdata?apiKey=${OPSGENIE_API_KEY}") # https://docs.opsgenie.com/docs/alert-api#create-alert if [ "${httpcode}" = "200" ]; then info "sent opsgenie notification for: ${host} ${chart}.${name} is ${status}" diff --git a/health/notifications/health_alarm_notify.conf b/health/notifications/health_alarm_notify.conf index 827a47d9..be669e13 100755 --- a/health/notifications/health_alarm_notify.conf +++ b/health/notifications/health_alarm_notify.conf @@ -284,6 +284,7 @@ SEND_OPSGENIE="YES" # Api key OPSGENIE_API_KEY="" +OPSGENIE_API_URL="" DEFAULT_RECIPIENT_OPSGENIE="" diff --git a/health/notifications/opsgenie/README.md b/health/notifications/opsgenie/README.md index aeb31548..7ae409df 100644 --- a/health/notifications/opsgenie/README.md +++ b/health/notifications/opsgenie/README.md @@ -20,14 +20,16 @@ directory](/docs/configure/nodes.md): ./edit-config health_alarm_notify.conf ``` -Change the variable `OPSGENIE_API_KEY` with the API key you got from Opsgenie. +Change the variable `OPSGENIE_API_KEY` with the API key you got from Opsgenie. +`OPSGENIE_API_URL` defaults to https://api.opsgenie.com, however there are region specific API URLs such as https://eu.api.opsgenie.com, so set this if required. ``` SEND_OPSGENIE="YES" # Api key -# Default Opsgenie APi +# Default Opsgenie API OPSGENIE_API_KEY="11111111-2222-3333-4444-555555555555" +OPSGENIE_API_URL="" ``` Changes to `health_alarm_notify.conf` do not require a Netdata restart. You can test your Opsgenie notifications |