telegraftelegraf-inputs-plugintelegraf-pluginstelegraf-output-plugins

How to change the interval of a plugin in telegraf?


Using: telegraf version 1.23.1
Thats the workflow Telegraf => Influx => Grafana.

I am using telegraf to check my metrics on a shared server. So far so good, i already could initalize the Telegraf uWSGI Plugin and display the data of my running django projects in grafana.


Problem

Now i wanted to check some folder size too with the [[inputs.filecount]] Telegraf Plugin and this works also well. However i do not need Metrics for every 10s for this plugin. So i change the interval like mentioned in the Documentation in the [[inputs.filecount]] Plugin.

telegraf.conf

[agent] 
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "5s"
  flush_interval = "10s"
  flush_jitter = "0s"

#... PLUGIN
[[inputs.filecount]]
  # set different interval for this input plugin every 10min
  interval=“600s”
  collection_jitter=“20s”
  # Default from Doc =>
  directories = ["/home/myserver/logs", "/home/someName/growingData, ]
  name = "*"
  recursive = true
  regular_only = false
  follow_symlinks = false
  size = "0B" 
  mtime = "0s"

After restarting Telegram with Supervisor it crashed because it could not parse the new lines.

supervisor.log

 Error running agent: Error loading config file /home/user/etc/telegraf/telegraf.conf: Error parsing data: line 208: invalid TOML syntax

So that are these lines i added because i thought that is how the Doc it mention it.

telegraf.conf

  # set different interval for this input plugin every 10min
  interval=“600s”
  collection_jitter=“20s”

Question

So my question is. How can i change or setup the interval for a single input plugin in telegraf?

Or do i have to apply a different TOML syntax like [[inputs.filecount.agent]] or so?

I assume that i do not have to change any output interval also? Because i assume even though its currently 10s, if this input plugin only pulls/inputs data every 600s it should not matter, some flush cycle will push the Data to influx .


Solution

  • How can i change or setup the interval for a single input plugin in telegraf?

    As the link you pointed to shows, individual inputs can set the interval and collection_jitter options. There is no difference in the TOML syntax for example I can do the following for the memory input plugin:

    [[inputs.mem]]
      interval="600s"
      collection_jitter="20s"
    

    I assume that i do not have to change any output interval also?

    Correct, these are independent of each other.

    line 208: invalid TOML syntax

    Knowing what exactly is on line 208 and around that line will hopefully resolve your issue and get you going again. Also make sure your quotes that you used are correct. Sometimes when people copy and paste quotes they get vs " which can cause issues!