beater

package
v5.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: Apache-2.0 Imports: 9 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 Config

type Config struct {
	// Modules is a list of module specific configuration data.
	Modules       []*common.Config `config:"modules"`
	ReloadModules *common.Config   `config:"config.modules"`
}

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) 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