Skip to content

Commit

Permalink
update available alert threshold trigger times default 2 (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 authored Nov 8, 2023
1 parent 88dab8b commit 8afd9f8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ private void startCalculate() {
if (metricsData != null) {
calculate(metricsData);
}
} catch (InterruptedException ignored) {

} catch (Exception e) {
log.error(e.getMessage());
log.error("calculate alarm error: {}.", e.getMessage(), e);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.dromara.hertzbeat.common.queue.CommonDataQueue;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -33,17 +34,21 @@ public class AlarmCommonReduce {
public void reduceAndSendAlarm(Alert alert) {
alert.setTimes(1);
Map<String, String> tags = alert.getTags();
if (tags == null) {
tags = new HashMap<>(8);
alert.setTags(tags);
}
String monitorIdStr = tags.get(CommonConstants.TAG_MONITOR_ID);
if (monitorIdStr == null) {
log.debug("receiver extern alarm message: {}", alert);
} else {
long monitorId = Long.parseLong(monitorIdStr);
List<Tag> tagList = alertMonitorDao.findMonitorIdBindTags(monitorId);
tagList.forEach(tag -> {
if (!tags.containsKey(tag.getName())) {
tags.put(tag.getName(), tag.getValue());
}
});
for (Tag tag : tagList) {
if (!tags.containsKey(tag.getName())) {
tags.put(tag.getName(), tag.getValue());
}
}
}
// converge -> silence
if (alarmConvergeReduce.filterConverge(alert) && alarmSilenceReduce.filterSilence(alert)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void run(String... args) throws Exception {
.app(app)
.metric(CommonConstants.AVAILABILITY)
.preset(true)
.times(1)
.times(2)
.enable(true)
.recoverNotice(false)
.priority(CommonConstants.ALERT_PRIORITY_CODE_EMERGENCY)
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"alert.setting.template.instance-value": "Instance Value",
"alert.setting.default": "Global Default",
"alert.setting.default.tip": "Whether this alarm threshold configuration applies to all this type of monitoring globally",
"alert.setting.enable": "Enable Alert",
"alert.setting.enable": "Enable Threshold",
"alert.setting.enable.tip": "This alarm threshold configuration is enabled or disabled",
"alert.setting.recover-notice": "Recover Notice",
"alert.setting.recover-notice.tip": "Whether to send the corresponding recovered notification when the alarm is resolved under this threshold rule",
Expand Down
4 changes: 2 additions & 2 deletions web-app/src/assets/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@
"alert.setting.template.metric-value": "指标值",
"alert.setting.template.other-value": "所属行其它指标值",
"alert.setting.template.instance-value": "所属行实例值",
"alert.setting.default": "全局默认",
"alert.setting.default": "应用全局",
"alert.setting.default.tip": "此告警阈值配置是否应用于全局所有此类型监控",
"alert.setting.enable": "启用告警",
"alert.setting.enable": "启用阈值",
"alert.setting.enable.tip": "此告警阈值配置开启生效或关闭",
"alert.setting.recover-notice": "恢复通知",
"alert.setting.recover-notice.tip": "是否在此阈值规则下告警恢复时发送对应的恢复通知",
Expand Down
4 changes: 2 additions & 2 deletions web-app/src/assets/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@
"alert.setting.template.metric-value": "指標值",
"alert.setting.template.other-value": "所屬行其它指標值",
"alert.setting.template.instance-value": "所屬行實例值",
"alert.setting.default": "全局默認",
"alert.setting.default": "應用全域",
"alert.setting.default.tip": "此告警阈值配置是否應用于全局所有此類型監控",
"alert.setting.enable": "啓用告警",
"alert.setting.enable": "啓用閾值",
"alert.setting.enable.tip": "此告警阈值配置開啓生效或關閉",
"alert.setting.recover-notice": "恢復通知",
"alert.setting.recover-notice.tip": "是否在此閾值規則下告警恢復時發送對應的恢復通知",
Expand Down

0 comments on commit 8afd9f8

Please sign in to comment.