Merge pull request #12047 from zhaoxiangchun/automated-cherry-pick-of-#9750-upstream-release-3.7

Automated cherry pick of #9750: feat(region): be compatible with changes in monitor api in scaling group
This commit is contained in:
Zexi Li
2021-08-27 16:58:08 +08:00
committed by GitHub
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -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)
+1
View File
@@ -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) {