Skip to content

Commit

Permalink
support webhook custom template (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 committed Mar 10, 2024
1 parent f02a714 commit a90aada
Show file tree
Hide file tree
Showing 40 changed files with 236 additions and 160 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[![Twitter](https://img.shields.io/twitter/follow/hertzbeat1024?logo=twitter)](https://twitter.com/hertzbeat1024)
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UCri75zfWX0GHqJFPENEbLow?logo=youtube&label=YouTube%20Channel)](https://www.youtube.com/channel/UCri75zfWX0GHqJFPENEbLow)

**Home: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) | [hertzbeat.com](https://hertzbeat.com)**
**Home: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) Global | [hertzbeat.com](https://hertzbeat.com) China**

**Cloud: [console.tancloud.cn](https://console.tancloud.cn)**

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UCri75zfWX0GHqJFPENEbLow?logo=youtube&label=YouTube%20Channel)](https://www.youtube.com/channel/UCri75zfWX0GHqJFPENEbLow)


**官网: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) | [hertzbeat.com](https://hertzbeat.com)**
**官网: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) 全球网络 | [hertzbeat.com](https://hertzbeat.com) 中国网络**

**云服务: [console.tancloud.cn](https://console.tancloud.cn)**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private void afterThresholdRuleMatch(long currentTimeMilli, long monitorId, Stri
Map<String, String> tags = new HashMap<>(6);
tags.put(CommonConstants.TAG_MONITOR_ID, String.valueOf(monitorId));
tags.put(CommonConstants.TAG_MONITOR_APP, app);
tags.put(CommonConstants.TAG_POLICY_ID, String.valueOf(define.getId()));
tags.put(CommonConstants.TAG_THRESHOLD_ID, String.valueOf(define.getId()));
if (!CollectionUtils.isEmpty(define.getTags())) {
for (TagItem tagItem : define.getTags()) {
fieldValueMap.put(tagItem.getName(), tagItem.getValue());
Expand All @@ -270,7 +270,6 @@ private void afterThresholdRuleMatch(long currentTimeMilli, long monitorId, Stri
}
Alert alert = Alert.builder()
.tags(tags)
.alertDefineId(define.getId())
.priority(define.getPriority())
.status(ALERT_STATUS_CODE_PENDING)
.target(app + "." + metrics + "." + define.getField())
Expand Down Expand Up @@ -320,7 +319,7 @@ private void handlerAvailableMetrics(long monitorId, String app, CollectRep.Metr
Map<String, String> tags = new HashMap<>(6);
tags.put(CommonConstants.TAG_MONITOR_ID, String.valueOf(monitorId));
tags.put(CommonConstants.TAG_MONITOR_APP, app);
tags.put(CommonConstants.TAG_POLICY_ID, String.valueOf(avaAlertDefine.getId()));
tags.put(CommonConstants.TAG_THRESHOLD_ID, String.valueOf(avaAlertDefine.getId()));
tags.put("metrics", CommonConstants.AVAILABILITY);
tags.put("code", metricsData.getCode().name());
Map<String, Object> valueMap = tags.entrySet().stream()
Expand Down
2 changes: 2 additions & 0 deletions alerter/src/main/resources/alerter_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ alerter.notify.monitorId = Monitor ID
alerter.notify.monitorName = Monitor Name
alerter.notify.priority = Alert Priority
alerter.notify.triggerTime = Alert Trigger Time
alerter.notify.times = Alert Trigger Times
alerter.notify.tags = Alert Labels
alerter.notify.content = Alert Content
alerter.notify.console = Console Login
alerter.priority.0 = Emergency Alert
Expand Down
2 changes: 2 additions & 0 deletions alerter/src/main/resources/alerter_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ alerter.notify.monitorId = 所属监控ID
alerter.notify.monitorName = 所属监控名称
alerter.notify.priority = 告警级别
alerter.notify.triggerTime = 告警触发时间
alerter.notify.times = 告警触发次数
alerter.notify.tags = 告警标签
alerter.notify.content = 内容详情
alerter.notify.console = 登入控制台
alerter.priority.0 = 紧急告警
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public interface CommonConstants {
/**
* 内有标签: policyId 告警阈值规则ID
*/
String TAG_POLICY_ID = "policyId";
String TAG_THRESHOLD_ID = "thresholdId";

/**
* 内有标签: app 监控类型
Expand Down
6 changes: 6 additions & 0 deletions home/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

### Deployment to Gitee

```console
GITHUB_HOST=gitee.com USE_SSH=true yarn deploy
```
55 changes: 27 additions & 28 deletions home/docs/help/alert_webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,36 @@ keywords: [open source monitoring tool, open source alerter, open source webhook
Content format:JSON
```json
{
"id":76456,
"target":"available",
"alertDefineId":232,
"priority":0,
"content":"监控紧急可用性告警: UN_CONNECTABLE",
"tag": {
"monitorId": 3543534545,
"monitorName":"API_poetry.didi.top"
},
"status":0,
"times":1,
"gmtCreate":"2022-02-25T13:32:13",
"gmtUpdate":"2022-02-25T13:32:13"
"alarmId": 76456,
"target": "${target}",
"thresholdId": 33455,
"priority": 0,
"content": "udp_port monitoring availability alert, code is FAIL",
"status": 0,
"times": 1,
"triggerTime": "2022-02-25T13:32:13",
"tags": {
"app": "windows",
"monitorId": "180427708350720",
"metrics": "availability",
"code": "UN_CONNECTABLE",
"thresholdId": "112",
"monitorName": "WINDOWS_192.168.124.12"
}
}
```

| | |
|-----|-----|
| id | integer($int64) title: Alarm record entity primary key index ID |
| target | string title: Alert target object: monitor availability-available metrics-app.metrics.field |
| alertDefineId integer($int64) title: Alarm definition ID associated with the alarm |
| priority | string($byte) title: Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow |
| content | string title: The actual content of the alarm notification |
| status | string($byte) title: Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed |
| times | integer($int32) title: Alarm threshold trigger times |
| firstTriggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) |
| lastTriggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) |
| nextEvalInterval | integer($int64) title: Alarm evaluation interval (milliseconds) |
| tags | example: {key1:value1} |
| gmtCreate | string($date-time) title: Record the latest creation time (timestamp in milliseconds) |
| gmtUpdate | string($date-time) |
| | |
|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| alarmId | integer($int64) title: Alarm record entity primary key index ID 告警记录实体主键索引ID |
| target | string title: Alert target object: monitor availability-available metrics-app.metrics.field 告警目标对象: 监控可用性-available 指标-app.metrics.field |
| thresholdId | integer($int64) title: Alarm definition ID associated with the alarm 告警关联的告警定义ID |
| priority | string($byte) title: Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow 告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色 |
| content | string title: The actual content of the alarm notification 告警通知实际内容 |
| status | string($byte) title: Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed 告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理 |
| times | integer($int32) title: Alarm threshold trigger times 告警阈值触发次数 |
| triggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) 首次告警触发时间(毫秒时间戳) |
| tags | example: {key1:value1} |



Expand Down
57 changes: 57 additions & 0 deletions home/docs/others/media.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
id: media
title: Media Friend
sidebar_label: Media Friend
---

## 我们推荐的公众号

<table class="gzh-table" style={{"textAlign": "center"}}>
<tr>
<td>
<img src="https://mp.weixin.qq.com/mp/qrcode?scene=10000004&size=102&__biz=MzUzNTY2NjAzMg==&mid=2247488735&idx=1&sn=fa8b735187099d28d8509827d200cc8b&send_time="/>
<br/>
<b>Dromara</b>
<br/>
<span>Dromara开源社区,好玩有趣的百宝箱开源社区!</span>
</td>
<td>
<img src="https://mp.weixin.qq.com/mp/qrcode?scene=10000004&size=102&__biz=Mzg5NDc0ODM2NA==&mid=2247483698&idx=2&sn=21c78699659e043816d116bd637ec51f&send_time="/>
<br/>
<b>TanCloud</b>
<br/>
<span>探云-开源的高性能全托管监控云服务!</span>
</td>
</tr>
</table>

<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

> 感谢以上媒体公众号对 HertzBeat 项目的推荐,如果您也是媒体运营者,欢迎互相推荐。
### 相互推荐哇,支持开源项目

#### HertzBeat作为一个新兴项目,迫切需要一定的途径进行项目推广。如果您也是媒体公众号运营者,欢迎您将HertzBeat推荐给您的粉丝:

1. 推荐文案参考: [MarkDown源内容](https://gitee.com/dromara/hertzbeat/raw/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/introduce.md) [网页文章](https://hertzbeat.com/zh-cn/docs/) [图片资源](https://gitee.com/dromara/hertzbeat/tree/master/home/static/img/home)
2. 在文章底部或内容中留下项目GitHub仓库链接
3. 文章需要是 `1000+` 的阅读量

#### 作为回报,HertzBeat将:

1. 在官网文档 [推荐媒体] 处永久留下您的媒体公众号二维码和介绍
2. 在官方交流群里@全体成员推荐您的公众号一次
3. 您媒体公众号的新推文章都可以将分享到HertzBeat交流群中增加阅读量(为避免频繁推送连接,请不要超过一周三次)

欢迎您有意愿加微信`tan-cloud`和我们联系,非常期待您的推荐,感谢对开源的支持。
4 changes: 2 additions & 2 deletions home/docs/others/private.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ sidebar_label: Enterprise

:::tip
**Open source does not mean completely free. If you [modify HertzBeat's logo, name, copyright](https://github.com/dromara/hertzbeat/blob/master/NOTICE), etc., please ask us for authorization, otherwise there will be [legal risks](legal).**
**Open source is based on mutual trust, please don't let developers chill.**
**Open source is based on mutual trust, please don't let developers chill. We will pursue all illegal gains of individuals and teams who undermine open source and profit from it.**
:::

HertzBeat monitoring products are divided into open source community version and enterprise version. The enterprise version **provides more enterprise-level features such as user management and log auditing**. The maintenance team quickly responds to enterprise needs.

## HertzBeat Licensed Version (paid)
## HertzBeat Licensed Version (Paid)

We provide the community open source version of the monitoring product HertzBeat, which can be used by individuals and businesses for free, **Requires complete reservation of copyright, Logo, trademark, footer copyright statement, and attribution statement**.
In some cases, enterprises need to modify the copyright LOGO and attribution statement based on the open source version for secondary development. We have launched **HertzBeat Authorized Version** for such needs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,36 @@ keywords: [告警 Webhook 回调通知, 开源告警系统, 开源监控告警
内容格式:JSON
```json
{
"id":76456,
"target":"available",
"alertDefineId":232,
"priority":0,
"content":"监控紧急可用性告警: UN_CONNECTABLE",
"tag": {
"monitorId": 3543534545,
"monitorName":"API_poetry.didi.top"
},
"status":0,
"times":1,
"gmtCreate":"2022-02-25T13:32:13",
"gmtUpdate":"2022-02-25T13:32:13"
"alarmId": 76456,
"target": "${target}",
"thresholdId": 33455,
"priority": 0,
"content": "udp_port monitoring availability alert, code is FAIL",
"status": 0,
"times": 1,
"triggerTime": "2022-02-25T13:32:13",
"tags": {
"app": "windows",
"monitorId": "180427708350720",
"metrics": "availability",
"code": "UN_CONNECTABLE",
"thresholdId": "112",
"monitorName": "WINDOWS_192.168.124.12"
}
}
```

| | |
|-----|-----|
| id | integer($int64) title: Alarm record entity primary key index ID 告警记录实体主键索引ID |
| target | string title: Alert target object: monitor availability-available metrics-app.metrics.field 告警目标对象: 监控可用性-available 指标-app.metrics.field |
| alertDefineId integer($int64) title: Alarm definition ID associated with the alarm 告警关联的告警定义ID |
| priority | string($byte) title: Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow 告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色 |
| content | string title: The actual content of the alarm notification 告警通知实际内容 |
| status | string($byte) title: Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed 告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理 |
| times | integer($int32) title: Alarm threshold trigger times 告警阈值触发次数 |
| firstTriggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) 首次告警触发时间(毫秒时间戳) |
| lastTriggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) 最近告警触发时间(毫秒时间戳) |
| nextEvalInterval | integer($int64) title: Alarm evaluation interval (milliseconds) 告警评估时间间隔(单位毫秒) |
| tags | example: {key1:value1} |
| gmtCreate | string($date-time) title: Record the latest creation time (timestamp in milliseconds) 记录最新创建时间(毫秒时间戳) |
| gmtUpdate |string($date-time) title: 记录最新修改时间(毫秒时间戳) |
| | |
|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| alarmId | integer($int64) title: Alarm record entity primary key index ID 告警记录实体主键索引ID |
| target | string title: Alert target object: monitor availability-available metrics-app.metrics.field 告警目标对象: 监控可用性-available 指标-app.metrics.field |
| thresholdId | integer($int64) title: Alarm definition ID associated with the alarm 告警关联的告警定义ID |
| priority | string($byte) title: Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow 告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色 |
| content | string title: The actual content of the alarm notification 告警通知实际内容 |
| status | string($byte) title: Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed 告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理 |
| times | integer($int32) title: Alarm threshold trigger times 告警阈值触发次数 |
| triggerTime | integer($int64) title: Alarm trigger time (timestamp in milliseconds) 首次告警触发时间(毫秒时间戳) |
| tags | example: {key1:value1} |

### webhook通知常见问题

Expand Down
Loading

0 comments on commit a90aada

Please sign in to comment.