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

Added mapping from alert attributes to 1..n teams channel #358

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SimoneFalzone
Copy link

Problem:
Currently it is not possible to send alarms to multiple channels. Also, it is not possible to filter alarms based on their attributes and assign them to a specific channel.

Proposal for a solution:

The MS_TEAMS_ALERT_WEBHOOK_MAPPING configuration variable can be used to form
a mapping based on attribute values from an alert to a specific teams webhook.
Also custom attributes are supported.
For example:

MS_TEAMS_ALERT_WEBHOOK_MAPPING = [
    {
        "attributes" : {
            "event": "NodeDown",
        },
        "ms_teams_webhook": 'https://outlook.office.com/webhook/.../IncomingWebhook/.../...'
    },
        {
        "attributes" : {
            "custom_attribute_1": "custom_value_1",
            "custom_attribute_2": "custom_value_2",
            "severity": "critical",
        },
        "ms_teams_webhook": 'https://outlook.office.com/webhook/.../IncomingWebhook/.../...'
    }
]

If all attributes of an alarm are matched for multiple mappings,
the alarm is sent to each matching channel.

@SimoneFalzone SimoneFalzone changed the title Added mapping from alert attributes to a specified teams channel Added mapping from alert attributes to 1..n teams channel Jun 2, 2021
@jjh74
Copy link
Contributor

jjh74 commented Jun 25, 2021

I like this idea, you could probably do the same with routing plugin, but with this there's no need to code the logic in routing plugin.

Is MS_TEAMS_WEBHOOK_URL used as a default/catchall channel ? If so could you explain that in README.md.
Is it possible to all attributes from https://docs.alerta.io/en/latest/api/alert.html#attributes to do matching/mapping ?

(Slack plugin seems to use configuration ending in _MAP, so perhaps MS_TEAMS_ALERT_WEBHOOK_MAP instead of MAPPING ?)

@SimoneFalzone
Copy link
Author

@jjh74

Is MS_TEAMS_WEBHOOK_URL used as a default/catchall channel ? If so could you explain that in README.md.
Is it possible to all attributes from https://docs.alerta.io/en/latest/api/alert.html#attributes to do matching/mapping ?

Yes it can be used as default channel. I have added the missing documentation.

(Slack plugin seems to use configuration ending in _MAP, so perhaps MS_TEAMS_ALERT_WEBHOOK_MAP instead of MAPPING ?)

Good point that I have not seen that. I renamed the MS_TEAMS_ALERT_WEBHOOK_MAPPING to MS_TEAMS_ALERT_WEBHOOK_MAP.

@SimoneFalzone
Copy link
Author

Hey @jjh74 any good news on this PR?

@jjh74
Copy link
Contributor

jjh74 commented Sep 17, 2021

@SimoneFalzone Nick(@satterly ) maintains alerta. Perhaps Nick has some time to take a look at this.

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.

None yet

2 participants