Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable monitoring during fleetserver bootstrap process #27222

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to replace the monitor with the noop monitor, but the agent was not able to bootstap correctly.

if err != nil {
return nil, errors.New(err, "failed to initialize monitoring")
Expand Down