HTTP Listener v2 Monitoring

Use This InfluxDB Integration for Free

HTTP Listener v2 is a service input plugin that listens for metrics sent via HTTP (incoming HTTP POST/PUT requests). The data can be parsed and then forwarded to InfluxDB or any other supported database. Metrics may be sent in any supported data format. This plugin allows Telegraf to serve as a proxy or router for the /write endpoint of the InfluxDB v2110 HTTP API.

Telegraf Input Plugin: HTTP Listener v2

The HTTP Listener v2 plugin was written by Julius Marozas when he wanted to collect metrics from my Fronius solar inverter via the Push Service, and at the time, Telegraf did not have a plugin that would accept data sent via HTTP in JSON format. How he utilized the http_listener_v2 Telegraf plugin is described in his blog post titled “Collecting Time Series Data with Telegraf: A Case for Fronius Solar Inverter’s Push Service”. In this post, he shows how to configure the Telegraf server to listen for the incoming JSON data sent by the inverter and how he set up the http_listener_v2 plugin in the Telegraf’s config.

HTTP Listener v2 Basics

After receiving the HTTP POST request, thehttp_listener_v2 plugin parses the data based on data_format option (all available formats can be found here). The plugin can be used in various cases. It can be configured to save non-numeric values as tags or parse other data formats such as CSV.

This is a sample configuration for the plugin.

[[inputs.http_listener_v2]]
  ## Address and port to host HTTP listener on
  service_address = ":8080"

  ## Path to listen to.
  # path = "/telegraf"

  ## HTTP methods to accept.
  # methods = ["POST", "PUT"]

  ## maximum duration before timing out read of the request
  # read_timeout = "10s"
  ## maximum duration before timing out write of the response
  # write_timeout = "10s"

  ## Maximum allowed http request body size in bytes.
  ## 0 means to use the default of 524,288,000 bytes (500 mebibytes)
  # max_body_size = "500MB"

  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]

  ## Add service certificate and key
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

  ## Optional username and password to accept for HTTP basic authentication.
  ## You probably want to make sure you have TLS configured above for this.
  # basic_username = "foobar"
  # basic_password = "barfoo"

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

Note: The plugin previously known as http_listener has been renamed influxdb_listener. If you would like Telegraf to act as a proxy/relay for InfluxDB it is recommended to use influxdb_listener.

For more information, please check out the documentation.

Project URL   Documentation

Related resources

InfluxDb-cloud-logo

The most powerful time series
database as a service

Get Started for Free
Influxdbu

Developer Education

Training for time series app developers.

View All Education