Bug 1916450

Summary: Alertmanager: add title and text fields to Adv. config. section of Slack Receiver form
Product: OpenShift Container Platform Reporter: David Taylor <dtaylor>
Component: Management ConsoleAssignee: David Taylor <dtaylor>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: aos-bugs, jokerman, spadgett, yanpzhan
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:36:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
defaultext
none
customtext none

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