Metro
Metro

Reputation: 975

Telegraf not writing data quickly

Is there a way to get Telegraf to write output to Cloudwatch quicker?

This is what my configuration file looks like.

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  logfile = ""
  hostname = ""
  omit_hostname = true

My understanding is that Telegraf will trigger a write when metric_batch_size of new metrics is collected, or after the flush_interval is reached. Whichever comes first.

But for some reason, data isn't being written to Cloudwatch, nd I have to constantly increase my search time in Cloudwatch to get any data, which isn't quite ideal.

Is there a setting I might be missing?

Upvotes: 0

Views: 574

Answers (1)

powersj
powersj

Reputation: 379

My understanding is that Telegraf will trigger a write when metric_batch_size of new metrics is collected, or after the flush_interval is reached. Whichever comes first.

This is correct. A couple of things to note:

  1. Consider enabling the high_resolution_metrics option in the cloudwatch output setting to change the precision to 1 second instead of 60 seconds. I do recall in my brief usage of the cloudwatch plugin that there is some delay in sending metrics and I believe this is the reason, but I may not remember all the mechanics at place here.

  2. I would point out that your collection interval is also 10 seconds. So currently you are only ever going to collect data every 10 seconds.

  3. This is also dependent on your inputs, processors, and aggregators in your config. You could have a slower input that is not producing data often or have a config that is doing some aggregation slowing things down as well.

  4. I would suggest running with debug set to true in your config or CLI with --debug and see when and how much data and how often telegraf is writing to cloudwatch via messages like:

2022-07-01T21:24:54Z D! [outputs.file] Wrote batch of 33 metrics in 161.641µs
2022-07-01T21:24:54Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics

Upvotes: 1

Related Questions