http_response

package
v0.0.0-...-c6d3e3d Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Example Input Plugin

This input plugin will test HTTP/HTTPS connections.

Configuration:
# HTTP/HTTPS request given an address a method and a timeout
[[inputs.http_response]]
  ## Server address (default http://localhost)
  address = "http://github.com"
  ## Set response_timeout (default 5 seconds)
  response_timeout = "5s"
  ## HTTP Request Method
  method = "GET"
  ## Whether to follow redirects from the server (defaults to false)
  follow_redirects = true
  ## HTTP Request Headers (all values must be strings)
  # [inputs.http_response.headers]
  #   Host = "github.com"
  ## Optional HTTP Request Body
  # body = '''
  # {'fake':'data'}
  # '''

  ## Optional substring or regex match in body of the response
  ## response_string_match = "\"service_status\": \"up\""
  ## response_string_match = "ok"
  ## response_string_match = "\".*_status\".?:.?\"up\""

  ## 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
Measurements & Fields:
  • http_response
    • response_time (float, seconds)
    • http_response_code (int) #The code received
Tags:
  • All measurements have the following tags:
    • server
    • method
Example Output:
$ ./telegraf -config telegraf.conf -input-filter http_response -test
http_response,method=GET,server=http://www.github.com http_response_code=200i,response_time=6.223266528 1459419354977857955

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRedirectAttempted = errors.New("redirect")

ErrRedirectAttempted indicates that a redirect occurred

Functions

This section is empty.

Types

type HTTPResponse

type HTTPResponse struct {
	Address             string
	Body                string
	Method              string
	ResponseTimeout     internal.Duration
	Headers             map[string]string
	FollowRedirects     bool
	ResponseStringMatch 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
	// contains filtered or unexported fields
}

HTTPResponse struct

func (*HTTPResponse) Description

func (h *HTTPResponse) Description() string

Description returns the plugin Description

func (*HTTPResponse) Gather

func (h *HTTPResponse) Gather(acc telegraf.Accumulator) error

Gather gets all metric fields and tags and returns any errors it encounters

func (*HTTPResponse) HTTPGather

func (h *HTTPResponse) HTTPGather() (map[string]interface{}, error)

HTTPGather gathers all fields and returns any errors it encounters

func (*HTTPResponse) SampleConfig

func (h *HTTPResponse) SampleConfig() string

SampleConfig returns the plugin SampleConfig

Jump to

Keyboard shortcuts

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