idealista / prom2teams

prom2teams is an HTTP server built with Python that receives alert notifications from a previously configured Prometheus Alertmanager instance and forwards it to Microsoft Teams using defined connectors
Apache License 2.0
268 stars 84 forks source link

[SUPPORT] Configuration For Multiple Connectors #302

Closed GingerGraham closed 1 year ago

GingerGraham commented 2 years ago

Description

I'm looking for some guidance/documentation on some aspects of using the same prom2teams instance to send different types of alert to different destinations.

Additional Information

I have 2 primary questions that I cannot seem to find answers for in documentation or in general web searching.

  1. The readme documentation suggests that it is possible to define additional connectors but it is unclear how to leverage these. Is there any guidance on how I can get utilise additional connectors?

    • I have a Connector and a Connector2 defined in my config.ini file. Sending an alert only sends to the default connector
    • I notice the documentation refers to AnotherConnector is this a name requirement in the same way as Connector appears to be?
  2. Along with sending alerts to different channels, is there any way to use different message cards for different alerts sent?

GingerGraham commented 1 year ago

I've figured out the answer myself for question (1). I'm still looking for any guidance anyone can offer on question (2) regarding different message card templates if anyone has any insight?

For anyone struggling like me the connector used to send to a specified webhook is controlled by the Receiver(s) defined on the AlertManager side.

As an example

      - name: 'test'
        webhook_configs:
          - url: "http://prom2teams:8089/v2/connector"  # sends to defined webhook for connector
            send_resolved: true

      - name: 'test2'
        webhook_configs:
          - url: "http://prom2teams:8089/v2/connector2" # sends to defined webhook for connector 2
            send_resolved: true
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

abdennour commented 1 year ago

that's really weird! actually i got that part because i worked heavily on msteams integration. But still the naming convention of connectors keys is not clear. I mean connectors values are the webhook URLS. .. but what about connector names/keys? I am asking that question because I can see in the helm chart that the rendering of muliple connectors is done by this snippet:

https://github.com/idealista/prom2teams/blob/2787d324db5529fd020980f857f36635789cdbcc/helm/templates/configmap.yaml#L27-L29

update

got it by myself! actually it's an ini file format and all those keys under the MS Teams section,,, so it's isolated than other configurations.. Thus no convention on connector key naming.. but just make sure it's RFC 1035 compliant