MS Teams
To integrate groundcover with MS Teams, follow the steps below. Note that you’ll need at least a Business subscription of MS Teams to be able to create workflows.
Create a webhook workflow for your dedicated Teams channel Go to Relevant Team -> Specific Channel -> "Workflows", and create a webhook workflow
The webhook workflow is associated a URL which is used to trigger the MS Teams integration on groundcover - make sure to copy this URL
Set Up the Webhook in groundcover
Head out to the integrations section: Settings -> Integrations, to create a new Webhook
Start by giving your Webhook integration a name. This name will be used below in the provider block sample .
Set the
Webhook URL
to the url you copied from field (2)Keep the HTTP method as
POST
Create a Workflow Go to
Monitors --> Workflows --> Create Workflow
, and paste the YAML configuration provided below.Configure the
provider
Blocks (There are two of them) In theprovider
block, replace{{ providers.your-teams-integration-name }}
with your actual Webhook integration name (the one you created in step 3) For example, if you named your integrationtest-ms-teams
, the config reference would be:{{ providers.test-ms-teams }}
Sample code for your groundcover workflow:
workflow:
id: teams-webhook
description: Sends an API to MS Teams alerts endpoint
name: ms-teams-alerts-workflow
triggers:
- type: alert
filters:
- key: annotations.ms-teams-alerts-workflow
value: enabled
consts:
silence_link: 'https://app.groundcover.com/monitors/create-silence?keep.replace(keep.join(keep.dict_pop({{ alert.labels }}, "_gc_monitor_id", "_gc_monitor_name", "_gc_severity", "backend_id", "grafana_folder"), "&", "matcher_"), " ", "+")'
monitor_link: 'https://app.groundcover.com/monitors?backendId={{ alert.labels.backend_id }}&selectedObjectId={{ alert.labels._gc_monitor_id }}'
title_link: 'https://app.groundcover.com/monitors/issues?backendId={{ alert.labels.backend_id }}&selectedObjectId={{ alert.fingerprint }}'
description: keep.dictget( {{ alert.annotations }}, "_gc_description", '')
redacted_labels: keep.join(keep.dict_pop({{alert.labels}}, "_gc_monitor_id", "_gc_monitor_name", "_gc_severity", "backend_id", "grafana_folder", "_gc_issue_header"), "-\n")
title: keep.dictget( {{ alert.annotations }}, "_gc_issue_header", "{{ alert.alertname }}")
actions:
- if: '{{ alert.status }} == "firing"'
name: teams-webhook-firing
provider:
config: ' {{ providers.your-teams-integration-name }} '
type: webhook
with:
body:
type: message
attachments:
- contentType: application/vnd.microsoft.card.adaptive
content:
$schema: http://adaptivecards.io/schemas/adaptive-card.json
type: AdaptiveCard
version: "1.2"
body:
- type: TextBlock
text: "\U0001F6A8 Firing: {{ consts.title }}"
weight: bolder
size: large
- type: TextBlock
text: "[Investigate Issue]({{consts.title_link}})"
wrap: true
- type: TextBlock
text: "{{ consts.description }}"
wrap: true
- type: TextBlock
text: "[Silence]({{consts.silence_link}})"
wrap: true
- type: TextBlock
text: "[See monitor]({{consts.monitor_link}})"
wrap: true
- type: TextBlock
text: "{{ consts.redacted_labels }}"
wrap: true
- if: '{{ alert.status }} != "firing"'
name: teams-webhook-resolved
provider:
config: ' {{ providers.your-teams-integration-name }} '
type: webhook
with:
body:
type: message
attachments:
- contentType: application/vnd.microsoft.card.adaptive
content:
$schema: http://adaptivecards.io/schemas/adaptive-card.json
type: AdaptiveCard
version: "1.2"
body:
- type: TextBlock
text: "\U0001F7E2 Resolved: {{ consts.title }}"
weight: bolder
size: large
- type: TextBlock
text: "[Investigate Issue]({{consts.title_link}})"
wrap: true
- type: TextBlock
text: "{{ consts.description }}"
wrap: true
- type: TextBlock
text: "[Silence]({{consts.silence_link}})"
wrap: true
- type: TextBlock
text: "[See monitor]({{consts.monitor_link}})"
wrap: true
- type: TextBlock
text: "{{ consts.redacted_labels }}"
wrap: true
Last updated