websocket

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: 0

README

Websocket Output Plugin

This plugin can write to a WebSocket endpoint.

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

Configuration:
# A plugin that can transmit metrics over WebSocket.
[[outputs.websocket]]
  ## URL is the address to send metrics to. Make sure ws or wss scheme is used.
  url = "ws://127.0.0.1:3000/telegraf"

  ## Timeouts (make sure read_timeout is larger than server ping interval or set to zero).
  # connect_timeout = "30s"
  # write_timeout = "30s"
  # read_timeout = "30s"

  ## Optionally turn on using text data frames (binary by default).
  # use_text_frames = false

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

  ## Data format to output.
  ## Each data format has it's 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"

  ## Additional HTTP Upgrade headers
  # [outputs.websocket.headers]
  #   Authorization = "Bearer <TOKEN>"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebSocket

type WebSocket struct {
	URL            string            `toml:"url"`
	ConnectTimeout config.Duration   `toml:"connect_timeout"`
	WriteTimeout   config.Duration   `toml:"write_timeout"`
	ReadTimeout    config.Duration   `toml:"read_timeout"`
	Headers        map[string]string `toml:"headers"`
	UseTextFrames  bool              `toml:"use_text_frames"`
	Log            telegraf.Logger   `toml:"-"`
	proxy.HTTPProxy
	tls.ClientConfig
	// contains filtered or unexported fields
}

WebSocket can output to WebSocket endpoint.

func (*WebSocket) Close

func (w *WebSocket) Close() error

Close closes the connection. Noop if already closed.

func (*WebSocket) Connect

func (w *WebSocket) Connect() error

Connect to the output endpoint.

func (*WebSocket) Description

func (w *WebSocket) Description() string

Description of plugin.

func (*WebSocket) Init

func (w *WebSocket) Init() error

Init the output plugin.

func (*WebSocket) SampleConfig

func (w *WebSocket) SampleConfig() string

SampleConfig returns plugin config sample.

func (*WebSocket) SetSerializer

func (w *WebSocket) SetSerializer(serializer serializers.Serializer)

SetSerializer implements serializers.SerializerOutput.

func (*WebSocket) Write

func (w *WebSocket) Write(metrics []telegraf.Metric) error

Write writes the given metrics to the destination. Not thread-safe.

Jump to

Keyboard shortcuts

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