# PMM 2.26,Integrated Alerting,webhook,no alert message

**URL:** <https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366>\
**Category:** PMM 2.x\
**Created:** [February 11, 2022, 6:56am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366 "2022-02-11T06:56:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 11, 2022, 6:56am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/1 "2022-02-11T06:56:27Z")

</div>

After enabling the Integrated Alerting feature, no alert messages are received.  
How can I find out the reason?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/898359a6502e846363ea852682cde5da3c0de951.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/7/70b0051e1f9b99a4cec2bb5ee0380500c362bba4.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/8e7cba8fe8603599daf6488c68c56027a7cb43c6.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/b/becb2104618f47eefc16f6f74197ad8ee597a533.png)

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [February 11, 2022, 9:10am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/2 "2022-02-11T09:10:22Z")

</div>

Hi @peng19832

Did you add any filters in the Alert rules section?

---

<div class="post-metadata">

**Author:** ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)\
**Post date:** [February 11, 2022, 3:54pm UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/3 "2022-02-11T15:54:37Z")

</div>

Other things to check:  
did you add the configured webhook notification channel to the alert? (it’s not required and means it will only display on the alerts tab)  
you can download diagnostic data (gear icon → Settings → Download Server Diagnostics  
and in the zip file are all the logs…look at vmalert.log, alertmanager.log, and pmm-managed.log to see if there are any errors about calling the webhook (maybe a connection refused or invalid credentials). Have seen more than one instance where a corporate firewall/proxy rule blocked PMM server from connecting to the outside world.

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 14, 2022, 1:14am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/4 "2022-02-14T01:14:57Z")

</div>

No, no other filters

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/a/ab5d5caf2d377764029d037412733a0e7392def5.png)

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 14, 2022, 1:25am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/5 "2022-02-14T01:25:48Z")

</div>

Hello, steve  
I upload the log file.  
Firewall is turned off.  
vmalert.log:  
[vmalert.log](https://forums.percona.com/uploads/short-url/1i6Q80pGc3S0659kLUXywgolgfP.log) (140.7 KB)  
alertmanager.log:  
[alertmanager.log](https://forums.percona.com/uploads/short-url/pT4xAsWiBEa4UisMD4KjD7ZLj01.log) (27.8 KB)  
pmm-managed.log:  
[pmm-managed.log](https://forums.percona.com/uploads/short-url/qo2VxNCscBAfkGZW0jqKFYYLv5x.log) (200.4 KB)

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 14, 2022, 1:31am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/6 "2022-02-14T01:31:51Z")

</div>

In addition, the alerts I configured on the panel are normal.  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/3/3c9c38d774cc03d93f7160520b8c391a48642b98.png)

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [February 14, 2022, 3:48pm UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/7 "2022-02-14T15:48:12Z")

</div>

Hi, like Steve mentioned, to receive messages you need to configure a destination in Settings → Communication. Check out this post for more details: [MongoDB Integrated Alerting in Percona Monitoring and Management - Percona Database Performance Blog](https://www.percona.com/blog/2021/06/14/mongodb-integrated-alerting-in-percona-monitoring-and-management/)

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 15, 2022, 6:07am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/9 "2022-02-15T06:07:49Z")

</div>

Hi,igroene,thks for reply.  
Why do I need a Communication when I define Notification Channels? Communication cannot be applied to Ali Dingding.

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [February 15, 2022, 11:11am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/10 "2022-02-15T11:11:55Z")

</div>

I am sorry I misunderstood what you are trying to do here, please ignore my previous reply. The most likely cause is that communication from PMM to the web hook is not working properly. Anything in the logs about connection timeout/refuse?

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [February 17, 2022, 5:58am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/11 "2022-02-17T05:58:49Z")

</div>

It s OK.  
The log file mentioned by Steve, which I have uploaded in the reply above.  
I don’t see any useful exceptions in the logs, or maybe I don’t know enough about the PMM logs, causing me to ignore useful information?  
Can you help me analyze it, thanks?

---

<div class="post-metadata">

**Author:** ![Jeromeyysun](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@Jeromeyysun](https://forums.percona.com/u/Jeromeyysun)\
**Post date:** [June 12, 2024, 8:09am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/12 "2024-06-12T08:09:34Z")

</div>

I meet same problem, my browser debug network info，I got the request format which dont meet the requirement of lark group robot webhook. So I startup a proxy hosted one python script for rewrite request and sent it to webhook address, then it works! Attach method below:  
好的，可以只开启 Flask 的 debug 模式，并在处理请求的过程中打印实际的告警信息。下面是简化后的脚本：

```python
from flask import Flask, request, jsonify
import requests

app = Flask( __name__ )

@app.route('/webhook', methods=['POST'])
def webhook():
    data = request.json

    # 打印接收到的请求数据
    print("Received data:", data)

    # 提取和格式化实际的告警信息
    if data and 'alerts' in data:
        alerts = data['alerts']
        for alert in alerts:
            status = alert.get('status', 'Unknown status')
            labels = alert.get('labels', {})
            annotations = alert.get('annotations', {})
            instance = labels.get('instance', 'Unknown instance')
            summary = annotations.get('summary', 'No summary')
            description = annotations.get('description', 'No description')

            # 格式化为飞书机器人的消息格式
            new_data = {
                "msg_type": "text",
                "content": {
                    "text": f"告警状态: {status}\n实例: {instance}\n摘要: {summary}\n详细信息: {description}"
                }
            }

            # 转发请求到飞书 Webhook URL
            feishu_webhook_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/your-webhook-id'
            response = requests.post(feishu_webhook_url, json=new_data)

            # 打印转发结果
            print("Sent to Feishu:", new_data)
            print("Feishu response status:", response.status_code, "response:", response.json())
    
    return jsonify({"status": "received"}), 200

if __name__ == ' __main__':
    app.run(host='0.0.0.0', port=8080, debug=True)

```

### 运行脚本

保存脚本到一个文件（例如 `webhook_server.py`），然后运行脚本：

```bash
python webhook_server.py

```

### 说明

1. **开启 Flask 的 debug 模式** ：  
`app.run(host='0.0.0.0', port=8080, debug=True)` 这行代码启用了 Flask 的 debug 模式，使得 Flask 会打印更多的调试信息。

2. **打印接收到的请求数据** ：  
`print("Received data:", data)` 这行代码会在终端打印接收到的请求数据。

3. **提取和格式化告警信息** ：  
根据接收到的告警信息，提取并格式化成飞书机器人要求的格式。

4. **转发请求到飞书 Webhook URL** ：  
使用 `requests.post` 方法将格式化的消息发送到飞书机器人 Webhook URL。

5. **打印转发结果** ：  
`print("Sent to Feishu:", new_data)` 和 `print("Feishu response status:", response.status_code, "response:", response.json())` 这些代码会在终端打印发送到飞书的消息内容和飞书的响应状态、响应内容。

这样，你可以在终端看到实际的告警信息，并确保这些信息被正确格式化和转发。

---

<div class="post-metadata">

**Author:** ![peng19832](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@peng19832](https://forums.percona.com/u/peng19832)\
**Post date:** [June 12, 2024, 8:22am UTC](https://forums.percona.com/t/pmm-2-26-integrated-alerting-webhook-no-alert-message/14366/13 "2024-06-12T08:22:18Z")

</div>

@Jeromeyysun 谢谢大佬的回复，我后面试试看有没有用。 😄
