Skip to content

Commit

Permalink
Disable monitoring during fleetserver bootstrap process (elastic#27222)
Browse files Browse the repository at this point in the history
* Disable monitoring during fleetserver bootstrap process

Set the monitoring.enabled flag to false during the fleet-server
bootstrap process in order to ensure that no data is sent to an
elasticsearch instance running on the same host.

* Add CHANGELOG entry
  • Loading branch information
michel-laterman committed Aug 17, 2021
1 parent 8229f6a commit c04b530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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 @@ -78,6 +78,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)
if err != nil {
return nil, errors.New(err, "failed to initialize monitoring")
Expand Down

0 comments on commit c04b530

Please sign in to comment.