Reduce noisy no-alertmanager warning

This commit is contained in:
Fabian Reinartz 2015-12-15 12:11:38 +01:00
parent 52e5224f5a
commit 62075aa037
3 changed files with 5 additions and 3 deletions

View File

@ -155,7 +155,6 @@ func Main() int {
prometheus.MustRegister(configSuccess)
prometheus.MustRegister(configSuccessTime)
// go ruleManager.Run()
defer ruleManager.Stop()
go notificationHandler.Run()

View File

@ -159,6 +159,11 @@ func (n *Handler) nextBatch() []*model.Alert {
// Run dispatches notifications continuously.
func (n *Handler) Run() {
// Just warn one in the beginning to prevent nosiy logs.
if n.opts.AlertmanagerURL == "" {
log.Warnf("No AlertManager configured, not dispatching any alerts")
}
for {
select {
case <-n.ctx.Done():
@ -172,7 +177,6 @@ func (n *Handler) Run() {
continue
}
if n.opts.AlertmanagerURL == "" {
log.Warn("No AlertManager configured, not dispatching %d alerts", len(alerts))
n.dropped.Add(float64(len(alerts)))
continue
}

View File

@ -15,7 +15,6 @@ package rules
import (
"fmt"
// "reflect"
"strings"
"testing"
"time"