Do not expose groups with 0 alerts

This commit is contained in:
Fabian Reinartz 2015-11-11 17:05:22 +01:00
parent 75c57ffd00
commit c157b78a04
2 changed files with 9 additions and 3 deletions

View File

@ -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,

View File

@ -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.")
)