add event_enabled field to recovery_notification_config
This commit is contained in:
parent
3f5beb7c9f
commit
1ce2639903
|
@ -83,11 +83,12 @@ type NotificationConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RecoveryNotificationConfig struct {
|
type RecoveryNotificationConfig struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"` // channel enabled
|
||||||
Title string `json:"title"` //text template
|
Title string `json:"title"` //text template
|
||||||
Message string `json:"message"` // text template
|
Message string `json:"message"` // text template
|
||||||
AcceptTimeRange TimeRange `json:"accept_time_range,omitempty"`
|
AcceptTimeRange TimeRange `json:"accept_time_range,omitempty"`
|
||||||
Normal []Channel `json:"normal,omitempty"`
|
Normal []Channel `json:"normal,omitempty"`
|
||||||
|
EventEnabled bool `json:"event_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageTemplate struct{
|
type MessageTemplate struct{
|
||||||
|
|
|
@ -676,9 +676,10 @@ func (engine *Engine) Do(rule *alerting.Rule) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("save alert message error: %w", err)
|
return fmt.Errorf("save alert message error: %w", err)
|
||||||
}
|
}
|
||||||
|
// todo add recover notification to inner system message
|
||||||
// send recover message to channel
|
// send recover message to channel
|
||||||
recoverCfg := rule.RecoveryNotificationConfig
|
recoverCfg := rule.RecoveryNotificationConfig
|
||||||
if recoverCfg != nil && recoverCfg.Enabled {
|
if recoverCfg != nil && recoverCfg.EventEnabled && recoverCfg.Enabled {
|
||||||
paramsCtx = newParameterCtx(rule, checkResults, util.MapStr{
|
paramsCtx = newParameterCtx(rule, checkResults, util.MapStr{
|
||||||
alerting2.ParamEventID: alertItem.ID,
|
alerting2.ParamEventID: alertItem.ID,
|
||||||
alerting2.ParamTimestamp: alertItem.Created.Unix(),
|
alerting2.ParamTimestamp: alertItem.Created.Unix(),
|
||||||
|
|
Loading…
Reference in New Issue