Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert handler for Microsoft Teams #1965

Merged
merged 7 commits into from
May 11, 2020

Conversation

mmindenhall
Copy link

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)
Required only if applicable

You can erase any checkboxes below this note if they are not applicable to your Pull Request.
N/A

This adds support for sending alerts via Microsoft Teams (similar to Slack or HipChat). I followed the alert handlers guide where possible, and when I ran into problems, I looked at the source code for other alerts (e.g., HipChat). The tests implemented follow the same pattern of tests performed by the HipChat handler.

All tests are passing for me locally (except some unrelated UDF tests which fail due to python issues on my Mac).

@mmindenhall
Copy link
Author

Is there anyone who can take a look at this? @nathanielc? I'll be happy to update the docs once this is approved and merged.

@te4336
Copy link

te4336 commented Oct 23, 2018

@nathanielc Is there a way that this can be merged into Kapacitor code base for usage? I know that we use this heavily internally and this feature would be a huge plus.

@StefanSa
Copy link

StefanSa commented Jan 6, 2019

@nathanielc
as we switch from slack to ms teams, this would be a big help for us as well.

@StefanSa
Copy link

@mmindenhall
Thanks for teams webhook.
Can you change the color of the Webhook cards, similar to slack, depending on the alert status (crtitical, warning etc.)?

For example, with cards fields
themeColor": "EA4300"

@dominiclapointe
Copy link

Is this planned to be merged soon?

@rbetts rbetts requested a review from nathanielc February 11, 2019 22:26
@Gelob
Copy link

Gelob commented Apr 3, 2019

Wondering as well if this will be merged soon?

@mmindenhall
Copy link
Author

@StefanSa, unfortunately there is no way to change the theme or text color within a card. I agree that this is a significant shortcoming compared to Slack.

@StefanSa
Copy link

@mmindenhall
Copy link
Author

Ah, yes, you are right @StefanSa. I never tried the themeColor setting for this plugin, but had included it in a similar Java notifier library I wrote for some of our other projects.

According to the message card reference, the setting is intended for branding rather than communicating status:

themeColor String Specifies a custom brand color for the card. The color will be displayed in a non-obtrusive manner.

Do use themeColor to brand cards to your color.
Don't use themeColor to indicate status.

It would be easy to add to the card...but all it does is change the color of a line across the top of the card (screenshot).

@StefanSa
Copy link

StefanSa commented Apr 26, 2019

@mmindenhall
For me it works as expected with this example.

Playground on MS
https://messagecardplayground.azurewebsites.net

Alert

    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "EA4300",
    "sections": [
        {
            "activityTitle": "Service ftp1-server /cpu is  CRITICAL CPU is at 99.70",
              "facts": [
                {
                    "name": "Assigned to",
                    "value": "Unassigned"
                },
                {
                    "name": "Due date",
                    "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
                },
                {
                    "name": "Status",
                    "value": "Not started"
                }
            ],
            "markdown": true
        }
    ]
  }

OK

    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "00AA5A",
     "sections": [
        {
            "activityTitle": "Service ftp1-server /cpu is  OK CPU is at 1",
              "facts": [
                {
                    "name": "Assigned to",
                    "value": "Unassigned"
                },
                {
                    "name": "Due date",
                    "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
                },
                {
                    "name": "Status",
                    "value": "Not started"
                }
            ],
            "markdown": true
        }
    ]
  }

@mmindenhall
Copy link
Author

@StefanSa, I think the best way to implement support for themeColor would be to add additional elements to the Teams config struct to enable/disable using the themeColor, and to define colors (with defaults) for each alert level. For example, this might be the default configuration:

[teams]
theme-color-enabled = true  # enabled by default
ok-color = "008000"         # green
info-color = "008080"       # teal
warning-color = "FFFF00"    # yellow
critical-color = "FF0000"   # red
max-level-color = "800000"  # maroon

When the theme color is enabled, the Teams handler will configure the card with the color matching the alert level.

HOWEVER, it's been more than 10 months since I submitted this PR, and for some reason the team has ignored it completely. I don't plan to add to this PR unless/until it either gets merged, or the team lets me know what needs to be done for it to be merged.

@StefanSa
Copy link

@mmindenhall yes, unfortunately it has become quiet around kapacitor.
I have a bug ticket open since mid-December, with no response. Apparently all the energy and power goes into the development of influxdb v2.

@nathanielc @rbetts
Is there a chance to accelerate this whole, otherwise the community probably loses the desire to contribute something to the project here.

@syates21
Copy link

@StefanSa It doesn't seem like it's that quiet, as many other pull requests have been accepted. Hard to think of a good reason why nice work like this that has no conflicts wouldn't be accepted. I can't think of a few really lame reasons (mostly having to do with bias towards certain vendors).

@StefanSa
Copy link

So that there is no further speculation, it would be helpful if explained here why this good PR
not accepted / was.
This is not necessarily motivating, for the so-much-touted community.

@danlange
Copy link

Please merge this. Microsoft Teams support is an important feature to those of us who use Microsoft Teams.

@jgoeglein
Copy link

Bump and +1 . Is there any word on what needs to happen to move this one along?

Also, as an aside as to why this PR is important, Microsoft Teams is now bigger than Slack

@pwalleni
Copy link

Please accept this.

@stephen-burrows
Copy link

I'm investigating whether my company can use TICK. This feature is vital for us (thanks, mmindenhall for creating it!). Can we have an indication as to whether it's going to be merged?

@Clausewitz45
Copy link

More than a year, and this is still open. Every check passed, except the merge button. This is an important feature, please just merge.

@UpperM
Copy link

UpperM commented Dec 30, 2019

I did a little script in the meantime. If it helps... Https://github.com/UpperM/kapacitor-msteams

@chazragg
Copy link

any news on this ?

@CharlieRiesner
Copy link

pls merge :(

@easybe
Copy link

easybe commented Feb 26, 2020

Hi.

I am actually also very interested in this. Unfortunately, the company I work for loves M$ and their products, so, Teams it is.

It would indeed be nice to get some feedback from @nathanielc or anyone else form @influxdata.

I could also help hands-on if that is what it takes.

Cheers,
Ezra.

@hexinal
Copy link

hexinal commented Mar 16, 2020

Any eta @nathanielc ?

@kevinpz
Copy link

kevinpz commented Apr 8, 2020

Hi everyone!

We would really like to use Kapacitor at my current company as well, and since all our communications use Microsoft Teams, this is a real blocker for us.
Is there anything we can do to help this PR to be merged @nathanielc ?

Thanks a lot!

@plaurin84
Copy link

Hi,
I totally need this feature! 👍

@mattnotmitt
Copy link
Contributor

Hey @docmerlin I saw you've been going through other PRs, any plans to review this one?

@docmerlin
Copy link
Contributor

@mattnotmitt I do! I have to get a Microsoft Teams account first to test it though.

@timhallinflux timhallinflux requested review from docmerlin and removed request for nathanielc May 4, 2020 15:57
@mertbakir
Copy link

Hi, I see that this is merged already. Is this feature available or waiting for next release? May I ask the eta for next release?

@southbay82
Copy link

Great to see this was merged. Like what @mertbakir mentioned, is there a preferred means to monitor for upcoming releases and features/fixes contained within?

@mattnotmitt
Copy link
Contributor

@southbay82 click the Watch button on the repository and choose "releases only". You'll get an email/github notification when a release gets pushed on the repo. CHANGELOG.md should contain any updates when the release is created.

@sinistram
Copy link

sinistram commented Jun 23, 2020

When are you planning to release this feature?

@Tower450
Copy link

Tower450 commented Jul 17, 2020

The documentation is there but it do not seems to be released right?
Documentation URL: https://docs.influxdata.com/kapacitor/v1.5/event_handlers/microsoftteams/#set-up-teams

I tried it and i ended up with this error while declaring a topic-handler

failed to create handler: unsupported action kind "teams"

Any update about this? @docmerlin

@mertbakir
Copy link

OK this works now with Kapacitor 1.8.5 but it sends:
{{.Level}} {{.ID}} as title
.message as body.

It should be:
.message as title
.details as body.

Can we fix this? Should I open a new issue?
Also, chronograf needs a small update to add Teams as a handler.

@senses0
Copy link

senses0 commented Sep 1, 2020

I'm running Kapacitor 1.5.6-1 and Chronograf 1.8.5-1, and I've enabled Teams Event Handler as described here https://docs.influxdata.com/kapacitor/v1.5/event_handlers/microsoftteams/#set-up-teams

Kapacitor service restarts fine (no apparent errors in log messages) after configuration changes, however I'm not seeing "Teams" in Chronograf under "Alert Handlers", which I am guessing it should. Am I missing anything?

@msrpub
Copy link

msrpub commented Nov 26, 2020

OK this works now with Kapacitor 1.8.5 but it sends:
{{.Level}} {{.ID}} as title
.message as body.

It should be:
.message as title
.details as body.

Can we fix this? Should I open a new issue?
Also, chronograf needs a small update to add Teams as a handler.

Did you addressed this as an issue?

@mertbakir
Copy link

OK this works now with Kapacitor 1.8.5 but it sends:
{{.Level}} {{.ID}} as title
.message as body.

It should be:
.message as title
.details as body.

Can we fix this? Should I open a new issue?
Also, chronograf needs a small update to add Teams as a handler.

Did you addressed this as an issue?

No, I didn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.