From 9c6d0b8252f122fa5fe74de732d40484e65e164a Mon Sep 17 00:00:00 2001 From: zhaoxiangchun <1422928955@qq.com> Date: Wed, 30 Jun 2021 09:46:44 +0800 Subject: [PATCH] fix(monitor): fix monitor process alert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复进程监控报警后,没有触发前端报警提示的问题 --- pkg/monitor/alerting/conditions/query.go | 4 +++- pkg/monitor/alerting/rule.go | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/monitor/alerting/conditions/query.go b/pkg/monitor/alerting/conditions/query.go index 7a7c2257e9..0c63883ca0 100644 --- a/pkg/monitor/alerting/conditions/query.go +++ b/pkg/monitor/alerting/conditions/query.go @@ -532,7 +532,9 @@ func (c *QueryCondition) setResType() { } } } - c.ResType = resType + if c.Query.Model.Database == monitor.METRIC_DATABASE_TELE { + c.ResType = resType + } } func (c *QueryCondition) GetQueryResources() ([]jsonutils.JSONObject, error) { diff --git a/pkg/monitor/alerting/rule.go b/pkg/monitor/alerting/rule.go index cf017ffa5c..3859a47865 100644 --- a/pkg/monitor/alerting/rule.go +++ b/pkg/monitor/alerting/rule.go @@ -190,6 +190,11 @@ func newRuleDescription(rule *Rule, alertDetails *monitor.CommonAlertMetricDetai ConditionType: alertDetails.ConditionType, }, } + if len(ruleDes.ResType) == 0 { + if alertDetails.DB == monitor.METRIC_DATABASE_TELE { + ruleDes.ResType = monitor.METRIC_RES_TYPE_HOST + } + } rule.RuleDescription = append(rule.RuleDescription, &ruleDes) }