From c157b78a04e14bc77e541733c5af90cb3a3ded4c Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Wed, 11 Nov 2015 17:05:22 +0100 Subject: [PATCH] Do not expose groups with 0 alerts --- dispatch.go | 3 +++ main.go | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dispatch.go b/dispatch.go index 8c8ebe6a..41ca9409 100644 --- a/dispatch.go +++ b/dispatch.go @@ -126,6 +126,9 @@ func (d *Dispatcher) Groups() AlertOverview { Silenced: sid, }) } + if len(apiAlerts) == 0 { + continue + } alertGroup.Blocks = append(alertGroup.Blocks, &AlertBlock{ RouteOpts: &route.RouteOpts, diff --git a/main.go b/main.go index 6ba0aee2..726a97ba 100644 --- a/main.go +++ b/main.go @@ -38,9 +38,12 @@ import ( ) var ( - configFile = flag.String("config.file", "config.yml", "The configuration file") - dataDir = flag.String("data.dir", "data/", "The data directory") - showVersion = flag.Bool("version", false, "Print version information.") + showVersion = flag.Bool("version", false, "Print version information.") + + configFile = flag.String("config.file", "config.yml", "The configuration file") + dataDir = flag.String("data.dir", "data/", "The data directory") + + externalURL = flag.String("web.external-url", "", "The URL under which Prometheus is externally reachable (for example, if Prometheus is served via a reverse proxy). Used for generating relative and absolute links back to Prometheus itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived automatically.") listenAddress = flag.String("web.listen-address", ":9093", "Address to listen on for the web interface and API.") )