Webhooks are a great way to integrate MS Teams with external apps, Datadog in our case. It is an HTTP POST request sent to a callback URL to provide messages and notifications, allowing connections to Web Services and MS Teams. With this, you can:
-
Respond to messages when mentioned (outgoing webhooks).
-
Send proactive messages to configured channels in MS teams (incoming webhooks and connectors).
Here, we are going to concentrate on incoming webhooks and connectors. You can forward all the notifications and alerts for Chef Automate in Datadog to Microsoft Teams.
-
Login to MS Teams
-
Select Teams --> Select the Team --> Add channel. Here, we named the channel "Datadog Alerts".
-
Create connector.
Note: In the newer version of Microsoft Teams, the connectors menu option has been moved to the location below. Kindly follow the same if you have a similar version of Microsoft Teams:
-
Go to "manage channel" > Find the "Connectors" option.
-
Select the Edit button from the Connector section.
See the below screenshot for reference.
-
Search for Datadog, select add, and then select Configure
-
Configure the webhook URL here; it's a self-explanatory step; once done, select save. You will need this URL later to integrate into the Datadog application.
-
On Microsoft Teams, select Apps in the vertical toolbar.
-
Search for "Datadog".
-
Select Add to install the Datadog App.
-
Now go to your Datadog application, navigate to Microsoft Teams Title
Or, in the Datadog app, from the left-hand bar, select Integrations --> Integrations; search for Microsoft Teams, install, and then select Configure.
-
Select Add Account, which will redirect you to Microsoft Authentication. Follow the prompts and select OK.
Note: It usually takes a few hours for MS teams to build the MS teams groups within Datadog for setting up notifications.
-
Log in to https://app.datadoghq.com/ with your credentials.
-
Under the page, select Integrations --> Integrations.
-
Search for Microsoft Teams and select Configure.
-
Add MS Teams channel with the webhook URL.
Note: We will need this teams channel name, which sets up notifications and alerts to be sent to Microsoft Teams webhook in the next step.
-
Login to https://app.datadoghq.com/ with your credentials.
-
From the left-hand side, select Service Management --> Incidents --> Settings --> Integrations; make the following changes for Datadog to send notifications to Microsoft Teams.
Here, under "Microsoft Teams" section, make the following appends:
-
Key in the following information from what you had created in your Microsoft Teams Account:
-
Tenant
-
Team
-
Channel
-
Once done, Select Save.
It is time to set monitors for your Automate HA infrastructure that can be sent as notifications/alerts over Teams and Email. The monitoring section teaches you how to create new monitors. To set up context for this section, let's take a simple monitor created to notify 4XX errors on the OpenSearch Service.
In the Datadog app, go to Monitors --> New Monitor
-
Select the detection method (we have selected "Threshold Alert" here)
-
Define what metrics you need to monitor
-
Define your alert conditions
To create notifications/alerts to be sent to the designated Teams webhook (with MS Teams Channel) you created in Step2.
In Step2, the webhook was associated with Microsoft Teams Channel msteams-automateha-alerts
To set up notifications, you can take a cue from "Use Message Template Variables" as highlighted below.
Once done, you can also test if the notifications reach their desired targets by selecting Test Notifications. After confirming that you received the alerts in your teams channel (as shown below), select save to make it perpetual.
You can use the following official references: