Skip to content

Commit 3ef0aaa

Browse files
authored
Merge pull request #997 from flashcatcloud/feat/pgdash-test
docs: add pgDash alert integration
2 parents 5b834db + 2efe781 commit 3ef0aaa

4 files changed

Lines changed: 205 additions & 0 deletions

File tree

‎docs.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@
17151715
"zh/on-call/integration/alert-integration/alert-sources/fivetran",
17161716
"zh/on-call/integration/alert-integration/alert-sources/coralogix",
17171717
"zh/on-call/integration/alert-integration/alert-sources/pulseway",
1718+
"zh/on-call/integration/alert-integration/alert-sources/pgdash",
17181719
"zh/on-call/integration/alert-integration/alert-sources/uptimeobserver",
17191720
"zh/on-call/integration/alert-integration/alert-sources/rbltracker",
17201721
"zh/on-call/integration/alert-integration/alert-sources/dash0",
@@ -3348,6 +3349,7 @@
33483349
"en/on-call/integration/alert-integration/alert-sources/fivetran",
33493350
"en/on-call/integration/alert-integration/alert-sources/coralogix",
33503351
"en/on-call/integration/alert-integration/alert-sources/pulseway",
3352+
"en/on-call/integration/alert-integration/alert-sources/pgdash",
33513353
"en/on-call/integration/alert-integration/alert-sources/uptimeobserver",
33523354
"en/on-call/integration/alert-integration/alert-sources/rbltracker",
33533355
"en/on-call/integration/alert-integration/alert-sources/dash0",
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "pgDash alert integration"
3+
description: "Send pgDash PostgreSQL monitoring alerts to Flashduty On-call through webhooks."
4+
keywords: ["alert integration", "pgDash", "PostgreSQL", "database monitoring", "webhook"]
5+
---
6+
7+
Use pgDash webhook notifications to send PostgreSQL monitoring alerts to Flashduty On-call. Each pgDash server maps to one Flashduty alert: it triggers or updates when alert rules fire on the server, and recovers automatically when all of its alerts clear.
8+
9+
<div className="hide">
10+
11+
## In Flashduty On-call
12+
---
13+
14+
You can get the integration push URL in either of the following ways.
15+
16+
### Use a dedicated integration
17+
18+
1. In the Flashduty console, select **Channel** and open a channel
19+
2. Select **Configuration** → **Integrations** → **Private integration**, then click **Add an integration**
20+
3. Select **pgDash** and click **Save**
21+
4. Open the new integration card and copy the **Push URL**
22+
23+
### Use a shared integration
24+
25+
1. In the Flashduty console, select **Integration Center → Alert Events**
26+
2. Select **pgDash** and enter an integration name
27+
3. Configure the default route and select a channel. You can add more rules under **Routes** after creation
28+
4. Click **Save** and copy the generated **Push URL**
29+
30+
</div>
31+
32+
## Configure pgDash
33+
---
34+
35+
The setup is the same for pgDash SaaS and self-hosted pgDash. Webhooks require pgDash 2.4.11 or later.
36+
37+
<Steps>
38+
<Step title="Set alert rules">
39+
40+
1. Sign in to pgDash and select the server to connect from the server list
41+
2. Select **Alerts** in the left menu and add server, database, table, or tablespace level rules as needed. Each rule can be a warning or a critical alert
42+
43+
Alert rules are evaluated each time pgDash receives a pgmetrics report for the server.
44+
45+
</Step>
46+
47+
<Step title="Enter the webhook URL">
48+
49+
1. On the server's **Alerts** page, find the webhook URL field under **Notification Settings**
50+
2. Enter the full Flashduty push URL (including `integration_key`). An `https` URL must have a valid certificate
51+
3. Click **Update** to save
52+
53+
Webhooks are set per server. To connect more servers, repeat this step for each server. They can share the same push URL.
54+
55+
</Step>
56+
</Steps>
57+
58+
<Warning>
59+
Enter this push URL only on the **Alerts** page. Notifications from the **Change Alerts** page carry no alert state; when they reach this integration, Flashduty returns success and creates no alert.
60+
</Warning>
61+
62+
## Alert lifecycle
63+
---
64+
65+
pgDash webhooks are edge-triggered: a notification is sent only when the alert status of a server changes, and each notification carries every current alert item of that server (the `alerts` array). When all alerts clear, pgDash sends one notification with an empty `alerts` array.
66+
67+
Flashduty therefore computes the Alert Key from the server name `server`, so every notification for the same server lands on the same alert:
68+
69+
- A notification with alert items triggers or updates the alert. The title and description are replaced with the latest alert items
70+
- A notification with an empty `alerts` array recovers the alert
71+
72+
When a single alert item clears while the server still has other alerts, pgDash sends no separate recovery for that item. The Flashduty alert stays triggered and its description lists only the items still firing. Flashduty rejects requests that lack the `server` or `alerts` field.
73+
74+
<Tip>
75+
Renaming a server in pgDash produces a new Alert Key. Close alerts under the old name manually.
76+
</Tip>
77+
78+
## Severity
79+
---
80+
81+
| pgDash alert items | Flashduty severity |
82+
| :--- | :--- |
83+
| Any item has `type` `crit` | Critical |
84+
| Otherwise (`warn`) | Warning |
85+
| `alerts` is empty | Recovered |
86+
87+
## Alert content
88+
---
89+
90+
- **Title**: `server name: rule description`, taken from the first `crit` item (or the first item if none is critical). `(+N more)` is appended when there are several items
91+
- **Description**: the pgmetrics report time (UTC) and, for each alert item, its type, rule description, current value, object name, and link. Query-level alerts include the SQL text (truncated to 500 characters). Up to 50 items are listed
92+
- **Labels**: `server`, `check` (rule description of the item used in the title), `resource` (that item's object name), `link` (that item's pgDash link), `alert_count` (number of current alert items), `source` (always `pgdash`)
93+
94+
## Troubleshooting
95+
---
96+
97+
- **pgDash sends nothing**: pgDash notifies only when the alert status changes and does not repeat an unchanged state. Check that an alert rule has fired and that the webhook is set on the **Alerts** page, not the **Change Alerts** page
98+
- **Delivery times out**: pgDash expects a response within 3 seconds and retries at most 3 times on timeout. For self-hosted pgDash, make sure the pgDash server can reach the push URL
99+
- **The alert does not recover**: it recovers only when all alerts of the server clear. While any other item is still firing, the alert stays open
100+
101+
For field details, see [pgDash Webhooks](https://docs.pgdash.io/webhooks/).

‎integration-docs/src/doc-map.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const docMap = {
100100
Dolphinscheduler: `${alertBase}/dolphinscheduler.mdx`,
101101
AlertSite: `${alertBase}/alertsite.mdx`,
102102
Pulseway: `${alertBase}/pulseway.mdx`,
103+
PgDash: `${alertBase}/pgdash.mdx`,
103104
Fivetran: `${alertBase}/fivetran.mdx`,
104105
Cato: `${alertBase}/cato.mdx`,
105106
Aikido: `${alertBase}/aikido.mdx`,
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "pgDash 告警集成"
3+
description: "通过 Webhook 将 pgDash 的 PostgreSQL 监控告警同步到 Flashduty On-call。"
4+
keywords: ["告警集成", "pgDash", "PostgreSQL", "数据库监控", "Webhook"]
5+
---
6+
7+
通过 pgDash 的 Webhook 通知将 PostgreSQL 监控告警同步到 Flashduty On-call。每个 pgDash 服务器对应一条 Flashduty 告警:服务器上有告警规则触发时创建或更新,全部告警消除时自动恢复。
8+
9+
<div className="hide">
10+
11+
## 在 Flashduty On-call
12+
---
13+
14+
您可通过以下两种方式获取集成推送地址,任选其一即可。
15+
16+
### 使用专属集成
17+
18+
1. 进入 Flashduty 控制台,选择 **协作空间**,打开一个协作空间
19+
2. 选择 **配置** → **集成数据** → **专属集成**,点击 **新增一个集成**
20+
3. 选择 **pgDash**,点击 **保存**
21+
4. 打开生成的集成卡片,复制 **推送地址**
22+
23+
### 使用共享集成
24+
25+
1. 进入 Flashduty 控制台,选择 **集成中心 → 告警事件**
26+
2. 选择 **pgDash**,填写集成名称
27+
3. 配置默认路由并选择协作空间;创建后可在 **路由** 中增加更多规则
28+
4. 点击 **保存**,复制生成的 **推送地址**
29+
30+
</div>
31+
32+
## 在 pgDash 中配置
33+
---
34+
35+
pgDash SaaS 版和自托管版的配置方式相同,Webhook 需要 pgDash 2.4.11 及以上版本。
36+
37+
<Steps>
38+
<Step title="设置告警规则">
39+
40+
1. 登录 pgDash,在服务器列表中选择要接入的服务器
41+
2. 在左侧菜单选择 **Alerts**,按需添加服务器、数据库、表或表空间级别的告警规则,每条规则可设为警告(warning)或严重(critical)
42+
43+
告警规则在 pgDash 每次收到该服务器的 pgmetrics 报告时计算。
44+
45+
</Step>
46+
47+
<Step title="填写 Webhook 地址">
48+
49+
1. 在该服务器 **Alerts** 页面的 **Notification Settings** 中,找到 Webhook 地址输入框
50+
2. 填写 Flashduty 集成的完整推送地址(包含 `integration_key`)。使用 `https` 地址时证书必须有效
51+
3. 点击 **Update** 保存
52+
53+
Webhook 按服务器设置。需要接入多个服务器时,请为每个服务器重复此步骤,可以使用同一个推送地址。
54+
55+
</Step>
56+
</Steps>
57+
58+
<Warning>
59+
请只在 **Alerts** 页面填写此推送地址。**Change Alerts** 页面的变更通知没有告警状态,发送到本集成时 Flashduty 会返回成功但不创建告警。
60+
</Warning>
61+
62+
## 告警生命周期
63+
---
64+
65+
pgDash 的 Webhook 是边沿触发的:只有服务器的告警状态发生变化时才发送通知,每次通知都带上该服务器当前全部的告警项(`alerts` 数组);所有告警消除时,发送一次 `alerts` 为空的通知。
66+
67+
因此 Flashduty 按服务器名称 `server` 计算 Alert Key,同一服务器的所有通知落在同一条告警上:
68+
69+
- 有告警项的通知:触发或更新告警,标题和描述替换为最新的告警项
70+
- `alerts` 为空的通知:告警恢复
71+
72+
单个告警项消除而服务器仍有其他告警时,pgDash 不会单独发送该项的恢复,Flashduty 告警保持触发,描述只列出仍在触发的告警项。请求缺少 `server` 或 `alerts` 字段时 Flashduty 会拒绝。
73+
74+
<Tip>
75+
在 pgDash 中修改服务器名称会产生新的 Alert Key,旧名称下的告警需要手动关闭。
76+
</Tip>
77+
78+
## 告警等级
79+
---
80+
81+
| pgDash 告警项 | Flashduty 等级 |
82+
| :--- | :--- |
83+
| 任一告警项的 `type` 为 `crit` | Critical |
84+
| 其他(`warn`) | Warning |
85+
| `alerts` 为空 | 恢复 |
86+
87+
## 告警内容
88+
---
89+
90+
- **标题**:`服务器名: 告警规则描述`,取第一条 `crit` 告警项(没有时取第一条告警项);有多条告警项时附加 `(+N more)`
91+
- **描述**:pgmetrics 报告时间(UTC),以及每条告警项的等级、规则描述、当前值、对象名称、链接;查询级别告警附带 SQL 文本(截断到 500 字符)。最多列出 50 条告警项
92+
- **标签**:`server`、`check`(标题所取告警项的规则描述)、`resource`(该告警项的对象名称)、`link`(该告警项的 pgDash 链接)、`alert_count`(当前告警项数量)、`source`(固定为 `pgdash`)
93+
94+
## 排查问题
95+
---
96+
97+
- **pgDash 没有发送通知**:pgDash 只在告警状态变化时发送;状态不变不会重复发送。确认告警规则已触发,且 Webhook 设置在 **Alerts** 页面而不是 **Change Alerts** 页面
98+
- **投递超时**:pgDash 要求 3 秒内响应,超时后最多重试 3 次;请确认 pgDash 服务器(自托管版)可以访问推送地址
99+
- **告警没有恢复**:只有该服务器全部告警消除时才会恢复;如仍有其他告警项触发,告警保持打开
100+
101+
字段含义请参阅 [pgDash Webhooks](https://docs.pgdash.io/webhooks/)。

0 commit comments

Comments
 (0)