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.
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:
- 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:
- In the Add channel window, fill in the following information to create our new channel:
- 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.
- Click on the three dots (…) next to your channel, as shown in the following screenshot:
- We want to select the Connectors options from this drop-down menu. This allows us to add our Microsoft Teams connector to this channel.
- We are using the search field here to find the official Zabbix Webhook connector:
- 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.
- You will get another pop-up window, where you need to copy the webhook URL. Do this by pressing the white Copy button:
- Now, press the purple Save button. Upon doing this, you can close the pop-up window.
- Go to the Zabbix frontend and navigate to Administration | Media types. Click on the MS Teams media type here.
- Scroll down until you see teams_endpoint. Paste the URL you copied previously here, as shown in the following screenshot:
- Now, press the blue Update button at the bottom of the page.
- 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:
- 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:
- Now, click on the blue Add button and finish creating this user group.
- Navigate to Administration | Users and click on the blue Create user button in the top-right corner. Add the following user:
- Next, go to the Media tab of the Create user page. Click the underlined Add text here to create the following media:
- 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.
- 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:
- 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.
- Use Notify external services for the name of the action and go to Operations. Add the following operations:
We could also use Notify all involved here to send a message to all the users involved in the Operations steps.
- 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:
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:
Our Microsoft Teams connector catches our problem and since this connector is configured directly on our channel, it posts a notification to the channel:
Now, we can see our Teams notifications in our channel and keep up to date with all our Zabbix issues directly via Microsoft Teams.