I have a following telegraf
configuration
[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"
I need to dump data as fast as possible to my influx DB
. I understand that it has something to do with interval
and flush_interval
settings (here is what I've been reading), but I can't figure out what is the difference between interval
and flush_interval
. Would someone be able to help me out?
Flush jitter is used to prevent every output plugin from sending writes simultaneously, which can overwhelm some data sinks. Each flush interval, every output plugin will sleep for a random time between zero and the flush jitter before emitting metrics.
Telegraf metrics are the internal representation used to model data during processing. These metrics are closely based on InfluxDB's data model and contain four main components: Measurement name: Description and namespace for the metric. Tags: Key/Value string pairs and usually used to identify the metric.
I've asked the maintainer of Telegraf to provide an answer to this question. Here it is:
You can think of inputs as falling into 2 categories: polling (regular) and event driven (service inputs). The interval is the frequency that polling inputs plugins look for data. Most of the event driven plugins do not use the interval, although the statsd plugin is a notable exception.
All collected data has a timestamp, this means that regardless of how long it takes to send the data, it will have the timestamp of when it was sampled.
The flush_interval is how frequently the outputs write data. This is the longest you will have to wait under normal circumstances for the data to be written. The metric_batch_size setting also comes into play here, if this number of new metrics are collected then the output will immediately flush. In other words, Telegraf will trigger a write when either metric_batch_size new metrics are collected or after flush_interval, whichever comes first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With