Alerting: Add configuration options to migrate to an external Alertmanager (#71318)

* add configuration options to .ini file and parse them

* updates on config options, add external AM config to the main config struct

* separate external AM configs from general alerting configs, naming

* comments about usage of tenantID in basic auth & not using config options yet
This commit is contained in:
Santiago
2023-09-05 11:24:35 -03:00
committed by GitHub
parent 2e67a9463d
commit 7a34cdb3a2
2 changed files with 38 additions and 0 deletions
+19
View File
@@ -95,10 +95,20 @@ type UnifiedAlertingSettings struct {
Screenshots UnifiedAlertingScreenshotSettings
ReservedLabels UnifiedAlertingReservedLabelSettings
StateHistory UnifiedAlertingStateHistorySettings
RemoteAlertmanager RemoteAlertmanagerSettings
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.
MaxStateSaveConcurrency int
}
// RemoteAlertmanagerSettings contains the configuration needed
// to disable the internal Alertmanager and use an external one instead.
type RemoteAlertmanagerSettings struct {
Enable bool
URL string
TenantID string
Password string
}
type UnifiedAlertingScreenshotSettings struct {
Capture bool
CaptureTimeout time.Duration
@@ -337,6 +347,15 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
uaCfg.DefaultRuleEvaluationInterval = uaMinInterval
}
remoteAlertmanager := iniFile.Section("remote.alertmanager")
uaCfgRemoteAM := RemoteAlertmanagerSettings{
Enable: remoteAlertmanager.Key("enabled").MustBool(false),
URL: remoteAlertmanager.Key("url").MustString(""),
TenantID: remoteAlertmanager.Key("tenant").MustString(""),
Password: remoteAlertmanager.Key("password").MustString(""),
}
uaCfg.RemoteAlertmanager = uaCfgRemoteAM
screenshots := iniFile.Section("unified_alerting.screenshots")
uaCfgScreenshots := uaCfg.Screenshots