MS Teams
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
