influxdb_v2

package
v0.0.0-...-6a73ad5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: MIT Imports: 19 Imported by: 0

README

InfluxDB v2.x Output Plugin

The InfluxDB output plugin writes metrics to the InfluxDB v2.x HTTP service.

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.
  urls = ["http://127.0.0.1:9999"]

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

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingURL = errors.New("missing URL")
)

Functions

func NewHTTPClient

func NewHTTPClient(config *HTTPConfig) (*httpClient, error)

Types

type APIError

type APIError struct {
	StatusCode  int
	Title       string
	Description string
}

func (APIError) Error

func (e APIError) Error() string

type Client

type Client interface {
	Write(context.Context, []telegraf.Metric) error

	URL() string // for logging
}

type HTTPConfig

type HTTPConfig struct {
	URL             *url.URL
	Token           string
	Organization    string
	Bucket          string
	BucketTag       string
	Timeout         time.Duration
	Headers         map[string]string
	Proxy           *url.URL
	UserAgent       string
	ContentEncoding string
	TLSConfig       *tls.Config

	Serializer *influx.Serializer
}

type InfluxDB

type InfluxDB struct {
	URLs            []string          `toml:"urls"`
	Token           string            `toml:"token"`
	Organization    string            `toml:"organization"`
	Bucket          string            `toml:"bucket"`
	BucketTag       string            `toml:"bucket_tag"`
	Timeout         internal.Duration `toml:"timeout"`
	HTTPHeaders     map[string]string `toml:"http_headers"`
	HTTPProxy       string            `toml:"http_proxy"`
	UserAgent       string            `toml:"user_agent"`
	ContentEncoding string            `toml:"content_encoding"`
	UintSupport     bool              `toml:"influx_uint_support"`
	tls.ClientConfig
	// contains filtered or unexported fields
}

func (*InfluxDB) Close

func (i *InfluxDB) Close() error

func (*InfluxDB) Connect

func (i *InfluxDB) Connect() error

func (*InfluxDB) Description

func (i *InfluxDB) Description() string

func (*InfluxDB) SampleConfig

func (i *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.

Jump to

Keyboard shortcuts

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