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
274 stars 85 forks source link

[SUPPORT] - MSTeams : Failed to establish a connection #318

Closed Vivien1978 closed 1 year ago

Vivien1978 commented 1 year ago

Hello,

Each times i try to send an alert to MSTeams an error occurs :

HTTPSConnectionPool(host='groupeonet.webhook.office.com', port=443): Max retries exceeded with url: /webhookb2/.........-6f8372f625d4 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fa0dc5ab670>: Failed to establish a new connection: [Errno -3] Try again'))

I use a docker image launch with the command below :

docker run -d -it -e PROM2TEAMS_LOGLEVEL="DEBUG" -e PROM2TEAMS_GROUP_ALERTS_BY=name -e PROM2TEAMS_CONNECTOR=https://groupeonet.webhook.office.com/webhookb2/.......6f8372f625d4 -p 8089:8089 --name prom2teams idealista/prom2teams

The conf should be ok since the the connection is trying to be set.

Do you know what could be the origin of the issue ?

P.S : As it's my first issue hope i did not make mistakes.

Thanks for your help.

Oleksandr-Nikiha commented 1 year ago

@Vivien1978 Hello, I have the same situation. I think network problem. Tried telnet grouponet.webhook.office.com 443 ? Is there access from the client to the address?

Vivien1978 commented 1 year ago

Hello, Effectively, i think it's a network problem. The webhook's URL is in HTTPS but i never configure it. However (hoping that is the issue), where do i have to realize that configuration ? In the alertmanager.yml or in the prom2teams server ? I assume that it should be in Prom2Teams but how can i do that ? I didn't see anything about TLS or else in the documentation.

Thanks for your help.

Oleksandr-Nikiha commented 1 year ago

@Vivien1978 You can try here "prom2teams/prom2teams/app/teams_client.py" in the line 46 "response = self.session.post(teams_webhook_url, data=message, timeout=self.timeout)" add verify=False.

Example: response = self.session.post(teams_webhook_url, data=message, timeout=self.timeout, verify=False)

But most likely, your urllib may start to argue about the lack of a certificate.

Vivien1978 commented 1 year ago

Hello, I just notice your answer.I use a docker image to launch prom2teams, so i can't modify that file. However i'm not an expert at it so if it exists a way to realize that modification, please let me know

Thanks

Vivien1978 commented 1 year ago

Ok it's solved. Indeed, It was a network issue, a permission was needed and given by the network service