From 5a2432a0eb88fd44d98554fa685526ece212bacb Mon Sep 17 00:00:00 2001 From: mpana Date: Fri, 24 Jul 2020 15:11:18 +0300 Subject: [PATCH] add teams notif script --- checkmk-teams-notification/teams.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 checkmk-teams-notification/teams.sh diff --git a/checkmk-teams-notification/teams.sh b/checkmk-teams-notification/teams.sh new file mode 100644 index 0000000..fb99f2d --- /dev/null +++ b/checkmk-teams-notification/teams.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Notify via Microsoft Teams + +# Has not been tested with bulking! +# - copy this script into ~/local/share/check_mk/notificaions +# - make sure it is executable +# - create a microsoft teams incoming webhook (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook) +# - use the Notify via Microsoft Teams Notification Method in your notification rule + +# Microsoft webhook: + +1. Open the Channel and click the More Options button which appears as three dots at the top right of the window. +2. Select Connectors. +3. Scroll down to Incoming Webhook and click the Add button. +4. Choose a name you like for the connector as well as an image and finally click Create. +5. A new unique URI is automatically generated. Copy this URI string below in the URL variable. +. + +TEXT="$NOTIFY_HOSTNAME: $NOTIFY_SERVICEDESC: $NOTIFY_SERVICESTATE $NOTIFY_SERVICEOUTPUT" +URL="" + +curl -H "Content-Type: application/json" -d "{\"text\": \"$TEXT\"}" $URL -4