telegraf/plugins/inputs/http_listener
Daniel Nelson de355b76d6
Simplify testing with TLS (#4095)
2018-05-04 16:33:23 -07:00
..
testdata http_listener input unit tests 2016-10-24 18:17:49 +01:00
README.md Add HTTP basic auth support to the http_listener input (#3496) 2018-03-23 11:56:49 -07:00
bufferpool.go http listener refactor 2016-10-24 18:17:49 +01:00
http_listener.go Simplify testing with TLS (#4095) 2018-05-04 16:33:23 -07:00
http_listener_test.go Simplify testing with TLS (#4095) 2018-05-04 16:33:23 -07:00

README.md

HTTP listener service input plugin

The HTTP listener is a service input plugin that listens for messages sent via HTTP POST. The plugin expects messages in the InfluxDB line-protocol ONLY, other Telegraf input data formats are not supported. The intent of the plugin is to allow Telegraf to serve as a proxy/router for the /write endpoint of the InfluxDB HTTP API.

The /write endpoint supports the precision query parameter and can be set to one of ns, u, ms, s, m, h. All other parameters are ignored and defer to the output plugins configuration.

When chaining Telegraf instances using this plugin, CREATE DATABASE requests receive a 200 OK response with message body {"results":[]} but they are not relayed. The output configuration of the Telegraf instance which ultimately submits data to InfluxDB determines the destination database.

Enable TLS by specifying the file names of a service TLS certificate and key.

Enable mutually authenticated TLS and authorize client connections by signing certificate authority by including a list of allowed CA certificate file names in tls_allowed_cacerts.

Enable basic HTTP authentication of clients by specifying a username and password to check for. These credentials will be received from the client as plain text if TLS is not configured.

See: Telegraf Input Data Formats.

Example:

curl -i -XPOST 'http://localhost:8186/write' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

Configuration:

This is a sample configuration for the plugin.

# # Influx HTTP write listener
[[inputs.http_listener]]
  ## Address and port to host HTTP listener on
  service_address = ":8186"

  ## timeouts
  read_timeout = "10s"
  write_timeout = "10s"

  ## HTTPS
  tls_cert= "/etc/telegraf/cert.pem"
  tls_key = "/etc/telegraf/key.pem"

  ## MTLS
  tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]

  ## Basic authentication
  basic_username = "foobar"
  basic_password = "barfoo"