Alerting: Add CustomDetails field in PagerDuty contact point (#64860)

* Alerting: Add CustomDetails for PagerDuty

* fix default value for 'severity' from 'error' to 'critical'

* minimal docs for notifiers, specifying config for PagerDuty

* replace notifier -> integration

* replace notifier -> integration
This commit is contained in:
Santiago 2023-03-29 10:35:01 -03:00 committed by GitHub
parent b01194f81e
commit 7b92849508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 8 deletions

View File

@ -1,9 +1,10 @@
---
aliases:
- ../contact-points/create-contact-point/
- ../contact-points/delete-contact-point/
- ../contact-points/edit-contact-point/
- ../contact-points/test-contact-point/
- ../../contact-points/create-contact-point/
- ../../contact-points/delete-contact-point/
- ../../contact-points/edit-contact-point/
- ../../contact-points/test-contact-point/
- ../create-contact-point/
keywords:
- grafana
- alerting
@ -24,10 +25,10 @@ Complete the following steps to add a contact point.
1. In the left-side menu, click **Alerts & incidents** and then **Alerting**.
1. Click **Contact points**.
1. From the **Choose Alertmanager** dropdown, select an Alertmanager. By default, **Grafana Alertmanager** is selected.
1. Click **+ Add contact point**.
1. From the **Alertmanager** dropdown, select an Alertmanager. By default, **Grafana Alertmanager** is selected.
1. In **Name**, enter a descriptive name for the contact point.
1. From **Contact point integration**, select a type and fill out mandatory fields. For example, if you choose email, enter the email addresses. Or if you choose Slack, enter the Slack channel(s) and users who should be contacted.
1. From **Integration**, select a type and fill out mandatory fields. For example, if you choose email, enter the email addresses. Or if you choose Slack, enter the Slack channel(s) and users who should be contacted.
1. Some contact point integrations, like email or webhook, have optional settings. In **Optional settings**, specify additional settings for the selected contact point integration.
1. In Notification settings, optionally select **Disable resolved message** if you do not want to be notified when an alert resolves.
1. To add another contact point integration, click **Add contact point integration** and repeat steps 6 through 8.

View File

@ -0,0 +1,68 @@
---
description: Configure integrations
draft: true
keywords:
- Grafana
- alerting
- guide
- notifications
- integrations
- contact points
title: Configure integrations
weight: 100
---
# Configure integrations
Configure integrations in Grafana to select your preferred communication channel for receiving notifications when your alert rules are fire. Each integration has its own configuration options and setup process. In most cases, this involves providing an API key or a Webhook URL.
Once configured, you can use integrations as part of your contact points to receive notifications whenever your alert changes its state. In this section, we'll cover the basic steps to configure your integrations, so you can start receiving real-time alerts and stay on top of your monitoring data.
## List of supported integrations
| Name | Type |
| ----------------------- | ------------------------- |
| DingDing | `dingding` |
| Discord | `discord` |
| Email | `email` |
| Google Hangouts Chat | `googlechat` |
| Hipchat | `hipchat` |
| Kafka | `kafka` |
| Line | `line` |
| Microsoft Teams | `teams` |
| Opsgenie | `opsgenie` |
| [Pagerduty](#pagerduty) | `pagerduty` |
| Prometheus Alertmanager | `prometheus-alertmanager` |
| Pushover | `pushover` |
| Sensu | `sensu` |
| Sensu Go | `sensugo` |
| Slack | `slack` |
| Telegram | `telegram` |
| Threema | `threema` |
| VictorOps | `victorops` |
| Webhook | `webhook` |
### PagerDuty
To set up PagerDuty, provide an integration key.
| Setting | Description |
| --------------- | ------------------------------------------------------ |
| Integration Key | Integration key for PagerDuty |
| Severity | Level for dynamic notifications, default is `critical` |
| Custom Details | Additional details about the event |
The `CustomDetails` field is an object containing arbitrary key-value pairs. The user-defined details are merged with the ones we use by default.
Our default values for `CustomDetails` are:
```go
{
"firing": `{{ template "__text_alert_list" .Alerts.Firing }}`,
"resolved": `{{ template "__text_alert_list" .Alerts.Resolved }}`,
"num_firing": `{{ .Alerts.Firing | len }}`,
"num_resolved": `{{ .Alerts.Resolved | len }}`,
}
```
In case of duplicate keys, the user-defined details overwrite the default ones.

View File

@ -295,8 +295,8 @@ func GetAvailableNotifiers() []*NotifierPlugin {
Label: "Severity",
Element: ElementTypeInput,
InputType: InputTypeText,
Placeholder: "error",
Description: "Severity of the event. It must be critical, error, warning, info - otherwise, the default is set which is error. You can use templates",
Placeholder: "critical",
Description: "Severity of the event. It must be critical, error, warning, info - otherwise, the default is set which is critical. You can use templates",
PropertyName: "severity",
},
{ // New in 8.0.
@ -353,6 +353,13 @@ func GetAvailableNotifiers() []*NotifierPlugin {
Placeholder: "{{ .ExternalURL }}",
PropertyName: "client_url",
},
{ // New in 9.5.
Label: "Details",
Description: "A set of arbitrary key/value pairs that provide further detail about the incident.",
Element: ElementTypeKeyValueMap,
InputType: InputTypeText,
PropertyName: "details",
},
},
},
{

View File

@ -38,6 +38,8 @@ const (
ElementTypeCheckbox = "checkbox"
// ElementTypeTextArea will render a textarea
ElementTypeTextArea = "textarea"
// ElementTypeKeyValueMap will render inputs to add arbitrary key-value pairs
ElementTypeKeyValueMap = "key_value_map"
)
// InputType is the type of input that can be rendered in the frontend.