This commit is contained in:
parent
a7d1b8ab74
commit
65342fe0dd
13
alert.go
13
alert.go
@ -112,3 +112,16 @@ func (alert Alert) Send(notice AlertNotice) (outputStr string, err error) {
|
|||||||
|
|
||||||
return outputStr, err
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -117,6 +117,11 @@ func LoadConfig(filePath string) (config Config, err error) {
|
|||||||
log.Printf("DEBUG: Config values:\n%v\n", config)
|
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() {
|
if !config.IsValid() {
|
||||||
err = errors.New("Invalid configuration")
|
err = errors.New("Invalid configuration")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user