Alerting: Opsgenie notification channel (#34418)

* Alerting: Opsgenie notification channel

This translate the opsgenie notification channel from the old alerting
system to the new alerting system with a few changes:

- The tag system has been replaced in favour of annotation.
- TBD
- TBD

Signed-off-by: Josue Abreu <josue@grafana.com>

* Fix template URL

* Bugfig: dont send resolved when autoClose is false

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix integration tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix URLs in all other channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
gotjosh
2021-05-20 10:12:08 +02:00
committed by GitHub
co-authored by Ganesh Vernekar
parent 615de9bf34
commit 7b04278834
22 changed files with 667 additions and 48 deletions
@@ -1462,6 +1462,108 @@ var expAvailableChannelJsonOutput = `
"secure": true
}
]
},
{
"type": "opsgenie",
"name": "OpsGenie",
"heading": "OpsGenie settings",
"description": "Sends notifications to OpsGenie",
"info": "",
"options": [
{
"element": "input",
"inputType": "text",
"label": "API Key",
"description": "",
"placeholder": "OpsGenie API Key",
"propertyName": "apiKey",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": true,
"validationRule": "",
"secure": true
},
{
"element": "input",
"inputType": "text",
"label": "Alert API Url",
"description": "",
"placeholder": "https://api.opsgenie.com/v2/alerts",
"propertyName": "apiUrl",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": true,
"validationRule": "",
"secure": false
},
{
"element": "checkbox",
"inputType": "",
"label": "Auto close incidents",
"description": "Automatically close alerts in OpsGenie once the alert goes back to ok.",
"placeholder": "",
"propertyName": "autoClose",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false
},
{
"element": "checkbox",
"inputType": "",
"label": "Override priority",
"description": "Allow the alert priority to be set using the og_priority annotation",
"placeholder": "",
"propertyName": "overridePriority",
"selectOptions": null,
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false
},
{
"element": "select",
"inputType": "",
"label": "Send notification tags as",
"description": "Send the common annotations to Opsgenie as either Extra Properties, Tags or both",
"placeholder": "",
"propertyName": "sendTagsAs",
"selectOptions": [
{
"value": "tags",
"label": "Tags"
},
{
"value": "details",
"label": "Extra Properties"
},
{
"value": "both",
"label": "Tags & Extra Properties"
}
],
"showWhen": {
"field": "",
"is": ""
},
"required": false,
"validationRule": "",
"secure": false
}
]
}
]
`
@@ -749,7 +749,7 @@ var expNotifications = map[string][]string{
"attachments": [
{
"title": "Integration Test [FIRING:1] SlackAlert1 (UID_SlackAlert1)",
"title_link": "http:/localhost:3000/alerting/list",
"title_link": "http://localhost:3000/alerting/list",
"text": "Integration Test ",
"fallback": "Integration Test [FIRING:1] SlackAlert1 (UID_SlackAlert1)",
"footer": "Grafana v",
@@ -776,7 +776,7 @@ var expNotifications = map[string][]string{
"attachments": [
{
"title": "[FIRING:1] SlackAlert2 (UID_SlackAlert2)",
"title_link": "http:/localhost:3000/alerting/list",
"title_link": "http://localhost:3000/alerting/list",
"text": "\n**Firing**\nLabels:\n - alertname = SlackAlert2\n - __alert_rule_uid__ = UID_SlackAlert2\nAnnotations:\nSource: \n\n\n\n\n",
"fallback": "[FIRING:1] SlackAlert2 (UID_SlackAlert2)",
"footer": "Grafana v",
@@ -829,7 +829,7 @@ var expNotifications = map[string][]string{
"dingding_recv/dingding_test": {
`{
"link": {
"messageUrl": "dingtalk://dingtalkclient/page/link?pc_slide=false&url=http%3A%2Flocalhost%3A3000%2Falerting%2Flist",
"messageUrl": "dingtalk://dingtalkclient/page/link?pc_slide=false&url=http%3A%2F%2Flocalhost%3A3000%2Falerting%2Flist",
"text": "\n**Firing**\nLabels:\n - alertname = DingDingAlert\n - __alert_rule_uid__ = UID_DingDingAlert\nAnnotations:\nSource: \n\n\n\n\n",
"title": "[FIRING:1] DingDingAlert (UID_DingDingAlert)"
},
@@ -848,7 +848,7 @@ var expNotifications = map[string][]string{
"targets": [
{
"os": "default",
"uri": "http:/localhost:3000/alerting/list"
"uri": "http://localhost:3000/alerting/list"
}
]
}