Make default log alert conditional

Allow using the default `log` alert for both up and down alerts using
Go's templating conditionals. Following this example can do away with
the need for an up and down version of every alert.
This commit is contained in:
Ian Fijolek
2020-06-19 09:51:42 -07:00
parent ad6f3be6ec
commit cffbbd734a
3 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ func NewLogAlert() *Alert {
Command: CommandOrShell{
Command: []string{
"echo",
"{{.MonitorName}} check has failed {{.FailureCount}} times",
"{{.MonitorName}} {{if .IsUp}}has recovered{{else}}check has failed {{.FailureCount}} times{{end}}",
},
},
}