Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

Microsoft announced the deprecation of connectors. See the Deprecation note Retirement of Office 365 connectors within Microsoft Teams

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.3.0P11


Panel
borderColorblack
bgColor#f8f8f8
titleTable of Contents

Table of Contents

...

  1. Click the three dots on a channel and select “Workflows”

    Image showing the location of Workflows within Microsoft teams




  2. Choose “Post to a channel when a webhook request is received”

    Image showing location of the Post to a channel when a webhook request is received




  3. Choose a name for the workflow, e.g., “Checkmk”

    Tip

    In order for the following to work, you must already have an MS Teams channel specified.



    Image showing the Flow name of CheckmkImage Modified




  4. Select team and channel where the webhook should post to. In this case, I have a team and channel by the name of Checkmk, so I chose this.

    Image showing both the team and channel names as Checkmk




  5. Copy the webhook URL

    Image showing the location of the copy string



    Panel
    borderColor#ffeaae
    bgColor#fffdf6
    borderStylesolid
    titleNot Mandatory

    If you want to test whether you can POST to this webhook from the monitoring server, then you can try to run this script as site user:  I found a nice example with which you can check whether you can even post a message from the monitoring server to this webhook or not. 


    At the time of writing this article, this script works, however there is no guarantee that it will work when you try.  There is a very high possibility that the format/syntax/endpoint changes and the script has to be adapted.

    Note

    The script above will only work if you specify the Teams channel that was configured beforehand.


    Code Block
    languagebash
    themeRDark
    OMD[v23p13]:~$ ./test.sh “Webhook URL” “Workflows” “Default”“Teams_Channel” “Send from Checkmk.Happy Monitoring”


    Image showing test workflows

    .


  6. After this, let's move on to the Checkmk Notification configuration for teams and create a notification rule

    Tip

    You may need to sanitize the encoding of the Webhook URL from MS Teams before pasting it into Checkmk. 


    e.g., 

    • Unsanitized
      api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=g26

    • Sanitized
      api-version=2016-06-01&sp=/triggers/manual/run&sv=1.0&sig=g26



    Image outlining configuration details. Image Modified





  7. Last but not the least, you can fake a check result:

    Image showing a fake check result from Checkmk GUI



    Then you will see a message getting dropped in the corresponding Teams channel:
    Image showing another set of workflowsImage Removed
    Image showing another set of workflowsImage Added
    Image showing another set of workflowsImage Removed

    Image showing more workflowsImage Added
    Image showing more workflowsImage Removed


    This is a confirmation that your test notifications are working

...

If you are using Power Automate, then configure it flow like this:
Image showing the location of Power AutomateImage Removed
Image showing the location of Power AutomateImage Added



And this is the page where the flow is succeeded, and the messages gets dropped in:
Image showing that messages are being dropped inImage Removed
Image showing that messages are being dropped inImage Added


Here is the screenshot from Teams Channel:
Image Removed
Image Added



If the flow doesn't work, you may get some errors like these:

Image RemovedImage Added




Working json JSON (in case somebody wants to POST to the webhook directly):


Code Block
languagebash
themeRDark
[
  {
    "contentType": "application/vnd.microsoft.card.adaptive",
    "contentUrl": "null",
    "content": {
      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
      "type": "AdaptiveCard",
      "version": "1.3",
      "body": [
        {
          "type": "TextBlock",
          "text": "Checkmk: google/PING CRIT",
          "weight": "bolder",
          "size": "large",
          "style": "heading",
          "wrap": true
        },
        {
          "type": "TextBlock",
          "text": "Problem notification",
          "weight": "bolder",
          "wrap": true
        },
        {
          "type": "TextBlock",
          "text": "Checkmk: google/PING ",
          "wrap": true
        },
        {
          "type": "ColumnSet",
          "separator": true,
          "columns": [
            {
              "type": "Column",
              "width": "auto",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "Details",
                  "wrap": true,
                  "weight": "bolder"
                }
              ]
            },
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "__Host__: google",
                  "wrap": true,
                  "spacing": "none"
                },
                {
                  "type": "TextBlock",
                  "text": "__Service__:  PING",
                  "wrap": true,
                  "spacing": "none"
                },
                {
                  "type": "TextBlock",
                  "text": "__Event__:    ",
                  "wrap": true,
                  "spacing": "none"
                },
                {
                  "type": "TextBlock",
                  "text": "__Output__:   Test for MS teams",
                  "wrap": true,
                  "spacing": "none"
                },
                {
                  "type": "TextBlock",
                  "text": "__Perfdata__: ",
                  "wrap": true,
                  "spacing": "none"
                }
              ]
            }
          ]
        },
        {
          "type": "FactSet",
          "facts": [
            {
              "title": "Affected host groups",
              "value": "check_mk"
            }
          ],
          "separator": true
        }
      ],
      "actions": [
        {
          "type": "Action.OpenUrl",
          "title": "View service details in Checkmk",
          "url": "http://klapp-0323/v23p13/check_mk/index.py?start_url=view.py?view_name%3Dservice%26host%3Dgoogle%26service%3DPING%26site%3Dv23p13",
          "role": "Button"
        }
      ],
      "msteams": {
        "width": "Full"
      }
    }
  }
]

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "kb-how-to-article" , "microsoft-teams" ) and type = "page" and space in ( "CON" , = "KB" )
labelskb-how-to-article

Page Properties
hiddentrue


Related issues


...