diff --git a/alert.go b/alert.go index 85b85ce..3ea08e3 100644 --- a/alert.go +++ b/alert.go @@ -112,3 +112,16 @@ func (alert Alert) Send(notice AlertNotice) (outputStr string, err error) { return outputStr, err } + +// NewLogAlert creates an alert that does basic logging using echo +func NewLogAlert() *Alert { + return &Alert{ + Name: "log", + Command: CommandOrShell{ + Command: []string{ + "echo", + "{{.MonitorName}} check has failed {{.FailureCount}} times", + }, + }, + } +} diff --git a/config.go b/config.go index fd237a4..f441925 100644 --- a/config.go +++ b/config.go @@ -117,6 +117,11 @@ func LoadConfig(filePath string) (config Config, err error) { log.Printf("DEBUG: Config values:\n%v\n", config) } + if _, ok := config.Alerts["log"]; !ok { + log.Printf("Adding log alert") + config.Alerts["log"] = NewLogAlert() + } + if !config.IsValid() { err = errors.New("Invalid configuration") return