Skip to content

Commit

Permalink
Central management for hb (#9254)
Browse files Browse the repository at this point in the history
Add central management to heartbeat.
  • Loading branch information
andrewvc authored Dec 4, 2018
1 parent 30dfa05 commit 79a6ff3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ https://github.com/elastic/beats/compare/v6.4.0...v6.5.0[View commits]
- Added support for extra TLS/x509 metadata. {pull}7944[7944]
- Added stats and state metrics for number of monitors and endpoints started. {pull}8621[8621]
- Add last monitor status to dashboard table. Further break out monitors in dashboard table by monitor.ip. {pull}9022[9022]
- Add central management support. {pull}9254[9254]
*Journalbeat*
Expand Down
12 changes: 12 additions & 0 deletions heartbeat/beater/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import (
"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/cfgfile"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/reload"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/management"
)

// Heartbeat represents the root datastructure of this beat.
Expand Down Expand Up @@ -82,6 +84,10 @@ func (bt *Heartbeat) Run(b *beat.Beat) error {
return err
}

if b.ConfigManager.Enabled() {
bt.RunCentralMgmtMonitors(b)
}

if bt.config.ConfigMonitors.Enabled() {
bt.monitorReloader = cfgfile.NewReloader(b.Publisher, bt.config.ConfigMonitors)
defer bt.monitorReloader.Stop()
Expand Down Expand Up @@ -127,6 +133,12 @@ func (bt *Heartbeat) RunStaticMonitors(b *beat.Beat) error {
return nil
}

// RunCentralMgmtMonitors loads any central management configured configs.
func (bt *Heartbeat) RunCentralMgmtMonitors(b *beat.Beat) {
monitors := cfgfile.NewRunnerList(management.DebugK, bt.dynamicFactory, b.Publisher)
reload.Register.MustRegisterList(b.Info.Beat+".monitors", monitors)
}

// RunReloadableMonitors runs the `heartbeat.config.monitors` portion of the yaml config if present.
func (bt *Heartbeat) RunReloadableMonitors(b *beat.Beat) (err error) {
// Check monitor configs
Expand Down
2 changes: 2 additions & 0 deletions libbeat/docs/shared-central-management.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ environment. The `development` tag might have:
another that reads metrics from Apache HTTP servers
* Two Filebeat module configuration blocks: one that reads Apache HTTP server
logs and another that reads system logs
* One heartbeat monitor configuration block: checks that a public facing website
is live.
* One Elasticsearch output configuration block that sends the output to your
{es} development cluster

Expand Down

0 comments on commit 79a6ff3

Please sign in to comment.