@cryptotaxi247 / netdata-1 / commits / 7c3662b06

Hangout thread (#10160)

Add threads to Hangouts notification.

thiagoftsm committed Oct 30, 2020 at 14:02 UTC 7c3662b06355aecad2dd05f9db50a05919feeba5
2 files changed +35 -13
health/notifications/alarm-notify.sh.in
+9 -2
@@ -374,6 +374,7 @@ IRC_NETWORK=
374
375 # hangouts configs
376 declare -A HANGOUTS_WEBHOOK_URI
377 +declare -A HANGOUTS_WEBHOOK_THREAD
378
379 # dynatrace configs
380 DYNATRACE_SPACE=
@@ -1886,7 +1887,7 @@ send_sms() {
1887 # hangouts sender
1888
1889 send_hangouts() {
1889 - local rooms="${1}" httpcode sent=0 room color payload webhook
1890 + local rooms="${1}" httpcode sent=0 room color payload webhook thread
1891
1892 [ "${SEND_HANGOUTS}" != "YES" ] && return 1
1893
@@ -1901,6 +1902,9 @@ send_hangouts() {
1902 if [ -z "${HANGOUTS_WEBHOOK_URI[$room]}" ] ; then
1903 info "Can't send Hangouts notification for: ${host} ${chart}.${name} to room ${room}. HANGOUTS_WEBHOOK_URI[$room] not defined"
1904 else
1905 + if [ -n "${HANGOUTS_WEBHOOK_THREAD[$room]}" ]; then
1906 + thread="\"name\" : \"${HANGOUTS_WEBHOOK_THREAD[$room]}\""
1907 + fi
1908 webhook="${HANGOUTS_WEBHOOK_URI[$room]}"
1909 payload="$(
1910 cat <<EOF
@@ -1967,7 +1971,10 @@ send_hangouts() {
1971 }
1972 ]
1973 }
1970 - ]
1974 + ],
1975 + "thread": {
1976 + $thread
1977 + }
1978 }
1979 EOF
1980 )"
health/notifications/hangouts/README.md
+26 -11
@@ -1,23 +1,33 @@
1 <!--
2 ----
3 -title: "Hangouts Chat"
2 +title: "Send notifications to Google Hangouts"
3 +description: "Send alerts to Send notifications to Google Hangouts any time an anomaly or performance issue strikes a node in your infrastructure."
4 +sidebar_label: "Google Hangouts"
5 custom_edit_url: https://github.com/netdata/netdata/edit/master/health/notifications/hangouts/README.md
5 ----
6 -->
7
8 -# Hangouts Chat
8 +# Send notifications to Google Hangouts
9 +
10 +[Google Hangouts](https://hangouts.google.com/) is a cross-platform messaging app developed by Google. You can configure
11 +Netdata to send alarm notifications to a Hangouts room in order to stay aware of possible health or performance issues
12 +on your nodes. Here's an example of the notification in action:
13
10 -This is what you will get:
14 ![Netdata on Hangouts](https://user-images.githubusercontent.com/1153921/66427166-47de6900-e9c8-11e9-8322-b4b03f084dc1.png)
15 +
16 To receive notifications in Google Hangouts, you need the following in your Hangouts setup:
17
14 -1. One or more rooms
15 -2. An **incoming webhook** for each room
18 +1. One or more rooms.
19 +2. An **incoming webhook** for each room.
20 +
21 +Follow [Google's documentation](https://developers.google.com/hangouts/chat/how-tos/webhooks) to create an incoming
22 +webhook for each room you want to send Netdata notifications to.
23
17 -How to create an incoming webhook:
18 -https://developers.google.com/hangouts/chat/how-tos/webhooks
24 +Set the webhook URIs and room names in `health_alarm_notify.conf`. To edit it on your system, run
25 +`/etc/netdata/edit-config health_alarm_notify.conf`):
26
20 -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`):
27 +## Threads (optional)
28 +
29 +Instead to receive alarms on different threads, Netdata allows you to concentrate them inside an unique thread when you
30 +set the variable `HANGOUTS_WEBHOOK_THREAD[NAME]`.
31
32 ```
33 #------------------------------------------------------------------------------
@@ -30,11 +40,16 @@ SEND_HANGOUTS="YES"
40 # HANGOUTS_WEBHOOK_URI[ROOM_NAME]="URLforroom1"
41 HANGOUTS_WEBHOOK_URI[systems]="https://chat.googleapis.com/v1/spaces/AAAAXXXXXXX/..."
42 HANGOUTS_WEBHOOK_URI[development]="https://chat.googleapis.com/v1/spaces/AAAAYYYYY/..."
43 +# On Hangouts, copy a thread link and change the values for space and thread
44 +# HANGOUTS_WEBHOOK_THREAD[systems]="spaces/AAAAXXXXXXX/threads/XXXXXXXXXXX"
45 # if a DEFAULT_RECIPIENT_HANGOUTS are not configured,
46 # notifications wouldn't be send to hangouts rooms.
47 # DEFAULT_RECIPIENT_HANGOUTS="systems development|critical"
48 DEFAULT_RECIPIENT_HANGOUTS="sysadmin devops alarms|critical"
49 ```
50 +
51 You can define multiple rooms like this: `sysadmin devops alarms|critical`.
52
40 -The keywords `sysadmin`, `devops` and `alarms` are Hangouts rooms.
53 +The keywords `sysadmin`, `devops`, and `alarms` are Hangouts rooms.
54 +
55 +[![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)](<>)