Bug 1916450 - Alertmanager: add title and text fields to Adv. config. section of Slack Receiver form
Summary: Alertmanager: add title and text fields to Adv. config. section of Slack Rece...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.8.0
Assignee: David Taylor
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-14 19:45 UTC by David Taylor
Modified: 2021-07-27 22:36 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: Added Title and Text fields to the Advanced Configuration section of the Slack Receiver form. Reason: This allows users to customize their Slack message subject Title and Text of the body of the message. Result: Users can provide their own message and use the Prometheus template fields within custom Slack messages.
Clone Of:
Environment:
Last Closed: 2021-07-27 22:36:14 UTC
Target Upstream Version:


Attachments (Terms of Use)
defaultext (27.20 KB, image/png)
2021-02-22 08:06 UTC, Yanping Zhang
no flags Details
customtext (11.07 KB, image/png)
2021-02-22 08:07 UTC, Yanping Zhang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 7921 0 None closed Bug 1916450: Alertmanager: add Title and Text fields to Adv. config section of Slack Receiver form 2021-02-20 05:49:39 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:36:35 UTC

Description David Taylor 2021-01-14 19:45:44 UTC
When creating a Slack receiver, the adv. config. options only allow user to customize an icon and the username.  We should also add textareas for Title and Text which would allow user to fully customize the alert messages sent to Slack.

Example yaml:

 receivers:
  - name: Critical
    slack_configs:
      - channel: '#critical-alerts'
        icon_emoji: ':exclamation:'
        username: dtaylor113
        link_names: false
        title: >-
          {{ .CommonLabels.alertname }} {{ if eq .Status "firing" }}({{
          .Alerts.Firing | len }}{{ end }} {{ .Status }}) 
        text: >-
          {{ range .Alerts -}} *Alert:* {{ .Annotations.title }}{{ if
          .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}

          *Message:* {{ .Annotations.message }}

          *Description:* {{ .Annotations.description }}

          *Details:*
            {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
            {{ end }}
          {{ end }}
  - name: Warnings
    slack_configs:
      - channel: '#warning-alerts'
        icon_emoji: ':warning:'
        title: >-
          {{ .CommonLabels.alertname }} {{ if eq .Status "firing" }}({{
          .Alerts.Firing | len }}{{ end }} {{ .Status }}) 
        text: >-
          {{ range .Alerts -}} *Alert:* {{ .Annotations.title }}{{ if
          .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}

          *Summary:* {{ .Annotations.message }}

          *Message:* {{ .Annotations.message }}

          *Description:* {{ .Annotations.description }}

          *Details:*
            {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
            {{ end }}
          {{ end }}

Comment 2 Yanping Zhang 2021-02-22 08:06:01 UTC
Tested on ocp 4.8 cluster with payload 4.8.0-0.nightly-2021-02-21-102854.
Create slack alert receivers with default title/text and custom title/text, could get alert info successfully. Refer to attachment.
The bug is fixed.

Comment 3 Yanping Zhang 2021-02-22 08:06:53 UTC
Created attachment 1758569 [details]
defaultext

Comment 4 Yanping Zhang 2021-02-22 08:07:57 UTC
Created attachment 1758570 [details]
customtext

Comment 7 errata-xmlrpc 2021-07-27 22:36:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438


Note You need to log in before you can comment on or make changes to this bug.