http

package
v0.0.0-...-bdb06d8 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2018 License: MIT Imports: 11 Imported by: 0

README

HTTP Input Plugin

The HTTP input plugin collects metrics from one or more HTTP(S) endpoints. The endpoint should have metrics formatted in one of the supported input data formats. Each data format has its own unique set of configuration options which can be added to the input configuration.

Configuration:
# Read formatted metrics from one or more HTTP endpoints
[[inputs.http]]
  ## One or more URLs from which to read formatted metrics
  urls = [
    "http://localhost/metrics"
  ]

  ## HTTP method
  # method = "GET"

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

  ## Optional HTTP Basic Auth Credentials
  # username = "username"
  # password = "pa$$word"

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

  ## Amount of time allowed to complete the HTTP request
  # timeout = "5s"

  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/digbrand1977/tinymonitor/blob/master/docs/DATA_FORMATS_INPUT.md
  # data_format = "influx"

Metrics:

The metrics collected by this input plugin will depend on the configured data_format and the payload returned by the HTTP endpoint(s).

The default values below are added if the input format does not specify a value:

  • http
    • tags:
      • url

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	URLs   []string `toml:"urls"`
	Method string

	Headers map[string]string

	// HTTP Basic Auth Credentials
	Username string
	Password string

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

	Timeout itscripts.Duration
	// contains filtered or unexported fields
}

func (*HTTP) Description

func (*HTTP) Description() string

Description returns a one-sentence description on the Input

func (*HTTP) Gather

func (h *HTTP) Gather(acc tinymonitor.Accumulator) error

Gather takes in an accumulator and adds the metrics that the Input gathers. This is called every "interval"

func (*HTTP) SampleConfig

func (*HTTP) SampleConfig() string

SampleConfig returns the default configuration of the Input

func (*HTTP) SetParser

func (h *HTTP) SetParser(parser parsers.Parser)

SetParser takes the data_format from the config and finds the right parser for that format

Jump to

Keyboard shortcuts

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