KOP Recipes - Microsoft Teams - Rafay Product Documentation

Microsoft Teams

Although a turnkey integration is available for email based notifications, organizations may wish to send notifications to other platforms in use internally. This recipe documents how organizations can customize the "Alert Manager" system add-on configuration and send the alerts to Microsoft Teams.

Note

View a video of the steps described below


Step 1: Configure Teams

The first step in setting up the integration is to configure a webhook which uses prom2teams to write messages.

If you want to receive the notifications via Microsoft Teams, you will need an existing team and a channel within that team or you will have to create a new one for testing. You will need Administrator privileges for that.

To setup the alerting to your Microsoft Teams channel, you will need a connector API URL:

Step 2: Configure prom2teams Add-on

Follow the below steps to create a customized "prom2teams" custom add-on:

# Default values for prom2teams.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
 repository: idealista/prom2teams
 tag:
 pullPolicy: IfNotPresent

resources:
requests:
  cpu: 100m
  memory: 128Mi
limits:
  cpu: 200m
  memory: 200Mi

service:
 type: ClusterIP
 port: 8089
 monitoring_port: 9090

prom2teams:
 host: 0.0.0.0
 port: 8089
 monitoring_port: 9090
 connector: https://rafay23.webhook.office.com/webhookb2/00fc5e7c-9c4c-4f
 connectors: {}
 # group_alerts_by can be one of
 # ("name" | "description" | "instance" | "severity" | "status" | "summary" | "fingerprint" | "runbook_url")
group_alerts_by:
 # loglevel can be one of (DEBUG | INFO | WARNING | ERROR | CRITICAL)
 loglevel: INFO
 templatepath: /opt/prom2teams/helmconfig/teams.j2
 config: /opt/prom2teams/helmconfig/config.ini
 extraEnv: {}

# Security Context properties
securityContext:
 # enabled is a flag to enable Security Context
enabled: true
 # runAsUser is the user ID used to run the container
runAsUser: 101
 # runAsGroup is the primary group ID used to run all processes within any container of the pod
runAsGroup: 101
 # fsGroup is the group ID associated with the container
fsGroup: 101
 # readOnlyRootFilesystem is a flag to enable readOnlyRootFilesystem for the Hazelcast security context
readOnlyRootFilesystem: true

Clone the prom2 teams repo:

git clone https://github.com/idealista/prom2teams.git

Package into helm:

helm package <path_to_prom2teams_root>/helm

Output:

Successfully packaged chart and saved it to: <path_to_prom2teams_root>/prom2teams-0.2.0.tgz

Step 3: Configure Alert Manager Add-on

Follow the below steps to create a customized "Alert Manager" System Add-on

receivers:
- name: default-receiver
- name: rafay-webhook
  webhook_configs:
  - http_config:
      tls_config:
        ca_file: /etc/config/certs/ca.crt
        cert_file: /etc/config/certs/client.crt
        insecure_skip_verify: true
        key_file: /etc/config/certs/client.key
        server_name: '{{{ .V2EventFrameworkFQDN }}}'
    url: https://{{{ .V2EventFrameworkFQDN }}}/event/v1/alert/raise
- name: prom2teams
  webhook_configs:
  - http_config:
    url: http://proms2team.prom2team:8089
route:
  group_interval: 5m
  group_wait: 10s
  receiver: rafay-webhook
  repeat_interval: 3h
  routes:
  - continue: true
    match_re:
      severity: .*
    receiver: rafay-webhook
  - continue: true
    match_re:
      severity: .*
    receiver: prom2teams

Step 4: Update Cluster Blueprint

Follow the below steps to deploy the customized Alert Manager configuration for Microsoft Teams notifications

Step 5: Verify Configuration

Once the alerts are generated in the clusters, you will receive notifications in your Teams channel for the alerts. An illustrative example is shown below.