How to set up telegraf to import CSV at specific time of day?

Hello everyone,
every day I want to import energy consumption data from the previous day from our energy supply utility.
The energy supply utility puts this data online at 11 a.m. every day.
I want to set telegraph to run a shell script at 11:30 a.m. every day. This shellscript logs into the website using curl and downloads a CSV.
I could save this CSV and read it in or pass it directly.
How to configure telegraf to run at specific time of day?

example script:

#!/bin/sh
echo '16.05.20 00:15;0,20
16.05.20 00:30;0,10
16.05.20 00:45;0,20
16.05.20 01:00;0,50
16.05.20 01:15;0,00
16.05.20 01:30;2,00

telegraf.conf:

[[inputs.exec]]
commands = [“sh /tmp/test.sh”]
timeout = “5s”
data_format = “csv”
csv_header_row_count = 0
csv_skip_rows = 0
csv_skip_columns = 0
csv_delimiter = “;”
csv_comment = “”
csv_column_names = [“time”,“kW”]
csv_measurement_column = “kW”
csv_tag_columns = [“tag_key”] ???
csv_timestamp_column = “time”
csv_timestamp_format = “02.01.06T15:04”

Hello @Wolke,
Welcome! There isn’t this type of configuration available for Telegraf. Most users of Telegraf leave it running as a service and this is the way I recommend running it in production.
Can you specify when the curl is executed in your shell script?

Also I’d keep an eye out for this addition to the CLI which will allow you to write plain csv (as opposed to annotated CSV) into 2.x for the future.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.