diff --git a/pkg/compute/models/scaling_trigger.go b/pkg/compute/models/scaling_trigger.go index 96594cb51f..07334cff01 100644 --- a/pkg/compute/models/scaling_trigger.go +++ b/pkg/compute/models/scaling_trigger.go @@ -324,11 +324,14 @@ var indicatorMap = map[string]sTableField{ api.INDICATOR_FLOW_OUT: {"vm_netio", "bps_sent"}, } +var alertConfigUsedBy = "scaling_group" + func (sa *SScalingAlarm) generateAlertConfig(sp *SScalingPolicy) (*monitor.AlertConfig, error) { config, err := monitor.NewAlertConfig(fmt.Sprintf("sp-%s", sp.Id), fmt.Sprintf("%ds", sa.Cycle), true) if err != nil { return nil, err } + config.UsedBy = alertConfigUsedBy cond := config.Condition("telegraf", indicatorMap[sa.Indicator].Table).Avg() log.Debugf("alarm: %#v", sa) diff --git a/pkg/mcclient/modules/monitor/helper.go b/pkg/mcclient/modules/monitor/helper.go index 6c9250ed5a..ed9944437d 100644 --- a/pkg/mcclient/modules/monitor/helper.go +++ b/pkg/mcclient/modules/monitor/helper.go @@ -32,6 +32,7 @@ type AlertConfig struct { conditions []*AlertCondition execErrorState string noDataState string + UsedBy string } func NewAlertConfig(name string, frequency string, enabled bool) (*AlertConfig, error) {