1
0
Fork 0
mirror of https://github.com/TwiN/gatus.git synced 2024-12-14 11:58:04 +00:00

Set default alert threshold to 3

This commit is contained in:
TwinProduction 2020-08-22 14:15:08 -04:00
parent 62f7bdbd63
commit 9a3c9e4d61

View file

@ -42,6 +42,11 @@ func (service *Service) Validate() {
if len(service.Headers) == 0 {
service.Headers = make(map[string]string)
}
for _, alert := range service.Alerts {
if alert.Threshold <= 0 {
alert.Threshold = 3
}
}
if len(service.Url) == 0 {
panic(ErrNoUrl)
}
@ -73,6 +78,7 @@ func (service *Service) EvaluateConditions() *Result {
result.Timestamp = time.Now()
if result.Success {
service.numberOfFailuresInARow = 0
// TODO: Send notification that alert has been resolved?
} else {
service.numberOfFailuresInARow++
}