Skip to content

Commit

Permalink
Chane fleetmode detection to ony use management.enabled
Browse files Browse the repository at this point in the history
Fleetmode detection has been changed ton only use the enabled flag as
fleet is now the only management mode available.
  • Loading branch information
michel-laterman committed Jun 7, 2021
1 parent 447bac9 commit b333c14
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions libbeat/common/fleetmode/fleet_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ import (

// Enabled checks to see if filebeat/metricbeat is running under Agent
// The management setting is stored in the main Beat runtime object, but we can't see that from a module
// So instead we check the CLI flags, since Agent starts filebeat/metricbeat with "-E", "management.mode=x-pack-fleet", "-E", "management.enabled=true"
// So instead we check the CLI flags, since Agent starts filebeat/metricbeat with "-E", "management.enabled=true"
func Enabled() bool {
type management struct {
Mode string `config:"management.mode"`
Enabled bool `config:"management.enabled"`
Enabled bool `config:"management.enabled"`
}
var managementSettings management

Expand All @@ -46,8 +45,5 @@ func Enabled() bool {
return false
}

if managementSettings.Enabled == true && managementSettings.Mode == "x-pack-fleet" {
return true
}
return false
return managementSettings.Enabled
}

0 comments on commit b333c14

Please sign in to comment.