Ensure that we fail if there are no upstreams

This commit is contained in:
Łukasz Mierzwa
2017-06-28 19:36:38 -07:00
parent 721b4f8be4
commit 0e9d9cee39

View File

@@ -57,6 +57,7 @@ func setupUpstreams() {
z := strings.SplitN(s, ":", 2)
if len(z) != 2 {
log.Fatalf("Invalid Alertmanager URI '%s', expected format 'name:uri'", s)
continue
}
name := z[0]
uri := z[1]
@@ -75,6 +76,10 @@ func main() {
setupUpstreams()
if len(alertmanager.GetAlertmanagers()) == 0 {
log.Fatal("No valid Alertmanager URIs defined")
}
// before we start try to fetch data from Alertmanager
log.Infof("Initial Alertmanager query, this can delay startup up to %s", 3*config.Config.AlertmanagerTimeout)
pullFromAlertmanager()