socket_writer

package
v1.30.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 16 Imported by: 7

README

Socket Writer Output Plugin

The socket writer plugin can write to a UDP, TCP, or unix socket.

It can output data in any of the supported output formats.

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Configuration

# Generic socket writer capable of handling multiple socket types.
[[outputs.socket_writer]]
  ## URL to connect to
  # address = "tcp://127.0.0.1:8094"
  # address = "tcp://example.com:http"
  # address = "tcp4://127.0.0.1:8094"
  # address = "tcp6://127.0.0.1:8094"
  # address = "tcp6://[2001:db8::1]:8094"
  # address = "udp://127.0.0.1:8094"
  # address = "udp4://127.0.0.1:8094"
  # address = "udp6://127.0.0.1:8094"
  # address = "unix:///tmp/telegraf.sock"
  # address = "unixgram:///tmp/telegraf.sock"
  # address = "vsock://cid:port"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## Period between keep alive probes.
  ## Only applies to TCP sockets.
  ## 0 disables keep alive probes.
  ## Defaults to the OS configuration.
  # keep_alive_period = "5m"

  ## Content encoding for message payloads, can be set to "gzip" or to
  ## "identity" to apply no encoding.
  ##
  # content_encoding = "identity"

  ## Data format to generate.
  ## 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 SocketWriter

type SocketWriter struct {
	ContentEncoding string `toml:"content_encoding"`
	Address         string
	KeepAlivePeriod *config.Duration
	tlsint.ClientConfig
	Log telegraf.Logger `toml:"-"`

	serializers.Serializer

	net.Conn
	// contains filtered or unexported fields
}

func (*SocketWriter) Close

func (sw *SocketWriter) Close() error

Close closes the connection. Noop if already closed.

func (*SocketWriter) Connect

func (sw *SocketWriter) Connect() error

func (*SocketWriter) SampleConfig

func (*SocketWriter) SampleConfig() string

func (*SocketWriter) SetSerializer

func (sw *SocketWriter) SetSerializer(s serializers.Serializer)

func (*SocketWriter) Write

func (sw *SocketWriter) Write(metrics []telegraf.Metric) error

Write writes the given metrics to the destination. If an error is encountered, it is up to the caller to retry the same write again later. Not parallel safe.

Jump to

Keyboard shortcuts

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