diff --git a/alerter/src/main/java/org/dromara/hertzbeat/alert/calculate/CalculateAlarm.java b/alerter/src/main/java/org/dromara/hertzbeat/alert/calculate/CalculateAlarm.java index 0b88515689e..9d5328b5dd7 100644 --- a/alerter/src/main/java/org/dromara/hertzbeat/alert/calculate/CalculateAlarm.java +++ b/alerter/src/main/java/org/dromara/hertzbeat/alert/calculate/CalculateAlarm.java @@ -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); } } }; diff --git a/alerter/src/main/java/org/dromara/hertzbeat/alert/reduce/AlarmCommonReduce.java b/alerter/src/main/java/org/dromara/hertzbeat/alert/reduce/AlarmCommonReduce.java index 66c058d0049..6b5c3c100b4 100644 --- a/alerter/src/main/java/org/dromara/hertzbeat/alert/reduce/AlarmCommonReduce.java +++ b/alerter/src/main/java/org/dromara/hertzbeat/alert/reduce/AlarmCommonReduce.java @@ -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; @@ -33,17 +34,21 @@ public class AlarmCommonReduce { public void reduceAndSendAlarm(Alert alert) { alert.setTimes(1); Map 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 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)) { diff --git a/manager/src/main/java/org/dromara/hertzbeat/manager/service/AvailableAlertDefineInit.java b/manager/src/main/java/org/dromara/hertzbeat/manager/service/AvailableAlertDefineInit.java index 8ee0a1aaeff..7aec2c977de 100644 --- a/manager/src/main/java/org/dromara/hertzbeat/manager/service/AvailableAlertDefineInit.java +++ b/manager/src/main/java/org/dromara/hertzbeat/manager/service/AvailableAlertDefineInit.java @@ -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) diff --git a/web-app/src/assets/i18n/en-US.json b/web-app/src/assets/i18n/en-US.json index 3787bdcfafc..58b11655f13 100644 --- a/web-app/src/assets/i18n/en-US.json +++ b/web-app/src/assets/i18n/en-US.json @@ -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", diff --git a/web-app/src/assets/i18n/zh-CN.json b/web-app/src/assets/i18n/zh-CN.json index 339bed568e2..fc8f9a83d5c 100644 --- a/web-app/src/assets/i18n/zh-CN.json +++ b/web-app/src/assets/i18n/zh-CN.json @@ -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": "是否在此阈值规则下告警恢复时发送对应的恢复通知", diff --git a/web-app/src/assets/i18n/zh-TW.json b/web-app/src/assets/i18n/zh-TW.json index 9d484fb77a3..e993aa1883e 100644 --- a/web-app/src/assets/i18n/zh-TW.json +++ b/web-app/src/assets/i18n/zh-TW.json @@ -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": "是否在此閾值規則下告警恢復時發送對應的恢復通知",