Add default values for AlertEvery
There is also a test error corrected in TestMonitorFailureAlertEvery where the same test conditions were repeated twice.
This commit is contained in:
@@ -15,6 +15,7 @@ var errInvalidConfig = errors.New("Invalid configuration")
|
||||
type Config struct {
|
||||
CheckInterval SecondsOrDuration `yaml:"check_interval"`
|
||||
DefaultAlertAfter int16 `yaml:"default_alert_after"`
|
||||
DefaultAlertEvery *int16 `yaml:"default_alert_every"`
|
||||
DefaultAlertDown []string `yaml:"default_alert_down"`
|
||||
DefaultAlertUp []string `yaml:"default_alert_up"`
|
||||
Monitors []*Monitor
|
||||
@@ -143,6 +144,10 @@ func (config *Config) Init() (err error) {
|
||||
monitor.AlertAfter = config.DefaultAlertAfter
|
||||
}
|
||||
|
||||
if monitor.AlertEvery == nil && config.DefaultAlertEvery != nil {
|
||||
monitor.AlertEvery = config.DefaultAlertEvery
|
||||
}
|
||||
|
||||
if len(monitor.AlertDown) == 0 && len(config.DefaultAlertDown) > 0 {
|
||||
monitor.AlertDown = config.DefaultAlertDown
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user