X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=plugins.d%2Falarm-notify.sh;h=45d90563888d5dcd176154228c9c72275a317df6;hb=da855a2eab3455f413a715271aa4aa2978d7c6a8;hp=2b385f7f44f1d703a3a37e4beee1d231400adb8a;hpb=22b0bd9000c51785aa8d323a02980efd89790ef5;p=netdata.git diff --git a/plugins.d/alarm-notify.sh b/plugins.d/alarm-notify.sh index 2b385f7f..45d90563 100755 --- a/plugins.d/alarm-notify.sh +++ b/plugins.d/alarm-notify.sh @@ -214,6 +214,7 @@ DEFAULT_RECIPIENT_TWILIO= declare -A role_recipients_twilio=() # hipchat configs +HIPCHAT_SERVER= HIPCHAT_AUTH_TOKEN= DEFAULT_RECIPIENT_HIPCHAT= declare -A role_recipients_hipchat=() @@ -854,16 +855,15 @@ send_twilio() { send_hipchat() { local authtoken="${1}" recipients="${2}" message="${3}" httpcode sent=0 room color sender msg_format notify - if [ "${SEND_HIPCHAT}" = "YES" -a ! -z "${authtoken}" -a ! -z "${recipients}" -a ! -z "${message}" ] - then - + if [ "${SEND_HIPCHAT}" = "YES" -a ! -z "${HIPCHAT_SERVER}" -a ! -z "${authtoken}" -a ! -z "${recipients}" -a ! -z "${message}" ] + then # A label to be shown in addition to the sender's name # Valid length range: 0 - 64. sender="netdata" # Valid values: html, text. # Defaults to 'html'. - msg_format="text" + msg_format="html" # Background color for message. Valid values: yellow, green, red, purple, gray, random. Defaults to 'yellow'. case "${status}" in @@ -884,7 +884,7 @@ send_hipchat() { -H "Content-type: application/json" \ -H "Authorization: Bearer ${authtoken}" \ -d "{\"color\": \"${color}\", \"from\": \"${netdata}\", \"message_format\": \"${msg_format}\", \"message\": \"${message}\", \"notify\": \"${notify}\"}" \ - "https://api.hipchat.com/v2/room/${room}/notification") + "https://${HIPCHAT_SERVER}/v2/room/${room}/notification") if [ "${httpcode}" == "204" ] then @@ -1284,12 +1284,13 @@ SENT_PD=$? # ----------------------------------------------------------------------------- # send hipchat message -send_hipchat "${HIPCHAT_AUTH_TOKEN}" "${to_hipchat}" "\ -${alarm} ${info_html}
 \ -${host} ${severity} on chart ${chart}
(family ${family}
)\ -Time ${date}${raised_for_html}
\ -View Netdata\ -(the source of this alarm is line ${src})\ +send_hipchat "${HIPCHAT_AUTH_TOKEN}" "${to_hipchat}" " \ +${host} ${status_message}
\ +${alarm} ${info_html}
\ +${chart} (family ${family})
\ +${date}${raised_for_html}
\ +View netdata dashboard \ +(source of alarm ${src}) \ " SENT_HIPCHAT=$?