beater

package
v6.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package beater provides the implementation of the libbeat Beater interface for Metricbeat and functions for running Metricbeat Modules on their own.

Metricbeat collects metrics from operating systems and services. The code for gathering metrics from a particular service is organized into a logical grouping called a Module. Each Module has one or more MetricSet implementations which do the work of collecting a particular set of metrics from the service.

The public interfaces used in implementing Modules and MetricSets are defined in the github.com/elastic/beats/metricbeat/mb package.

Event Format

Each event generated by Metricbeat has the same general structure. The example event below was generated by a MetricSet named "cpu" in the "system" Module.

{
	"@timestamp": "2016-05-23T08:05:34.853Z",
	"beat": {
		"hostname": "host.example.com",
		"name": "host.example.com"
	},
	"metricset": {
		"host": "localhost",
		"module": "system",
		"name": "cpu",
		"rtt": 115
	},
	"system": {
		"cpu": {
			"idle": {
				"pct": 0.852,
				"ticks": 44421033
			},
			"iowait": {
				"pct": 0,
				"ticks": 159735
			},
			"irq": {
				"pct": 0,
				"ticks": 0
			},
			"nice": {
				"pct": 0,
				"ticks": 0
			},
			"softirq": {
				"pct": 0,
				"ticks": 14070
			},
			"steal": {
				"pct": 0,
				"ticks": 0
			},
			"system": {
				"pct": 0.0408,
				"ticks": 305704
			},
			"user": {
				"pct": 0.1071,
				"ticks": 841974
			}
		}
	},
	"type": "metricsets"
}

All events are stored in one index called metricbeat by default. Each MetricSet's data format is potentially unique so the MetricSet data is added to event as a dictionary under a key that is unique to the MetricSet. The key is constructed from the Module name and MetricSet name to ensure uniqueness. All documents are stored under the same type called "metricsets".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error)

New creates and returns a new Metricbeat instance.

Types

type AutodiscoverAdapter

type AutodiscoverAdapter struct {
	// contains filtered or unexported fields
}

AutodiscoverAdapter for Metricbeat modules

func NewAutodiscoverAdapter

func NewAutodiscoverAdapter(factory cfgfile.RunnerFactory) *AutodiscoverAdapter

NewAutodiscoverAdapter builds and returns an autodiscover adapter for Metricbeat modules

func (*AutodiscoverAdapter) CheckConfig

func (m *AutodiscoverAdapter) CheckConfig(c *common.Config) error

CheckConfig tests given config to check if it will work or not, returns errors in case it won't work

func (*AutodiscoverAdapter) Create

Create a module or prospector from the given config

func (*AutodiscoverAdapter) CreateConfig

func (m *AutodiscoverAdapter) CreateConfig(e bus.Event) ([]*common.Config, error)

CreateConfig generates a valid list of configs from the given event, the received event will have all keys defined by `StartFilter`

func (*AutodiscoverAdapter) StartFilter

func (m *AutodiscoverAdapter) StartFilter() []string

StartFilter returns the bus filter to retrieve runner start triggering events

func (*AutodiscoverAdapter) StopFilter

func (m *AutodiscoverAdapter) StopFilter() []string

StopFilter returns the bus filter to retrieve runner stop triggering events

type Config

type Config struct {
	// Modules is a list of module specific configuration data.
	Modules       []*common.Config     `config:"modules"`
	ConfigModules *common.Config       `config:"config.modules"`
	MaxStartDelay time.Duration        `config:"max_start_delay"` // Upper bound on the random startup delay for metricsets (use 0 to disable startup delay).
	Autodiscover  *autodiscover.Config `config:"autodiscover"`
}

Config is the root of the Metricbeat configuration hierarchy.

type Metricbeat

type Metricbeat struct {
	// contains filtered or unexported fields
}

Metricbeat implements the Beater interface for metricbeat.

func (*Metricbeat) Modules

func (bt *Metricbeat) Modules() ([]*module.Wrapper, error)

Modules return a list of all configured modules, including anyone present under dynamic config settings

func (*Metricbeat) Run

func (bt *Metricbeat) Run(b *beat.Beat) error

Run starts the workers for Metricbeat and blocks until Stop is called and the workers complete. Each host associated with a MetricSet is given its own goroutine for fetching data. The ensures that each host is isolated so that a single unresponsive host cannot inadvertently block other hosts within the same Module and MetricSet from collection.

func (*Metricbeat) Stop

func (bt *Metricbeat) Stop()

Stop signals to Metricbeat that it should stop. It closes the "done" channel and closes the publisher client associated with each Module.

Stop should only be called a single time. Calling it more than once may result in undefined behavior.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL