diff options
author | OliverNChalk <11343499+OliverNChalk@users.noreply.github.com> | 2023-05-02 09:25:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 17:25:55 +0300 |
commit | 7077cd0a8eb974baff7636cc71b16a2ef9dbaac4 (patch) | |
tree | 81a4a20c5db5fd18839ffc511fb056fedad021d5 /health | |
parent | 5fb8235e92c5e99956ee0e15d0c00f9061b0bc92 (diff) |
feat: add OpsGenie alert levels to payload (#14992)
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Diffstat (limited to 'health')
-rwxr-xr-x | health/notifications/alarm-notify.sh.in | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 24e9ed4960..51c0002187 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -2321,7 +2321,7 @@ EOF # Opsgenie sender send_opsgenie() { - local payload httpcode oldv currv + local payload httpcode oldv currv priority [ "${SEND_OPSGENIE}" != "YES" ] && return 1 if [ -z "${OPSGENIE_API_KEY}" ] ; then @@ -2329,6 +2329,14 @@ send_opsgenie() { return 1 fi + # Priority for OpsGenie alert (https://support.atlassian.com/opsgenie/docs/update-alert-priority-level/) + case "${status}" in + CRITICAL) priority="P1" ;; # Critical is P1 + WARNING) priority="P3" ;; # Warning is P3 + CLEAR) priority="P5" ;; # Clear is P5 + *) priority="P3" ;; # OpsGenie's default alert level is P3 + esac + # We are sending null when values are nan to avoid errors while JSON message is parsed [ "${old_value}" != "nan" ] && oldv="${old_value}" || oldv="null" [ "${value}" != "nan" ] && currv="${value}" || currv="null" @@ -2343,6 +2351,7 @@ send_opsgenie() { "when": ${when}, "name" : "${name}", "family" : "${family}", + "priority" : "${priority}", "status" : "${status}", "old_status" : "${old_status}", "value" : ${currv}, |