Add custom type to parse out seconds as int and durations as strings
This commit is contained in:
+4
-4
@@ -11,9 +11,9 @@ import (
|
||||
// Monitor represents a particular periodic check of a command
|
||||
type Monitor struct { //nolint:maligned
|
||||
// Config values
|
||||
AlertAfter int16 `yaml:"alert_after"`
|
||||
AlertEvery int16 `yaml:"alert_every"`
|
||||
CheckInterval time.Duration `yaml:"check_interval"`
|
||||
AlertAfter int16 `yaml:"alert_after"`
|
||||
AlertEvery int16 `yaml:"alert_every"`
|
||||
CheckInterval SecondsOrDuration `yaml:"check_interval"`
|
||||
Name string
|
||||
AlertDown []string `yaml:"alert_down"`
|
||||
AlertUp []string `yaml:"alert_up"`
|
||||
@@ -45,7 +45,7 @@ func (monitor Monitor) ShouldCheck() bool {
|
||||
|
||||
sinceLastCheck := time.Since(monitor.lastCheck)
|
||||
|
||||
return sinceLastCheck >= monitor.CheckInterval
|
||||
return sinceLastCheck >= monitor.CheckInterval.Value()
|
||||
}
|
||||
|
||||
// Check will run the command configured by the Monitor and return a status
|
||||
|
||||
Reference in New Issue
Block a user