notify-usolved-teams

Send monitoring notifications to a Microsoft Teams channel with this plugin.

notify_usolved_teams

Overview

This plugins sends monitoring notifications to a Microsoft Teams channel. You can define and customize the information that will be sent to the MS Teams channel. This plugin can be added to monitoring solutions like Icinga or Nagios. Generally speaking, the plugin can be used anywhere where direct execution of notification scripts is possible.

Installation

Add the script to your monitoring plugin folder

Just download and copy the file notify_usolved_teams.php into your Nagios/Icinga plugin directory. For example to /usr/local/nagios/libexec/.

Add execution permission for your monitoring user on the file check_usolved_disks.php. If you have at least PHP 5.6 or above this plugin should run out-of-the-box. We know that there are monitoring systems out there that are never updated. That's why there's still support such an old PHP version ;).

Create a MS Teams channel Webhook URL

Click on the three dots or right click the channel you like to get the notification pushed in. Go to the menu item Connectors and then configure and add Incoming Webhook. A unique Webhook URL will be created that you need to use as a parameter in the plugin configuration.

Usage

Test from command line

If you are in your plugin directory execute this command:

./notify_usolved_teams.php --url="https://outlook.office.com/webhook/YOURCODE1/IncomingWebhook/YOURCODE2" --title="Host SERVERNAME is DOWN" --subtitle="01-01-1970 07:40:00" --message="Type{:}PROBLEM{|}Host{:}SERVERNAME{|}State{:}DOWN{|}Info{:}CRITICAL - 1.1.1.1: Host unreachable @ 1.1.1.1. rta nan, lost 100%" --link="https://monitoring.domain.com/index.php?host_name=SERVERNAME" --state="DOWN"

The plugins returns the exit code 0 if everyhing went fine and 2 if an issue occured. Check with echo $? after executing the command.

Arguments

You can use these arguments to configure the output of the plugin.


--url=""
This is the url you have to create and paste from your MS Teams channel

--title=""
This is the headline of the message card

[--subtitle=""]
Optional: This is the sub headline of the message card

--message="