Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/controller/onecloud_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ func (c monitorComponent) getInitInfo() map[string]onecloud.CommonAlertTem {
Name: "system.uptime",
Reduce: "last",
ConditionType: "nodata_query",
From: "3m",
From: "10m",
Interval: "1m",
Description: "监测节点启动时间",
Level: "important",
Expand Down
10 changes: 10 additions & 0 deletions pkg/util/onecloud/onecloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,9 @@ func containDiffsWithRtnAlert(input monitorapi.CommonAlertUpdateInput, rtnAlert
if details[i].Comparator != inputQuery[i].Comparator {
return conDiff, nil
}
if condi.Query.From != inputQuery[i].From {
return conDiff, nil
}
oldSel := jsonutils.Marshal(&condi.Query.Model.Selects)
newSel := jsonutils.Marshal(&inputQuery[i].Model.Selects)
if !oldSel.Equals(newSel) {
Expand Down Expand Up @@ -948,6 +951,13 @@ func newCommonalertQuery(tem CommonAlertTem) monitorapi.CommonAlertQuery {
alertQ := new(monitorapi.AlertQuery)
alertQ.Model = metricQ
alertQ.From = "60m"
if tem.ConditionType == monitorapi.METRIC_QUERY_TYPE_NO_DATA {
from := tem.From
if from == "" {
from = "10m"
}
alertQ.From = from
}

commonAlert := monitorapi.CommonAlertQuery{
AlertQuery: alertQ,
Expand Down
Loading