value

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 8 Imported by: 16

README

Value Parser Plugin

The "value" data format translates single values into Telegraf metrics. This is done by assigning a measurement name and setting a single field ("value") as the parsed metric.

Configuration

[[inputs.exec]]
  ## Commands array
  commands = ["cat /proc/sys/kernel/random/entropy_avail"]

  ## override the default metric name of "exec"
  name_override = "entropy_available"

  ## override the field name of "value"
  # value_field_name = "value"

  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ##   https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
  data_format = "value"
  data_type = "integer" # required

You must tell Telegraf what type of metric to collect by using the data_type configuration option. Available options are:

  1. integer
  2. float or long
  3. string
  4. boolean

Note: It is also recommended that you set name_override to a measurement name that makes sense for your metric, otherwise it will just be set to the name of the plugin.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser added in v1.24.0

type Parser struct {
	DataType    string            `toml:"data_type"`
	FieldName   string            `toml:"value_field_name"`
	MetricName  string            `toml:"-"`
	DefaultTags map[string]string `toml:"-"`
}

func (*Parser) Init added in v1.24.0

func (v *Parser) Init() error

func (*Parser) InitFromConfig added in v1.24.0

func (v *Parser) InitFromConfig(config *parsers.Config) error

InitFromConfig is a compatibility function to construct the parser the old way

func (*Parser) Parse added in v1.24.0

func (v *Parser) Parse(buf []byte) ([]telegraf.Metric, error)

func (*Parser) ParseLine added in v1.24.0

func (v *Parser) ParseLine(line string) (telegraf.Metric, error)

func (*Parser) SetDefaultTags added in v1.24.0

func (v *Parser) SetDefaultTags(tags map[string]string)

Jump to

Keyboard shortcuts

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