docs-v2/content/telegraf/v1/output-plugins/websocket/_index.md

91 lines
3.0 KiB
Markdown

---
description: "Telegraf plugin for sending metrics to Websocket"
menu:
telegraf_v1_ref:
parent: output_plugins_reference
name: Websocket
identifier: output-websocket
tags: [Websocket, "output-plugins", "configuration", "applications", "web"]
introduced: "v1.19.0"
os_support: "freebsd, linux, macos, solaris, windows"
related:
- /telegraf/v1/configure_plugins/
- https://github.com/influxdata/telegraf/tree/v1.36.1/plugins/outputs/websocket/README.md, Websocket Plugin Source
---
# Websocket Output Plugin
This plugin writes metrics to a WebSocket endpoint in one of the supported
[data formats](/telegraf/v1/data_formats/output).
**Introduced in:** Telegraf v1.19.0
**Tags:** applications, web
**OS support:** all
[data_formats]: /docs/DATA_FORMATS_OUTPUT.md
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
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](/telegraf/v1/configuration/#plugins) for more details.
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
## Secret-store support
This plugin supports secrets from secret-stores for the `headers` option.
See the [secret-store documentation](/telegraf/v1/configuration/#secret-store-secrets) for more details on how
to use them.
[SECRETSTORE]: ../../../docs/CONFIGURATION.md#secret-store-secrets
## Configuration
```toml @sample.conf
# 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
## Optional SOCKS5 proxy to use
# socks5_enabled = true
# socks5_address = "127.0.0.1:1080"
# socks5_username = "alice"
# socks5_password = "pass123"
## Optional HTTP proxy to use
# use_system_proxy = false
# http_proxy_url = "http://localhost:8888"
## 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"
## NOTE: Due to the way TOML is parsed, tables must be at the END of the
## plugin definition, otherwise additional config options are read as part of
## the table
## Additional HTTP Upgrade headers
# [outputs.websocket.headers]
# Authorization = "Bearer <TOKEN>"
```