Introduction
DataSet presently does not have a native Teams integration. This article explains how to create an alert notification solution that utilizes the Microsoft Teams "Incoming Webhook" connector for the same functionality.
Please note that the following hashtag values (#) are replaced by their appropriate values when used in the alertAddress
field. More on this later!
#trigger#
#description#
#title#
#link#
#id#
#lastLogLines#
(currently there is only support forwebhook-trigger
)
More information on these substitution tokens can be found here: https://app.scalyr.com/help/alerts#webhook
Additional Documentation
This article will explain how to configure a Teams channel and an incoming webhook connector. However, there are some comprehensive documents which explain the process in greater detail.
Incoming Webhook Configuration
There's a good explanation of how to configure incoming webhooks for Teams here: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
Connector Configuration
This document explains the fields used when configuring a connector message (JSON): https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using
JSON Formatting Utilities
If you don't already have a way of verifying / minifying your JSON, you can refer to the following web-based utilities. These are not hosted by DataSet, and we recommend removing any confidential information like API keys / passwords beforehand.
Configuration
Configure your Teams Account
1. Select an existing channel or create a new one:
We created a channel called "Alerts" for this example.
2. Once the channel has been established, click the ellipsis (...) next to the "Team" heading and click "Manage team"
3. Click the "Apps" tab and then click the "More apps" button
4. A search window is displayed to the left of the screen. Type "incoming" and choose the "Incoming Webhook" connector
5. You will be prompted to choose a team and a channel at this point. Be sure to select the team and channel from the drop-down menu before proceeding
In this case, we chose the "Alerts" channel that we just created
6. Enter the name for the webhook connection. Whenever a webhook message is posted to the channel, this value will be displayed as the originator. Click the "Create" button
7. The connector URL is now provided. This URL will be used as the webhook endpoint for the alerts you configure. Notifications will be routed to the team / channel you specified. Be sure to make note of this URL before clicking "Done"
8. You can confirm that the endpoint works as expected with the following curl command:
curl -H 'Content-Type: application/json' -d '{"text": "Hello World"}' https://outlook.office.com/webhook/070075...
Set up the DataSet Alert
Here's our example JSON:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Scalyr Alert",
"sections": [{
"activityTitle": "#title#",
"activitySubtitle": "#trigger#",
"facts": [{
"name": "View Alert",
"value": "#link#"
}],
"markdown": true
}]
}
Video Explanation of configuring DataSet Alerts with JSON: https://youtu.be/s5XhogirGig?t=136
As mentioned in our introduction, you can use hashtag parameters (we're using #title#, #trigger#, and #link#) to insert alert-specific values into your alert webhook.
Next, we minify the JSON and add it to the alertAddress
field:
...
{
alertAddress: "webhook-trigger:POST https://outlook.office.com/webhook/070075...[[{\"@type\":\"MessageCard\",\"@context\":\"http://schema.org/extensions\",\"themeColor\":\"0076D7\",\"summary\":\"Scalyr Alert\",\"sections\":[{\"activityTitle\":\"#title#\",\"activitySubtitle\":\"#trigger#\",\"facts\":[{\"name\":\"View Alert\",\"value\":\"#link#\"}],\"markdown\":true}]}]]",
description: "Test Alert",
gracePeriodMinutes: 0,
renotifyPeriodMinutes: 1,
resolutionDelayMinutes: 5,
trigger: "count:30m($scalyr-category='log' $logSubType='businessProcesses' $logType='operationsStatus' $perMin8h > 0) \n\n> \n\ncount:30m($scalyr-category='log' $logSubType='businessProcesses' $logType='operationsStatus' $perMin2w > 0)"
},
...
Note 1: The Teams webhook URL is deliberately shortened
Note 2: The minified JSON is inserted between two additional sets of square brackets after the URL (highlighted in bold red in the above example)
Note 3: Double quotation marks (") have been escaped
Note 4: Example values have been used for all fields -- although the alertAddress
field is fully functional. Please feel free to duplicate this example, then configure it as needed for your platform / application!
The DataSet Alert is displayed in the Teams channel as follows:
Comments
0 comments
Please sign in to leave a comment.