Skip to content

Commit 212be32

Browse files
Alerting: Add missing fields to contact points integrations (#1060)
* add gitattributes * add title to discord * add title to Google chat * add missing kafka fields: description, details, username, password, api_version, cluster_id * add constraints to opsGenie's send_tags_as * pack team's URL as secret * add missing fields to Telegram: parse_mode, disable_web_page_preview, protect_content, disable_notifications * make threema fields optional * add missing fields to wecom + make url optional: secret, corp_id, agent_id, msg_type, to_user * change separators for email address to match https://github.com/grafana/alerting/blob/f5fde7b9a4b73e8687e50aedf78773981f9d7a11/receivers/email/config.go#L50-L58 * support string for webhook's maxAlerts If integration is edited via UI it will contain string that represents number * add upload_image to popover
1 parent 04bbb17 commit 212be32

File tree

5 files changed

+273
-46
lines changed

5 files changed

+273
-46
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

docs/resources/contact_point.md

+21-6
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Optional:
116116
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
117117
- `message` (String) The templated content of the message. Defaults to ``.
118118
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
119+
- `title` (String) The templated content of the title.
119120
- `use_discord_username` (Boolean) Whether to use the bot account's plain username instead of "Grafana." Defaults to `false`.
120121

121122
Read-Only:
@@ -155,6 +156,7 @@ Optional:
155156
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
156157
- `message` (String) The templated content of the message.
157158
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
159+
- `title` (String) The templated content of the title.
158160

159161
Read-Only:
160162

@@ -171,8 +173,14 @@ Required:
171173

172174
Optional:
173175

176+
- `api_version` (String) The API version to use when contacting the Kafka REST Server. Supported: v2 (default) and v3. Defaults to `v2`.
177+
- `cluster_id` (String) The Id of cluster to use when contacting the Kafka REST Server. Required api_version to be 'v3'
178+
- `description` (String) The templated description of the Kafka message.
179+
- `details` (String) The templated details to include with the message.
174180
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
181+
- `password` (String, Sensitive) The password to use when making a call to the Kafka REST Proxy
175182
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
183+
- `username` (String) The user name to use when making a call to the Kafka REST Proxy
176184

177185
Read-Only:
178186

@@ -249,6 +257,7 @@ Optional:
249257
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
250258
- `sound` (String) The sound associated with the notification.
251259
- `title` (String) The templated title of the message.
260+
- `upload_image` (Boolean) Whether to send images in the notification or not. Default is true. Requires Grafana to be configured to send images in notifications.
252261

253262
Read-Only:
254263

@@ -333,8 +342,12 @@ Required:
333342

334343
Optional:
335344

345+
- `disable_notifications` (Boolean) When set users will receive a notification with no sound.
336346
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
347+
- `disable_web_page_preview` (Boolean) When set it disables link previews for links in the message.
337348
- `message` (String) The templated content of the message.
349+
- `parse_mode` (String) Mode for parsing entities in the message text. Supported: None, Markdown, MarkdownV2, and HTML. HTML is the default.
350+
- `protect_content` (Boolean) When set it protects the contents of the message from forwarding and saving.
338351
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
339352

340353
Read-Only:
@@ -348,15 +361,15 @@ Read-Only:
348361
Required:
349362

350363
- `api_secret` (String, Sensitive) The Threema API key.
351-
- `description` (String, Sensitive) The templated description of the message.
352364
- `gateway_id` (String) The Threema gateway ID.
353365
- `recipient_id` (String) The ID of the recipient of the message.
354-
- `title` (String, Sensitive) The templated title of the message.
355366

356367
Optional:
357368

369+
- `description` (String) The templated description of the message.
358370
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
359371
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
372+
- `title` (String) The templated title of the message.
360373

361374
Read-Only:
362375

@@ -411,16 +424,18 @@ Read-Only:
411424
<a id="nestedblock--wecom"></a>
412425
### Nested Schema for `wecom`
413426

414-
Required:
415-
416-
- `url` (String, Sensitive) The WeCom webhook URL.
417-
418427
Optional:
419428

429+
- `agent_id` (String) Agent ID added to the request payload when using APIAPP.
430+
- `corp_id` (String) Corp ID used to get token when using APIAPP.
420431
- `disable_resolve_message` (Boolean) Whether to disable sending resolve messages. Defaults to `false`.
421432
- `message` (String) The templated content of the message to send.
433+
- `msg_type` (String) The type of them message. Supported: markdown, text. Default: text.
434+
- `secret` (String, Sensitive) The secret key required to obtain access token when using APIAPP. See https://work.weixin.qq.com/wework_admin/frame#apps to create APIAPP.
422435
- `settings` (Map of String, Sensitive) Additional custom properties to attach to the notifier. Defaults to `map[]`.
423436
- `title` (String) The templated title of the message to send.
437+
- `to_user` (String) The ID of user that should receive the message. Multiple entries should be separated by '|'. Default: @all.
438+
- `url` (String, Sensitive) The WeCom webhook URL. Required if using GroupRobot.
424439

425440
Read-Only:
426441

examples/resources/grafana_contact_point/_acc_receiver_types.tf

+35-17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resource "grafana_contact_point" "receiver_types" {
1616

1717
discord {
1818
url = "http://discord-url"
19+
title = "title"
1920
message = "message"
2021
avatar_url = "avatar_url"
2122
use_discord_username = true
@@ -32,12 +33,19 @@ resource "grafana_contact_point" "receiver_types" {
3233

3334
googlechat {
3435
url = "http://googlechat-url"
36+
title = "title"
3537
message = "message"
3638
}
3739

3840
kafka {
3941
rest_proxy_url = "http://kafka-rest-proxy-url"
4042
topic = "mytopic"
43+
description = "description"
44+
details = "details"
45+
username = "username"
46+
password = "password"
47+
api_version = "v3"
48+
cluster_id = "cluster_id"
4149
}
4250

4351
opsgenie {
@@ -67,17 +75,18 @@ resource "grafana_contact_point" "receiver_types" {
6775
}
6876

6977
pushover {
70-
user_key = "userkey"
71-
api_token = "token"
72-
priority = 0
73-
ok_priority = 0
74-
retry = 45
75-
expire = 80000
76-
device = "device"
77-
sound = "bugle"
78-
ok_sound = "cashregister"
79-
title = "title"
80-
message = "message"
78+
user_key = "userkey"
79+
api_token = "token"
80+
priority = 0
81+
ok_priority = 0
82+
retry = 45
83+
expire = 80000
84+
device = "device"
85+
sound = "bugle"
86+
ok_sound = "cashregister"
87+
title = "title"
88+
message = "message"
89+
upload_image = false
8190
}
8291

8392
sensugo {
@@ -112,9 +121,13 @@ resource "grafana_contact_point" "receiver_types" {
112121
}
113122

114123
telegram {
115-
token = "token"
116-
chat_id = "chat-id"
117-
message = "message"
124+
token = "token"
125+
chat_id = "chat-id"
126+
message = "message"
127+
parse_mode = "Markdown"
128+
disable_web_page_preview = true
129+
protect_content = true
130+
disable_notifications = true
118131
}
119132

120133
threema {
@@ -143,8 +156,13 @@ resource "grafana_contact_point" "receiver_types" {
143156
}
144157

145158
wecom {
146-
url = "http://wecom-url"
147-
message = "message"
148-
title = "title"
159+
url = "http://wecom-url"
160+
message = "message"
161+
title = "title"
162+
secret = "secret"
163+
corp_id = "corp_id"
164+
agent_id = "agent_id"
165+
msg_type = "text"
166+
to_user = "to_user"
149167
}
150168
}

0 commit comments

Comments
 (0)