在Telegraf中的interval vs flush_interval

时间:2019-02-20 02:17:51

标签: influxdb telegraf

我具有以下telegraf配置

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

[[outputs.influxdb]]
  urls = ["http://influxdb:8086"]
  database = "telegraf"
  username = ""
  password = ""
  retention_policy = ""
  write_consistency = "any"
  timeout = "5s"

[[inputs.docker]]
  endpoint = "unix:///var/run/docker.sock"
  container_names = []
  timeout = "5s"
  perdevice = true
  total = false

[[inputs.cpu]]
[[inputs.system]]
[[inputs.influxdb]]
  urls = ["http://influxdb:8086/debug/vars"]
[[inputs.syslog]]
#   ## Specify an ip or hostname with port - eg., tcp://localhost:6514, tcp://10.0.0.1:6514
#   ## Protocol, address and port to host the syslog receiver.
#   ## If no host is specified, then localhost is used.
#   ## If no port is specified, 6514 is used (RFC5425#section-4.1).
  server = "tcp://localhost:6514"

[[inputs.socket_listener]]
# ## URL to listen on
service_address = "udp4://:8094"
data_format = "influx"

我需要尽快将数据转储到influx DB。我了解这与intervalflush_interval设置(here is what I've been reading)有关,但是我无法弄清楚interval和{{1 }}。有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

我已要求Telegraf的维护者提供此问题的答案。 Here是:

  

您可以将输入分为两类:轮询   (常规)和事件驱动(服务输入)。间隔是   轮询输入插件查找数据的频率。大部分活动   驱动驱动的插件不使用间隔,尽管statsd插件是   一个明显的例外。

     

所有收集的数据都有时间戳,这意味着无论如何   发送数据所需的时间很长,它将带有时间戳记   被采样了。

     

flush_interval是输出写入数据的频率。这是   在正常情况下,您需要等待的最长时间   要写入的数据。 metric_batch_size设置也起作用   在这里,如果收集了这个数量的新指标,则输出将   立即冲洗。换句话说,Telegraf将在以下情况下触发写操作:   收集metric_batch_size新指标或之后   flush_interval,以先到者为准。