Configure telegraf to run only a day at 9:30am

Hi ,

I need to configure Telegraf exec plugin to run a shell script every day at 9:30 am. Is there way to do it using telegraf configuration only or any workarounds here

Hi @girish_babu,
So I don’t believe this is currently possible. here are two workaround i can think of.

  1. You could set a 24 hour period on the interval and make sure Telegraf is launched at 9:30am. Not the most foolproof way.

  2. The second option would be to add a conditional into your script that checks the server time and will only push a metric to telegraf in the event that it is 9:30am. You could potentially swap to execD to guarantee data collection better. As using this method with exec would mean if you missed 9:30 you with the collection you wouldn’t collect.

@jpowers have you got any ideas how they could achieve this ? :slight_smile:

1 Like

If you only want to run it once in a 24-hour period, I would probably set up a cron job to run it at the required time and then run Telegraf with --once.

1 Like