Run using Microsoft Teams Notification

Star (0)

This tutorial will show you how to integrate Monika with Microsoft Teams using Incoming Webhook so that when there is a Monika incidents or recoveries alert, your team will be notified via existing Microsoft Teams channels. So, without further ado:

Setup Microsoft Teams Incoming Webhook

First things first, you need to have a team in Microsoft Teams. Download the Microsoft Teams app and create your user account. Then, follow the steps to create a new team. Now that we have our team ready, click the three dots on any channel in your team, and click Connectors.

Inside the connectors dialog, find the Incoming Webhook connector, click Add, and click Add again. Then, open the Connectors menu again, and find the Incoming Webhook again. This time, click Configure. Fill out your Incoming Webhook name, change the logo, and click Create. You should see that there is a new webhook link available for you to use with Monika.

Running Monika with Microsoft Teams Webhook

Now that we have our Webhook URL, it’s time to create a configuration called monika.yml:

- id: microsoft-teams
type: teams
- id: sample_login
name: Sample Login
- method: GET
- query: response.time > 800
message: Github response time is {{ response.time }} ms, expecting less than 800ms
- query: response.status != 200
message: Github status code is not 200. Please check the service status!
- query: response.time > 10000
message: Please check your internet connection

Let me explain a little bit about this configuration:

  • Monika is using the Microsoft Teams notification channel. You can change the notification channel by changing the type key to another value such as SMTP or WhatsApp. In the data object, there is only one key called url for your Webhook URL
  • Monika will be probing and will send you an alert if the response time is greater than 500 milliseconds or the response status code is not 200, meaning the website is down
  • If by chance when probing Github the response time is larger than 10000 milliseconds, you will receive an alert about your internet connection.

Now that we have our configuration ready, it’s time to run it with Monika. Go to the directory where you saved the Monika configuration, and run Monika straight away using monika -c monika.yml

Congratulations! Now that you have successfully integrated Monika with Microsoft Teams, you will be notified immediately through Microsoft Teams if your website is slow or down!

PT Artha Rajamas Mandiri (Hyperjump) is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of its modern DevOps practices.

Copyright © 2024 Hyperjump Tech. All Rights Reserved.