diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2020-10-30 14:02:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 14:02:29 +0000 |
commit | 7c3662b06355aecad2dd05f9db50a05919feeba5 (patch) | |
tree | 90fff8a3a74a09e9f84bf7da712ae96a5f6b05d0 /health | |
parent | 593e1b6dbc6c979955e503d431d32c0dce1a2e09 (diff) |
Hangout thread (#10160)
Add threads to Hangouts notification.
Diffstat (limited to 'health')
-rwxr-xr-x | health/notifications/alarm-notify.sh.in | 11 | ||||
-rw-r--r-- | health/notifications/hangouts/README.md | 37 |
2 files changed, 35 insertions, 13 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 097555f42c..8da0148335 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -374,6 +374,7 @@ IRC_NETWORK= # hangouts configs declare -A HANGOUTS_WEBHOOK_URI +declare -A HANGOUTS_WEBHOOK_THREAD # dynatrace configs DYNATRACE_SPACE= @@ -1886,7 +1887,7 @@ send_sms() { # hangouts sender send_hangouts() { - local rooms="${1}" httpcode sent=0 room color payload webhook + local rooms="${1}" httpcode sent=0 room color payload webhook thread [ "${SEND_HANGOUTS}" != "YES" ] && return 1 @@ -1901,6 +1902,9 @@ send_hangouts() { if [ -z "${HANGOUTS_WEBHOOK_URI[$room]}" ] ; then info "Can't send Hangouts notification for: ${host} ${chart}.${name} to room ${room}. HANGOUTS_WEBHOOK_URI[$room] not defined" else + if [ -n "${HANGOUTS_WEBHOOK_THREAD[$room]}" ]; then + thread="\"name\" : \"${HANGOUTS_WEBHOOK_THREAD[$room]}\"" + fi webhook="${HANGOUTS_WEBHOOK_URI[$room]}" payload="$( cat <<EOF @@ -1967,7 +1971,10 @@ send_hangouts() { } ] } - ] + ], + "thread": { + $thread + } } EOF )" diff --git a/health/notifications/hangouts/README.md b/health/notifications/hangouts/README.md index 868bae9851..886abfc430 100644 --- a/health/notifications/hangouts/README.md +++ b/health/notifications/hangouts/README.md @@ -1,23 +1,33 @@ <!-- ---- -title: "Hangouts Chat" +title: "Send notifications to Google Hangouts" +description: "Send alerts to Send notifications to Google Hangouts any time an anomaly or performance issue strikes a node in your infrastructure." +sidebar_label: "Google Hangouts" custom_edit_url: https://github.com/netdata/netdata/edit/master/health/notifications/hangouts/README.md ---- --> -# Hangouts Chat +# Send notifications to Google Hangouts + +[Google Hangouts](https://hangouts.google.com/) is a cross-platform messaging app developed by Google. You can configure +Netdata to send alarm notifications to a Hangouts room in order to stay aware of possible health or performance issues +on your nodes. Here's an example of the notification in action: -This is what you will get: ![Netdata on Hangouts](https://user-images.githubusercontent.com/1153921/66427166-47de6900-e9c8-11e9-8322-b4b03f084dc1.png) + To receive notifications in Google Hangouts, you need the following in your Hangouts setup: -1. One or more rooms -2. An **incoming webhook** for each room +1. One or more rooms. +2. An **incoming webhook** for each room. + +Follow [Google's documentation](https://developers.google.com/hangouts/chat/how-tos/webhooks) to create an incoming +webhook for each room you want to send Netdata notifications to. -How to create an incoming webhook: -https://developers.google.com/hangouts/chat/how-tos/webhooks +Set the webhook URIs and room names in `health_alarm_notify.conf`. To edit it on your system, run +`/etc/netdata/edit-config health_alarm_notify.conf`): -Set the webhook URIs and room names in `health_alarm_notify.conf`. To edit it on your system, run `/etc/netdata/edit-config health_alarm_notify.conf`): +## Threads (optional) + +Instead to receive alarms on different threads, Netdata allows you to concentrate them inside an unique thread when you +set the variable `HANGOUTS_WEBHOOK_THREAD[NAME]`. ``` #------------------------------------------------------------------------------ @@ -30,11 +40,16 @@ SEND_HANGOUTS="YES" # HANGOUTS_WEBHOOK_URI[ROOM_NAME]="URLforroom1" HANGOUTS_WEBHOOK_URI[systems]="https://chat.googleapis.com/v1/spaces/AAAAXXXXXXX/..." HANGOUTS_WEBHOOK_URI[development]="https://chat.googleapis.com/v1/spaces/AAAAYYYYY/..." +# On Hangouts, copy a thread link and change the values for space and thread +# HANGOUTS_WEBHOOK_THREAD[systems]="spaces/AAAAXXXXXXX/threads/XXXXXXXXXXX" # if a DEFAULT_RECIPIENT_HANGOUTS are not configured, # notifications wouldn't be send to hangouts rooms. # DEFAULT_RECIPIENT_HANGOUTS="systems development|critical" DEFAULT_RECIPIENT_HANGOUTS="sysadmin devops alarms|critical" ``` + You can define multiple rooms like this: `sysadmin devops alarms|critical`. -The keywords `sysadmin`, `devops` and `alarms` are Hangouts rooms. +The keywords `sysadmin`, `devops`, and `alarms` are Hangouts rooms. + +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fhealth%2Fnotifications%2Fhangouts%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>) |