mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(monitor): 告警历史问题修复
1.https://bug.yunion.io/zentao/bug-view-7933.html
This commit is contained in:
@@ -1346,6 +1346,11 @@ jointLoop:
|
||||
continue jointLoop
|
||||
}
|
||||
}
|
||||
// 排除近期有报警状态的情况:system.uptime
|
||||
if joint.AlertState == monitor.MONITOR_RESOURCE_ALERT_STATUS_ALERTING && time.Now().Sub(joint.TriggerTime).
|
||||
Minutes() < 30 {
|
||||
continue
|
||||
}
|
||||
deleteJointIds = append(deleteJointIds, joint.RowId)
|
||||
}
|
||||
if len(resourceIds) == 0 {
|
||||
|
||||
@@ -299,7 +299,7 @@ func (self *SMonitorResource) RealDelete(ctx context.Context, userCred mcclient.
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return self.SVirtualResourceBase.Delete(ctx, userCred)
|
||||
return self.SVirtualResourceBase.Delete(ctx, nil)
|
||||
}
|
||||
|
||||
func (self *SMonitorResource) DetachJoint(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
@@ -433,6 +433,13 @@ func (self *SMonitorResource) UpdateAttachJoint(alertRecord *SAlertRecord, match
|
||||
return errors.Wrapf(err, "SMonitorResource:%s UpdateAttachJoint err", self.Name)
|
||||
}
|
||||
errs := make([]error, 0)
|
||||
// 报警时发现没有进行关联,增加attach
|
||||
if len(joints) == 0 {
|
||||
self.AttachAlert(context.Background(), nil, alertRecord.AlertId)
|
||||
joints, _ = MonitorResourceAlertManager.GetJoinsByListInput(monitor.
|
||||
MonitorResourceJointListInput{MonitorResourceId: self.
|
||||
ResId, AlertId: alertRecord.AlertId})
|
||||
}
|
||||
for _, joint := range joints {
|
||||
err := joint.UpdateAlertRecordData(alertRecord, &match)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user