Interval settings in input

My usecase is to have following data collection method

  1. collect one time immediately when telegraf is started itself.
  2. Then continue to periodically poll in a specific interval

So I wrote configuration like

[[inputs.http]]
  interval = "12h"
  urls = [ "foo" ]

But it looks like telegraf is not doing initial poll (case 1) for this sensor. How can I have this behavior from telegraf?

telegraf version: telegraf:1.24-alpine

Telegraf gets data on a schedule (interval), and only one is admitted, therefore you can’t.

The only “workaround” that comes to mind to execute a gathering round ignoring schedules is running Telegraf.exe --config {.....} --once, using --once will run the whole pipeline (input to Output) just once.

If such “solution” is feasible or not is up to you to decide

Thanks @Giovanni_Luisotto . I can probably change docker image to do a round of --once before running the actual telegraf.

Though I have a doubt regarding behavior of --once when a input plugin like say syslog is used. Will the once mode wait if no log messages come?

(As a workaround for that I can have a smaller telegraf config file with only bare necessary inputs)

Regards,

@maloy-ghosh can you please try with round_interval = false in the agent section (see docs) as otherwise telegraf will round to the next hour I think.

@srebhan this solves the issue for me. Thanks a lot.

Just for completeness are you aware of any negative impact of this settings?

It depends on what you need. If you want to have aligned timestamps e.g. matching the hour (01:00 and 13:00) this is bad as it will use the startup time as zero e.g. 13:34:42.056 and 01:34:42.056. Other than this the setting has no effect.