mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
main: remove Alertmanager legacy flag configuration
This commit is contained in:
parent
d17b5be48a
commit
1becee3f6c
|
@ -116,10 +116,6 @@ func init() {
|
|||
)
|
||||
|
||||
// Alertmanager.
|
||||
cfg.fs.Var(
|
||||
&cfg.alertmanagerURLs, "alertmanager.url",
|
||||
"Comma-separated list of Alertmanager URLs to send notifications to.",
|
||||
)
|
||||
cfg.fs.IntVar(
|
||||
&cfg.notifier.QueueCapacity, "alertmanager.notification-queue-capacity", 10000,
|
||||
"The capacity of the queue for pending alert manager notifications.",
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
_ "net/http/pprof" // Comment this line to disable pprof endpoint.
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
@ -27,7 +26,6 @@ import (
|
|||
"github.com/fabxc/tsdb"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/common/version"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
|
@ -242,31 +240,6 @@ func reloadConfig(filename string, rls ...Reloadable) (err error) {
|
|||
return fmt.Errorf("couldn't load configuration (-config.file=%s): %v", filename, err)
|
||||
}
|
||||
|
||||
// Add AlertmanagerConfigs for legacy Alertmanager URL flags.
|
||||
for us := range cfg.alertmanagerURLs {
|
||||
u, err := url.Parse(us)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
acfg := &config.AlertmanagerConfig{
|
||||
Scheme: u.Scheme,
|
||||
PathPrefix: u.Path,
|
||||
Timeout: cfg.notifierTimeout,
|
||||
ServiceDiscoveryConfig: config.ServiceDiscoveryConfig{
|
||||
StaticConfigs: []*config.TargetGroup{
|
||||
{
|
||||
Targets: []model.LabelSet{
|
||||
{
|
||||
model.AddressLabel: model.LabelValue(u.Host),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
conf.AlertingConfig.AlertmanagerConfigs = append(conf.AlertingConfig.AlertmanagerConfigs, acfg)
|
||||
}
|
||||
|
||||
failed := false
|
||||
for _, rl := range rls {
|
||||
if err := rl.ApplyConfig(conf); err != nil {
|
||||
|
|
Loading…
Reference in a new issue