0

I would like to put different metrics in different buckets. In my bucket Websites, I want to put HTTP response metrics.

This is how my configuration file /etc/telegraf/telegraf.d/httpmetrics.conf looks like:

[[inputs.http_response]]
  ## List of urls to query.
  urls = [
          "https://example.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
  
  ## Interface to use when dialing an address
  interface = "eth0"

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxx"
  organization = "my Company"
  bucket = "websites"
  timeout = "5s"
  user_agent = "telegraf"
  content_encoding = "gzip"

Now I have the problem that my metrics appear in all buckets. What am I doing wrong?

Gill-Bates
  • 585
  • 2
  • 8
  • 23

2 Answers2

1

With this configuration Telegraf does not know that it should avoid writing certain inputs to the available outputs, i.e., by default, all inputs are written to all outputs.

There are several ways to split measurements across buckets, one of the ways is to set, in your input, an unique name to the measurement, e.g. name_override = "httpcheck", and, then, state that the output only considers such measurements, namepass = ["httpcheck"].

You can find out more about this on InfluxDB docs.

JP Dias
  • 126
  • 3
  • Thanks for the clarification and the links to the docs. I have written my insight as a new answer so that it may be helpful to other beginners. – Gill-Bates Mar 29 '23 at 09:23
0

The minimum configuration for a Telegraf installation is at least one input and one output plugin.

In order for the input plugin [[inputs.http_response]] values to end up in the correct bucket/database, the output plugin needs to know where to route the data.

After adding the following line to my output plugin, it works as desired.

namepass = ["http_response"]
Gill-Bates
  • 585
  • 2
  • 8
  • 23