diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index e4fabc2ac52..a418dc2d18c 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -77,6 +77,7 @@ - Remove symlink.prev from previously failed upgrade {pull}26785[26785] - Fix apm-server supported outputs not being in sync with supported output types. {pull}26885[26885] - Set permissions during installation {pull}26665[26665] +- Disable monitoring during fleet-server bootstrapping. {pull}27222[27222] ==== New features diff --git a/x-pack/elastic-agent/pkg/agent/application/fleet_server_bootstrap.go b/x-pack/elastic-agent/pkg/agent/application/fleet_server_bootstrap.go index 60be85147cf..df4d93c3c43 100644 --- a/x-pack/elastic-agent/pkg/agent/application/fleet_server_bootstrap.go +++ b/x-pack/elastic-agent/pkg/agent/application/fleet_server_bootstrap.go @@ -24,6 +24,7 @@ import ( "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/config" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/monitoring" + monitoringCfg "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/monitoring/config" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/server" "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/status" reporting "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter" @@ -85,6 +86,11 @@ func newFleetServerBootstrap( reporter := reporting.NewReporter(bootstrapApp.bgContext, log, bootstrapApp.agentInfo, logR) + if cfg.Settings.MonitoringConfig != nil { + cfg.Settings.MonitoringConfig.Enabled = false + } else { + cfg.Settings.MonitoringConfig = &monitoringCfg.MonitoringConfig{Enabled: false} + } monitor, err := monitoring.NewMonitor(cfg.Settings) if err != nil { return nil, errors.New(err, "failed to initialize monitoring")