Score:0

Send InfluxDB2 Metrics to different Buckets with Telegraf

ps flag

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?

Score:1
in flag

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.

Gill-Bates avatar
ps flag
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.
Score:0
ps flag

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"]
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.