Alerting: Send merged configuration to the remote alertmanager (#107004)

This commit is contained in:
Alexander Akhmetov
2025-07-02 21:35:24 +02:00
committed by GitHub
parent d57155a19b
commit b483a04aec
9 changed files with 621 additions and 27 deletions
+14
View File
@@ -477,6 +477,17 @@ func CreateGrafDir(t *testing.T, opts GrafanaOpts) (string, string) {
_, err = grafanaComSection.NewKey("api_url", opts.GrafanaComAPIURL)
require.NoError(t, err)
}
if opts.RemoteAlertmanagerURL != "" {
remoteAlertmanagerSection, err := getOrCreateSection("remote.alertmanager")
require.NoError(t, err)
_, err = remoteAlertmanagerSection.NewKey("enabled", "true")
require.NoError(t, err)
_, err = remoteAlertmanagerSection.NewKey("url", opts.RemoteAlertmanagerURL)
require.NoError(t, err)
_, err = remoteAlertmanagerSection.NewKey("tenant", "1")
require.NoError(t, err)
}
if opts.GrafanaComSSOAPIToken != "" {
grafanaComSection, err := getOrCreateSection("grafana_com")
require.NoError(t, err)
@@ -571,6 +582,9 @@ type GrafanaOpts struct {
// When "unified-grpc" is selected it will also start the grpc server
APIServerStorageType options.StorageType
// Remote alertmanager configuration
RemoteAlertmanagerURL string
}
func CreateUser(t *testing.T, store db.DB, cfg *setting.Cfg, cmd user.CreateUserCommand) *user.User {