Disallow multiple Alertmanager instances with the same URI

Unique uri is required for silence form result tracking
This commit is contained in:
Łukasz Mierzwa
2017-06-30 19:49:47 -07:00
parent 5e020b9e01
commit 360dece7ad

View File

@@ -21,6 +21,12 @@ func NewAlertmanager(name, uri string, timeout time.Duration) error {
return fmt.Errorf("Alertmanager upstream '%s' already exist", name)
}
for _, am := range upstreams {
if am.URI == uri {
return fmt.Errorf("Alertmanager upstream '%s' already collects from '%s'", am.Name, am.URI)
}
}
// initialize metrics
metricAlertmanagerErrors.With(prometheus.Labels{
"alertmanager": name,