Telegraf is an open-source agent that facilitates the collection, processing, and transmission of metric data. Developed by InfluxData. Telegraf includes the following features:
This output plugin saves Telegraf metrics to an Apache IoTDB backend, supporting session connection and data insertion.
Here is an example that demonstrates how to collect cpu data from Telegraf into IoTDB.
telegraf --sample-config --input-filter cpu --output-filter iotdb > cpu_iotdb.conf
# Read metrics about cpu usage [[inputs.cpu]] ## Whether to report per-cpu stats or not percpu = true ## Whether to report total system cpu stats or not totalcpu = true ## If true, collect raw CPU time metrics collect_cpu_time = false ## If true, compute and report the sum of all non-idle CPU states report_active = false ## If true and the info is available then add core_id and physical_id tags core_tags = false name_override = "root.demo.telgraf.cpu"
# Save metrics to an IoTDB Database [[outputs.iotdb]] ## Configuration of IoTDB server connection host = "127.0.0.1" # port = "6667" ## Configuration of authentication # user = "root" # password = "root" ## Timeout to open a new session. ## A value of zero means no timeout. # timeout = "5s" ## Configuration of type conversion for 64-bit unsigned int ## IoTDB currently DOES NOT support unsigned integers (version 13.x). ## 32-bit unsigned integers are safely converted into 64-bit signed integers by the plugin, ## however, this is not true for 64-bit values in general as overflows may occur. ## The following setting allows to specify the handling of 64-bit unsigned integers. ## Available values are: ## - "int64" -- convert to 64-bit signed integers and accept overflows ## - "int64_clip" -- convert to 64-bit signed integers and clip the values on overflow to 9,223,372,036,854,775,807 ## - "text" -- convert to the string representation of the value # uint64_conversion = "int64_clip" ## Configuration of TimeStamp ## TimeStamp is always saved in 64bits int. timestamp_precision specifies the unit of timestamp. ## Available value: ## "second", "millisecond", "microsecond", "nanosecond"(default) timestamp_precision = "millisecond" ## Handling of tags ## Tags are not fully supported by IoTDB. ## A guide with suggestions on how to handle tags can be found here: ## https://iotdb.apache.org/UserGuide/Master/API/InfluxDB-Protocol.html ## ## Available values are: ## - "fields" -- convert tags to fields in the measurement ## - "device_id" -- attach tags to the device ID ## ## For Example, a metric named "root.sg.device" with the tags `tag1: "private"` and `tag2: "working"` and ## fields `s1: 100` and `s2: "hello"` will result in the following representations in IoTDB ## - "fields" -- root.sg.device, s1=100, s2="hello", tag1="private", tag2="working" ## - "device_id" -- root.sg.device.private.working, s1=100, s2="hello" convert_tags_to = "fields"