mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 06:22:13 +08:00
Alerting: Use the forked Alertmanager for remote secondary mode (#79646)
* (WIP) Alerting: Use the forked Alertmanager for remote secondary mode * fall back to using internal AM in case of error * remove TODOs, clean up .ini file, add orgId as part of remote AM config struct * log warnings and errors, fall back to remoteSecondary, fall back to internal AM only * extract logic to decide remote Alertmanager mode to a separate function, switch on mode * tests * make linter happy * remove func to decide remote Alertmanager mode * refactor factory function and options * add default case to switch statement * remove ineffectual assignment
This commit is contained in:
@ -104,10 +104,11 @@ type UnifiedAlertingSettings struct {
|
||||
// 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
|
||||
Enable bool
|
||||
URL string
|
||||
TenantID string
|
||||
Password string
|
||||
SyncInterval time.Duration
|
||||
}
|
||||
|
||||
type UnifiedAlertingScreenshotSettings struct {
|
||||
@ -352,6 +353,11 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
|
||||
TenantID: remoteAlertmanager.Key("tenant").MustString(""),
|
||||
Password: remoteAlertmanager.Key("password").MustString(""),
|
||||
}
|
||||
uaCfgRemoteAM.SyncInterval, err = gtime.ParseDuration(valueAsString(remoteAlertmanager, "sync_interval", (schedulerDefaultAdminConfigPollInterval).String()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
uaCfg.RemoteAlertmanager = uaCfgRemoteAM
|
||||
|
||||
screenshots := iniFile.Section("unified_alerting.screenshots")
|
||||
|
Reference in New Issue
Block a user