Hi to everyone guys!
First of all, sorry for my English, as I’m not from an English speaker country. After a lot of time spend on searching for a solution with no results, I come here as my last hope. I’m trying to migrate the data of a csv file to my influx database, using Telegraf (both in local). The data I’m trying to import is basically the timestamp and the amount of ping at that certain time. After several configurations I didn’t found a way to it correctly.
Here is the telegraf.conf related part:
# Parse a complete file each interval
[[inputs.file]]
## Files to parse each interval. Accept standard unix glob matching rules,
## as well as ** to match recursive files and directories.
files = ["./prueba.csv"]
data_format = "csv"
## Name a tag containing the name of the file the data was parsed from. Leave empty
## to disable. Cautious when file name variation is high, this can increase the cardinality
## significantly. Read more about cardinality here:
## https://docs.influxdata.com/influxdb/cloud/reference/glossary/#series-cardinality
# file_tag = ""
#
## Character encoding to use when interpreting the file contents. Invalid
## characters are replaced using the unicode replacement character. When set
## to the empty string the data is not decoded to text.
## ex: character_encoding = "utf-8"
## character_encoding = "utf-16le"
## character_encoding = "utf-16be"
## character_encoding = ""
# character_encoding = ""
## The dataformat to be read from files
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
csv_header_row_count = 0
##csv_column_types = ["string","float"]
csv_skip_rows = 0
csv_skip_columns = 0
csv_column_names = ["timestamp","ping"]
csv_tag_columns = ["Time"]
csv_measurement_column = "timestamp"
csv_trim_space = true
##csv_timestamp_column = "timestamp"
##csv_timestamp_format = "2006-01-02 15:04:05"
##csv_timezone = "Europe/Madrid"
Yup, I’m aware that the las 3 lines are commented. It’s because of the frustration level, makes you try every option.
The csv structure:
timestamp,ping
2022-03-14 08:21:06,25
2022-03-14 08:21:09,49
2022-03-14 08:21:12,4
2022-03-14 08:21:15,3.50
2022-03-14 08:21:18,22
… and so on
As far as now, the only thing I succeeded in, is in importing some data but in the wrong way:
As you can see, every date is imported as a “table” and the ping is not even written. Influx version is 1.8 and Telegraf version is 1.20. Feel free to ask for more info if needed!
Thanks in advance!