mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-23 07:09:52 +01:00
Set default alert threshold to 3
This commit is contained in:
parent
62f7bdbd63
commit
9a3c9e4d61
@ -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++
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user