exec

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 12 Imported by: 1

README

Exec Output Plugin

This plugin sends telegraf metrics to an external application over stdin.

The command should be defined similar to docker's exec form:

["executable", "param1", "param2"]

On non-zero exit stderr will be logged at error level.

For better performance, consider execd, which runs continuously.

Configuration
[[outputs.exec]]
  ## Command to ingest metrics via stdin.
  command = ["tee", "-a", "/dev/null"]

  ## Timeout for command to complete.
  # timeout = "5s"

  ## Data format to output.
  ## 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_OUTPUT.md
  # data_format = "influx"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

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

CommandRunner runs a command with the ability to kill the process before the timeout.

func (*CommandRunner) Run

func (c *CommandRunner) Run(timeout time.Duration, command []string, buffer io.Reader) error

Run runs the command.

type Exec

type Exec struct {
	Command []string        `toml:"command"`
	Timeout config.Duration `toml:"timeout"`
	// contains filtered or unexported fields
}

Exec defines the exec output plugin.

func (*Exec) Close

func (e *Exec) Close() error

Close satisfies the Output interface.

func (*Exec) Connect

func (e *Exec) Connect() error

Connect satisfies the Output interface.

func (*Exec) Description

func (e *Exec) Description() string

Description describes the plugin.

func (*Exec) Init added in v1.18.1

func (e *Exec) Init() error

func (*Exec) SampleConfig

func (e *Exec) SampleConfig() string

SampleConfig returns a sample configuration.

func (*Exec) SetSerializer

func (e *Exec) SetSerializer(serializer serializers.Serializer)

SetSerializer sets the serializer for the output.

func (*Exec) Write

func (e *Exec) Write(metrics []telegraf.Metric) error

Write writes the metrics to the configured command.

type Runner

type Runner interface {
	Run(time.Duration, []string, io.Reader) error
}

Runner provides an interface for running exec.Cmd.

Jump to

Keyboard shortcuts

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