Skip to content

Commit f435ec9

Browse files
committed
runner: add special notificator for monitoring ssl expiry
1 parent 8fd218c commit f435ec9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

runner/runner.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,18 @@ func healthCheck(n string, s tob.Service, t *time.Ticker, waiter tob.Waiter) {
228228
respStr := string(resp)
229229

230230
// SSL Monitoring
231-
for _, notificator := range s.GetNotificators() {
232-
if !util.IsNilish(notificator) {
233-
if notificator.IsEnabled() && notificator.Provider() == "webhook" && s.Name() == string(tob.SSLStatus) {
234-
notificatorMessage := fmt.Sprintf("%s | |", n)
235-
if s.GetMessage() != "" {
236-
notificatorMessage = fmt.Sprintf("%s is MONITORED | %s", n, s.GetMessage())
237-
}
238-
err := notificator.Send(notificatorMessage)
239-
if err != nil {
240-
tob.Logger.Printf("notificator %s error: %s", notificator.Provider(), err.Error())
231+
if s.Name() == string(tob.SSLStatus) {
232+
for _, notificator := range s.GetNotificators() {
233+
if !util.IsNilish(notificator) {
234+
if notificator.IsEnabled() && notificator.Provider() == "webhook" {
235+
notificatorMessage := fmt.Sprintf("%s is DOWN", n)
236+
if s.GetMessage() != "" {
237+
notificatorMessage = fmt.Sprintf("%s is MONITORED | %s", n, s.GetMessage())
238+
}
239+
err := notificator.Send(notificatorMessage)
240+
if err != nil {
241+
tob.Logger.Printf("notificator %s error: %s", notificator.Provider(), err.Error())
242+
}
241243
}
242244
}
243245
}

0 commit comments

Comments
 (0)