telegraf

package module
v0.0.0-...-5864974 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: MIT Imports: 1 Imported by: 0

README

Telegraf Circle CI Docker pulls

Telegraf is an agent for collecting, processing, aggregating, and writing metrics.

Design goals are to have a minimal memory footprint with a plugin system so that developers in the community can easily add support for collecting metrics.

Telegraf is plugin-driven and has the concept of 4 distinct plugin types:

  1. Input Plugins collect metrics from the system, services, or 3rd party APIs
  2. Processor Plugins transform, decorate, and/or filter metrics
  3. Aggregator Plugins create aggregate metrics (e.g. mean, min, max, quantiles, etc.)
  4. Output Plugins write metrics to various destinations

New plugins are designed to be easy to contribute, we'll eagerly accept pull requests and will manage the set of plugins that Telegraf supports.

Contributing

There are many ways to contribute:

Installation:

You can download the binaries directly from the downloads page or from the releases section.

Ansible Role:

Ansible role: https://github.com/rossmcdonald/telegraf

From Source:

Telegraf requires golang version 1.9 or newer, the Makefile requires GNU make.

  1. Install Go >=1.9 (1.10 recommended)
  2. Install dep ==v0.5.0
  3. Download Telegraf source:
    go get -d github.com/influxdata/telegraf
    
  4. Run make from the source directory
    cd "$HOME/go/src/github.com/influxdata/telegraf"
    make
    
Nightly Builds

These builds are generated from the master branch:

How to use it:

See usage with:

telegraf --help
Generate a telegraf config file:
telegraf config > telegraf.conf
Generate config with only cpu input & influxdb output plugins defined:
telegraf --input-filter cpu --output-filter influxdb config
Run a single telegraf collection, outputing metrics to stdout:
telegraf --config telegraf.conf --test
Run telegraf with all plugins defined in config file:
telegraf --config telegraf.conf
Run telegraf, enabling the cpu & memory input, and influxdb output plugins:
telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb

Documentation

Latest Release Documentation.

For documentation on the latest development code see the documentation index.

Input Plugins

Parsers

Serializers

Processor Plugins

Aggregator Plugins

Output Plugins

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accumulator

type Accumulator interface {
	// AddFields adds a metric to the accumulator with the given measurement
	// name, fields, and tags (and timestamp). If a timestamp is not provided,
	// then the accumulator sets it to "now".
	// Create a point with a value, decorating it with tags
	// NOTE: tags is expected to be owned by the caller, don't mutate
	// it after passing to Add.
	AddFields(measurement string,
		fields map[string]interface{},
		tags map[string]string,
		t ...time.Time)

	// AddGauge is the same as AddFields, but will add the metric as a "Gauge" type
	AddGauge(measurement string,
		fields map[string]interface{},
		tags map[string]string,
		t ...time.Time)

	// AddCounter is the same as AddFields, but will add the metric as a "Counter" type
	AddCounter(measurement string,
		fields map[string]interface{},
		tags map[string]string,
		t ...time.Time)

	// AddSummary is the same as AddFields, but will add the metric as a "Summary" type
	AddSummary(measurement string,
		fields map[string]interface{},
		tags map[string]string,
		t ...time.Time)

	// AddHistogram is the same as AddFields, but will add the metric as a "Histogram" type
	AddHistogram(measurement string,
		fields map[string]interface{},
		tags map[string]string,
		t ...time.Time)

	SetPrecision(precision, interval time.Duration)

	AddError(err error)
}

Accumulator is an interface for "accumulating" metrics from plugin(s). The metrics are sent down a channel shared between all plugins.

type AggregatingOutput

type AggregatingOutput interface {
	// Connect to the Output
	Connect() error
	// Close any connections to the Output
	Close() error
	// Description returns a one-sentence description on the Output
	Description() string
	// SampleConfig returns the default configuration of the Output
	SampleConfig() string
	// Write takes in group of points to be written to the Output
	Write(metrics []Metric) error

	// Add the metric to the aggregator
	Add(in Metric)
	// Push returns the aggregated metrics and is called every flush interval.
	Push() []Metric
	// Reset signals the the aggregator period is completed.
	Reset()
}

AggregatingOutput adds aggregating functionality to an Output. May be used if the Output only accepts a fixed set of aggregations over a time period. These functions may be called concurrently to the Write function.

type Aggregator

type Aggregator interface {
	// SampleConfig returns the default configuration of the Input.
	SampleConfig() string

	// Description returns a one-sentence description on the Input.
	Description() string

	// Add the metric to the aggregator.
	Add(in Metric)

	// Push pushes the current aggregates to the accumulator.
	Push(acc Accumulator)

	// Reset resets the aggregators caches and aggregates.
	Reset()
}

Aggregator is an interface for implementing an Aggregator plugin. the RunningAggregator wraps this interface and guarantees that Add, Push, and Reset can not be called concurrently, so locking is not required when implementing an Aggregator plugin.

type Field

type Field struct {
	Key   string
	Value interface{}
}

type Input

type Input interface {
	// SampleConfig returns the default configuration of the Input
	SampleConfig() string

	// Description returns a one-sentence description on the Input
	Description() string

	// Gather takes in an accumulator and adds the metrics that the Input
	// gathers. This is called every "interval"
	Gather(Accumulator) error
}

type Metric

type Metric interface {
	// Getting data structure functions
	Name() string
	Tags() map[string]string
	TagList() []*Tag
	Fields() map[string]interface{}
	FieldList() []*Field
	Time() time.Time
	Type() ValueType

	// Name functions
	SetName(name string)
	AddPrefix(prefix string)
	AddSuffix(suffix string)

	// Tag functions
	GetTag(key string) (string, bool)
	HasTag(key string) bool
	AddTag(key, value string)
	RemoveTag(key string)

	// Field functions
	GetField(key string) (interface{}, bool)
	HasField(key string) bool
	AddField(key string, value interface{})
	RemoveField(key string)

	SetTime(t time.Time)

	// HashID returns an unique identifier for the series.
	HashID() uint64

	// Copy returns a deep copy of the Metric.
	Copy() Metric

	// Mark Metric as an aggregate
	SetAggregate(bool)
	IsAggregate() bool
}

type Output

type Output interface {
	// Connect to the Output
	Connect() error
	// Close any connections to the Output
	Close() error
	// Description returns a one-sentence description on the Output
	Description() string
	// SampleConfig returns the default configuration of the Output
	SampleConfig() string
	// Write takes in group of points to be written to the Output
	Write(metrics []Metric) error
}

type Processor

type Processor interface {
	// SampleConfig returns the default configuration of the Input
	SampleConfig() string

	// Description returns a one-sentence description on the Input
	Description() string

	// Apply the filter to the given metric
	Apply(in ...Metric) []Metric
}

type ServiceInput

type ServiceInput interface {
	// SampleConfig returns the default configuration of the Input
	SampleConfig() string

	// Description returns a one-sentence description on the Input
	Description() string

	// Gather takes in an accumulator and adds the metrics that the Input
	// gathers. This is called every "interval"
	Gather(Accumulator) error

	// Start starts the ServiceInput's service, whatever that may be
	Start(Accumulator) error

	// Stop stops the services and closes any necessary channels and connections
	Stop()
}

type ServiceOutput

type ServiceOutput interface {
	// Connect to the Output
	Connect() error
	// Close any connections to the Output
	Close() error
	// Description returns a one-sentence description on the Output
	Description() string
	// SampleConfig returns the default configuration of the Output
	SampleConfig() string
	// Write takes in group of points to be written to the Output
	Write(metrics []Metric) error

	// Start the "service" that will provide an Output
	Start() error
	// Stop the "service" that will provide an Output
	Stop()
}

type Tag

type Tag struct {
	Key   string
	Value string
}

type ValueType

type ValueType int

ValueType is an enumeration of metric types that represent a simple value.

const (
	Counter ValueType
	Gauge
	Untyped
	Summary
	Histogram
)

Possible values for the ValueType enum.

Directories

Path Synopsis
cmd
tls
plugins
inputs/docker
Helper functions copied from https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
Helper functions copied from https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go
inputs/jti_openconfig_telemetry/auth
Package authentication is a generated protocol buffer package.
Package authentication is a generated protocol buffer package.
inputs/jti_openconfig_telemetry/oc
Package telemetry is a generated protocol buffer package.
Package telemetry is a generated protocol buffer package.
inputs/lustre2
Lustre 2.x telegraf plugin
Lustre 2.x telegraf plugin
inputs/minecraft/internal/rcon
Package rcon implements the communication protocol for communicating with RCON servers.
Package rcon implements the communication protocol for communicating with RCON servers.
inputs/phpfpm
Package fcgi implements the FastCGI protocol.
Package fcgi implements the FastCGI protocol.
inputs/x509_cert
Package x509_cert reports metrics from an SSL certificate.
Package x509_cert reports metrics from an SSL certificate.
inputs/zipkin/cmd/thrift_serialize
A small cli utility meant to convert json to zipkin thrift binary format, and vice versa.
A small cli utility meant to convert json to zipkin thrift binary format, and vice versa.
outputs/application_insights/mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
selfstat is a package for tracking and collecting internal statistics about telegraf.
selfstat is a package for tracking and collecting internal statistics about telegraf.

Jump to

Keyboard shortcuts

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