influxdb_v2

package
v1.37.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 30 Imported by: 11

README

InfluxDB v2.x Output Plugin

This plugin writes metrics to a InfluxDB v2.x instance via HTTP.

⭐ Telegraf v1.8.0 🏷️ datastore 💻 all

Global configuration options

Plugins support additional global and plugin configuration settings for tasks such as modifying metrics, tags, and fields, creating aliases, and configuring plugin ordering. See CONFIGURATION.md for more details.

Secret-store support

This plugin supports secrets from secret-stores for the token and http_headers option. See the secret-store documentation for more details on how to use them.

Configuration

# Configuration for sending metrics to InfluxDB 2.0
[[outputs.influxdb_v2]]
  ## The URLs of the InfluxDB cluster nodes.
  ##
  ## Multiple URLs can be specified for a single cluster, only ONE of the
  ## urls will be written to each interval.
  ##   ex: urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
  urls = ["http://127.0.0.1:8086"]

  ## Local address to bind when connecting to the server
  ## If empty or not set, the local address is automatically chosen.
  # local_address = ""

  ## Token for authentication.
  token = ""

  ## Organization is the name of the organization you wish to write to.
  organization = ""

  ## Destination bucket to write into.
  bucket = ""

  ## The value of this tag will be used to determine the bucket.  If this
  ## tag is not set the 'bucket' option is used as the default.
  # bucket_tag = ""

  ## If true, the bucket tag will not be added to the metric.
  # exclude_bucket_tag = false

  ## Timeout for HTTP messages.
  # timeout = "5s"

  ## Additional HTTP headers
  # http_headers = {"X-Special-Header" = "Special-Value"}

  ## HTTP Proxy override, if unset values the standard proxy environment
  ## variables are consulted to determine which proxy, if any, should be used.
  # http_proxy = "http://corporate.proxy:3128"

  ## HTTP User-Agent
  # user_agent = "telegraf"

  ## Content-Encoding for write request body, can be set to "gzip" to
  ## compress body or "identity" to apply no encoding.
  # content_encoding = "gzip"

  ## Enable or disable uint support for writing uints influxdb 2.0.
  # influx_uint_support = false

  ## When true, Telegraf will omit the timestamp on data to allow InfluxDB
  ## to set the timestamp of the data during ingestion. This is generally NOT
  ## what you want as it can lead to data points captured at different times
  ## getting omitted due to similar data.
  # influx_omit_timestamp = false

  ## HTTP/2 Timeouts
  ## The following values control the HTTP/2 client's timeouts. These settings
  ## are generally not required unless a user is seeing issues with client
  ## disconnects. If a user does see issues, then it is suggested to set these
  ## values to "15s" for ping timeout and "30s" for read idle timeout and
  ## retry.
  ##
  ## Note that the timer for read_idle_timeout begins at the end of the last
  ## successful write and not at the beginning of the next write.
  # ping_timeout = "0s"
  # read_idle_timeout = "0s"

  ## Optional TLS Config for use on HTTP connections.
  # 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

  ## Rate limits for sending data (disabled by default)
  ## Available, uncompressed payload size e.g. "5MB"
  # rate_limit = "unlimited"
  ## Fixed time-window for the available payload size e.g. "5m"
  # rate_limit_period = "0s"

  ## Number of concurrent writes to the output
  ## When set to one sequential sending is used (default).
  ## NOTE: When using two or more concurrent writes the sending order of
  ##       metrics is not guaranteed!
  # concurrent_writes = 1

Metrics

Reference the influx serializer for details about metric production.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Err        error
	StatusCode int
	Retryable  bool
}

func (APIError) Error

func (e APIError) Error() string

func (APIError) Unwrap added in v1.33.1

func (e APIError) Unwrap() error

type InfluxDB

type InfluxDB struct {
	URLs             []string                  `toml:"urls"`
	LocalAddr        string                    `toml:"local_address"`
	Token            config.Secret             `toml:"token"`
	Organization     string                    `toml:"organization"`
	Bucket           string                    `toml:"bucket"`
	BucketTag        string                    `toml:"bucket_tag"`
	ExcludeBucketTag bool                      `toml:"exclude_bucket_tag"`
	Timeout          config.Duration           `toml:"timeout"`
	HTTPHeaders      map[string]*config.Secret `toml:"http_headers"`
	HTTPProxy        string                    `toml:"http_proxy"`
	UserAgent        string                    `toml:"user_agent"`
	ContentEncoding  string                    `toml:"content_encoding"`
	UintSupport      bool                      `toml:"influx_uint_support"`
	OmitTimestamp    bool                      `toml:"influx_omit_timestamp"`
	PingTimeout      config.Duration           `toml:"ping_timeout"`
	ReadIdleTimeout  config.Duration           `toml:"read_idle_timeout"`
	ConcurrentWrites uint64                    `toml:"concurrent_writes"`
	Log              telegraf.Logger           `toml:"-"`
	commontls.ClientConfig
	ratelimiter.RateLimitConfig
	// contains filtered or unexported fields
}

func (*InfluxDB) Close

func (i *InfluxDB) Close() error

func (*InfluxDB) Connect

func (i *InfluxDB) Connect() error

func (*InfluxDB) Init added in v1.32.3

func (i *InfluxDB) Init() error

func (*InfluxDB) SampleConfig

func (*InfluxDB) SampleConfig() string

func (*InfluxDB) Write

func (i *InfluxDB) Write(metrics []telegraf.Metric) error

Write sends metrics to one of the configured servers, logging each unsuccessful. If all servers fail, return an error.

type ThrottleError added in v1.35.0

type ThrottleError struct {
	Err        error
	StatusCode int
	RetryAfter time.Duration
}

func (ThrottleError) Error added in v1.35.0

func (e ThrottleError) Error() string

func (ThrottleError) Unwrap added in v1.35.0

func (e ThrottleError) Unwrap() error

Jump to

Keyboard shortcuts

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