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

Do not load dashboards where not available #15802

Merged
merged 4 commits into from
Jan 27, 2020
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 CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix panic in the Logstash output when trying to send events to closed connection. {pull}15568[15568]
- Fix missing output in dockerlogbeat {pull}15719[15719]
- Fix logging target settings being ignored when Beats are started via systemd or docker. {issue}12024[12024] {pull}15422[15442]
- Do not load dashboards where not available. {pull}15802[15802]

*Auditbeat*

Expand Down
7 changes: 6 additions & 1 deletion auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func init() {
),
)
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
RootCmd = cmd.GenRootCmdWithSettings(create, instance.Settings{RunFlags: runFlags, Name: Name})
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
}
RootCmd = cmd.GenRootCmdWithSettings(create, settings)
RootCmd.AddCommand(ShowCmd)
}
7 changes: 6 additions & 1 deletion filebeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ func init() {
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
runFlags.AddGoFlag(flag.CommandLine.Lookup("once"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("modules"))
RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{RunFlags: runFlags, Name: Name})
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
}
RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings)
RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("M"))
RootCmd.TestCmd.Flags().AddGoFlag(flag.CommandLine.Lookup("modules"))
RootCmd.SetupCmd.Flags().AddGoFlag(flag.CommandLine.Lookup("modules"))
Expand Down
5 changes: 3 additions & 2 deletions heartbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ var RootCmd *cmd.BeatsRootCmd

func init() {
settings := instance.Settings{
Name: Name,
Processing: processing.MakeDefaultSupport(true, processing.WithECS, processing.WithBeatMeta("agent")),
Name: Name,
Processing: processing.MakeDefaultSupport(true, processing.WithECS, processing.WithBeatMeta("agent")),
HasDashboards: false,
}
RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings)

Expand Down
2 changes: 1 addition & 1 deletion journalbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ import (
var Name = "journalbeat"

// RootCmd to handle beats cli
var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name})
var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name, HasDashboards: false})
2 changes: 1 addition & 1 deletion libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (b *Beat) Setup(settings Settings, bt beat.Creator, setup SetupSettings) er
fmt.Println("Index setup finished.")
}

if setup.Dashboard {
if setup.Dashboard && settings.HasDashboards {
fmt.Println("Loading dashboards (Kibana must be running and reachable)")
err = b.loadDashboards(context.Background(), true)

Expand Down
1 change: 1 addition & 0 deletions libbeat/cmd/instance/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Settings struct {
Name string
IndexPrefix string
Version string
HasDashboards bool
Monitoring report.Settings
RunFlags *pflag.FlagSet
ConfigOverrides []cfgfile.ConditionalOverride
Expand Down
2 changes: 1 addition & 1 deletion libbeat/mock/mockbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
var Version = "9.9.9"
var Name = "mockbeat"

var Settings = instance.Settings{Name: Name, Version: Version}
var Settings = instance.Settings{Name: Name, Version: Version, HasDashboards: true}

Choose a reason for hiding this comment

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

exported var Settings should have comment or be unexported

Choose a reason for hiding this comment

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

exported var Settings should have comment or be unexported


type Mockbeat struct {
done chan struct{}
Expand Down
1 change: 0 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (
// BeatsWithDashboards is a list of Beats to collect dashboards from.
BeatsWithDashboards = []string{
"heartbeat",
"journalbeat",
"packetbeat",
"winlogbeat",
"x-pack/auditbeat",
Expand Down
7 changes: 6 additions & 1 deletion metricbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ var RootCmd *cmd.BeatsRootCmd
func init() {
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
runFlags.AddGoFlag(flag.CommandLine.Lookup("system.hostfs"))
RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), instance.Settings{RunFlags: runFlags, Name: Name})
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
}
RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), settings)
RootCmd.AddCommand(cmd.GenModulesCmd(Name, "", BuildModulesManager))
RootCmd.TestCmd.AddCommand(test.GenTestModulesCmd(Name, "", beater.DefaultTestModulesCreator()))
}
7 changes: 6 additions & 1 deletion packetbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func init() {
runFlags.AddGoFlag(flag.CommandLine.Lookup("l"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("dump"))

RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{RunFlags: runFlags, Name: Name})
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
}
RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings)
RootCmd.AddCommand(genDevicesCommand())
}
2 changes: 1 addition & 1 deletion winlogbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ import (
var Name = "winlogbeat"

// RootCmd to handle beats cli
var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name})
var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name, HasDashboards: true})
1 change: 1 addition & 0 deletions x-pack/functionbeat/manager/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var RootCmd *cmd.BeatsRootCmd
func init() {
RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{
Name: Name,
HasDashboards: false,
ConfigOverrides: config.Overrides,
})

Expand Down
7 changes: 6 additions & 1 deletion x-pack/metricbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ var RootCmd *cmd.BeatsRootCmd
func init() {
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
runFlags.AddGoFlag(flag.CommandLine.Lookup("system.hostfs"))
RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), instance.Settings{RunFlags: runFlags, Name: Name})
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
}
RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), settings)
RootCmd.AddCommand(cmd.GenModulesCmd(Name, "", mbcmd.BuildModulesManager))
RootCmd.TestCmd.AddCommand(test.GenTestModulesCmd(Name, "", beater.DefaultTestModulesCreator()))
xpackcmd.AddXPack(RootCmd, Name)
Expand Down