Setting up Microsoft Teams alerting with Zabbix

At the time of writing this book, I’m living in The Netherlands and in the COVID-19 crisis. A lot of IT companies have been requested to make their employees work from home. Due to this, there’s been a rise in the use of Microsoft Teams and applications like it. Suddenly, a lot of companies have started using Microsoft Teams and others to make working from home and collaboration easier.

Let’s learn how we can make working with Microsoft Teams even better by integrating our Zabbix alerting into it.

Getting ready

We will need our Zabbix Server to be able to create some problems for us. For this, you can use lar-book-centos from our previous chapters or any Zabbix Server that you prefer.

We will also need general Microsoft Teams knowledge and, of course, Microsoft Teams itself set up and ready to go.

How to do it…

Follow these steps to complete this recipe:

  1. Let’s start by opening our Microsoft Teams application on either Windows, Mac, or Linux and creating a new channel. Go to Teams and click on the three dots () next to your team name, as shown in the following screenshot:
    Figure 8.24 – MS Teams – Add channel option

    Figure 8.24 – MS Teams – Add channel option

  2. In the Add channel window, fill in the following information to create our new channel:
    Figure 8.25 – MS Teams – Add channel window

    Figure 8.25 – MS Teams – Add channel window

  3. Now, click the purple Add button to add the channel. Upon doing this, we will be able to see our new channel in the list.
  4. Click on the three dots () next to your channel, as shown in the following screenshot:
    Figure 8.26 – MS Teams – Add Connectors option

    Figure 8.26 – MS Teams – Add Connectors option

  5. We want to select the Connectors options from this drop-down menu. This allows us to add our Microsoft Teams connector to this channel.
  6. We are using the search field here to find the official Zabbix Webhook connector:
    Figure 8.27 – MS Teams – Add Connectors window

    Figure 8.27 – MS Teams – Add Connectors window

  7. Click on the purple Add button next to the Zabbix Webhook connector to add this connector to our channel. This will open another pop-up window, where we must press the purple Add button again.
  8. You will get another pop-up window, where you need to copy the webhook URL. Do this by pressing the white Copy button:
    Figure 8.28 – MS Teams – Webhook URL

    Figure 8.28 – MS Teams – Webhook URL

  9. Now, press the purple Save button. Upon doing this, you can close the pop-up window.
  10. Go to the Zabbix frontend and navigate to Administration | Media types. Click on the MS Teams media type here.
  11. Scroll down until you see teams_endpoint. Paste the URL you copied previously here, as shown in the following screenshot:
    Figure 8.29 – Zabbix Administration | Media types, edit MS Teams page

    Figure 8.29 – Zabbix Administration | Media types, edit MS Teams page

  12. Now, press the blue Update button at the bottom of the page.
  13. If you didn’t follow the previous recipe, then create a new user group for our media types by navigating to Administration | User groups and clicking the Create user group button in the top-right corner. Add the following user group:
    Figure 8.30 – Zabbix, Create user group page, the External Services group

    Figure 8.30 – Zabbix, Create user group page, the External Services group

  14. Click on the Permissions tab and click on Select. Make sure that you select all the groups and subgroups with Read permissions. The Permissions tab will look like this:
    Figure 8.31 – Zabbix – Create user group permissions page, the External Services group

    Figure 8.31 – Zabbix – Create user group permissions page, the External Services group

  15. Now, click on the blue Add button and finish creating this user group.
  16. Navigate to Administration | Users and click on the blue Create user button in the top-right corner. Add the following user:
    Figure 8.32 – Zabbix Administration | Media types – Create new user page, MS Teams

    Figure 8.32 – Zabbix Administration | Media types – Create new user page, MS Teams

  17. Next, go to the Media tab of the Create user page. Click the underlined Add text here to create the following media:
    Figure 8.33 – Zabbix Administration | Media types – Create new user page, MS Teams

    Figure 8.33 – Zabbix Administration | Media types – Create new user page, MS Teams

  18. Once you’ve filled in this information, click the blue Add button at the bottom of the window and then the blue Add button at the bottom of the page.
  19. If you didn’t follow the previous recipe, then you will also need to add a macro to Administration | General. Use the drop-down menu on this page to select Macros and add the following macro, which contains your Zabbix URL:
    Figure 8.34 – Zabbix Administration | General macros page, Zabbix URL for use with MS Teams

    Figure 8.34 – Zabbix Administration | General macros page, Zabbix URL for use with MS Teams

  20. Click on the blue Update button. You will also need to go to Administration | Actions if you didn’t follow the previous recipe and, on the Trigger Actions page, click on the blue Create action button.
  21. Use Notify external services for the name of the action and go to Operations. Add the following operations:
    Figure 8.35 – Zabbix – Create action operations page, Notify external services for use with MS Teams

    Figure 8.35 – Zabbix – Create action operations page, Notify external services for use with MS Teams

    Tip

    We could also use Notify all involved here to send a message to all the users involved in the Operations steps.

  22. Now, click on the blue Add button and you’ll be done. You can now view new problems as they occur in your MS Teams channel:
Figure 8.36 – A Zabbix problem in an MS Teams channel

Figure 8.36 – A Zabbix problem in an MS Teams channel

How it works…

Microsoft Teams works in about the same way as our Slack setup. A problem is created in the Zabbix Server and if that problem matches our configured conditions in Zabbix, we send that problem to our Microsoft Teams connector.

For instance, we configured Zabbix so that it only sends problems with a severity of Warning or higher to Microsoft Teams, as shown here:

Figure 8.37 – Zabbix Media page for MS Teams users

Figure 8.37 – Zabbix Media page for MS Teams users

Our Microsoft Teams connector catches our problem and since this connector is configured directly on our channel, it posts a notification to the channel:

Figure 8.38 – Zabbix Microsoft Teams integration diagram

Figure 8.38 – Zabbix Microsoft Teams integration diagram

Now, we can see our Teams notifications in our channel and keep up to date with all our Zabbix issues directly via Microsoft Teams.

Related Articles

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

read more

Lorem ipsum dolor sit amet consectetur

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

8 − 8 =