mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user