influxdb

package
v0.0.0-...-3667945 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 10 Imported by: 0

README

InfluxDB Output Plugin

This plugin writes to InfluxDB via HTTP or UDP.

Configuration:
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://127.0.0.1:8089"] # UDP endpoint example
  urls = ["http://127.0.0.1:8086"] # required
  ## The target database for metrics (telegraf will create it if not exists).
  database = "telegraf" # required

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  # username = "telegraf"
  # password = "metricsmetricsmetricsmetrics"
  ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 512

  ## Optional SSL Config
  # ssl_ca = "/etc/telegraf/ca.pem"
  # ssl_cert = "/etc/telegraf/cert.pem"
  # ssl_key = "/etc/telegraf/key.pem"
  ## Use SSL but skip chain & host verification
  # insecure_skip_verify = false

  ## HTTP Proxy Config
  # http_proxy = "http://corporate.proxy:3128"

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

  ## Compress each HTTP request payload using GZIP.
  # content_encoding = "gzip"
Required parameters:
  • urls: List of strings, this is for InfluxDB clustering support. On each flush interval, Telegraf will randomly choose one of the urls to write to. Each URL should start with either http:// or udp://
  • database: The name of the database to write to.
Optional parameters:
  • write_consistency: Write consistency (clusters only), can be: "any", "one", "quorum", "all".
  • retention_policy: Name of existing retention policy to write to. Empty string writes to the default retention policy.
  • timeout: Write timeout (for the InfluxDB client), formatted as a string. If not provided, will default to 5s. 0s means no timeout (not recommended).
  • username: Username for influxdb
  • password: Password for influxdb
  • user_agent: Set the user agent for HTTP POSTs (can be useful for log differentiation)
  • udp_payload: Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  • ssl_ca: SSL CA
  • ssl_cert: SSL CERT
  • ssl_key: SSL key
  • insecure_skip_verify: Use SSL but skip chain & host verification (default: false)
  • http_proxy: HTTP Proxy URI
  • http_headers: HTTP headers to add to each HTTP request
  • content_encoding: Compress each HTTP request payload using gzip if set to: "gzip"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfluxDB

type InfluxDB struct {
	// URL is only for backwards compatibility
	URL              string
	URLs             []string `toml:"urls"`
	Username         string
	Password         string
	Database         string
	UserAgent        string
	RetentionPolicy  string
	WriteConsistency string
	Timeout          internal.Duration
	UDPPayload       int               `toml:"udp_payload"`
	HTTPProxy        string            `toml:"http_proxy"`
	HTTPHeaders      map[string]string `toml:"http_headers"`
	ContentEncoding  string            `toml:"content_encoding"`

	// Path to CA file
	SSLCA string `toml:"ssl_ca"`
	// Path to host cert file
	SSLCert string `toml:"ssl_cert"`
	// Path to cert key file
	SSLKey string `toml:"ssl_key"`
	// Use SSL but skip chain & host verification
	InsecureSkipVerify bool

	// Precision is only here for legacy support. It will be ignored.
	Precision string
	// contains filtered or unexported fields
}

InfluxDB struct is the primary data structure for the plugin

func (*InfluxDB) Close

func (i *InfluxDB) Close() error

Close will terminate the session to the backend, returning error if an issue arises

func (*InfluxDB) Connect

func (i *InfluxDB) Connect() error

Connect initiates the primary connection to the range of provided URLs

func (*InfluxDB) Description

func (i *InfluxDB) Description() string

Description returns the human-readable function definition of the plugin

func (*InfluxDB) SampleConfig

func (i *InfluxDB) SampleConfig() string

SampleConfig returns the formatted sample configuration for the plugin

func (*InfluxDB) Write

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

Write will choose a random server in the cluster to write to until a successful write occurs, logging each unsuccessful. If all servers fail, return error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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