告别数据孤岛:Telegraf-loTDB 实现一站式监控数据闭环
数据是驱动数字化转型的核心燃料,面临海量装备传感器连续生成的巨大时序数据,如何无缝实现高效采集、写入与存储,是工业物联网智能化范畴的核心挑战。Apache IoTDB 作为国产原生时序数据库,为工业物联网场景提供了低成本、高可用的时序数据管理能力。而 Telegraf 作为 InfluxData 开源的轻量级数据采集代理工具,支持多类数据源无缝接入,成为装备数据采集的关键枢纽。
Telegraf-IoTDB 集成插件成功建立物联网数据高效“运输”链路,方便用户收集、组织和处理海量高频时序数据,为实现多维体系监控提供稳定支持:
[*]多源采集:支持多种输入、输出和处理器插件,配置方便,可以从不同泉源收集数据,并发送至指定的数据库目标。
[*]高吞吐写入:支持千万级/秒数据写入性能,海量时序数据毫秒级接入,无惧弱网乱序数据困扰。
[*]低成本存储:基于为时序数据量身定制的文件格式 TsFile 与多类先辈编码、压缩技术,实现 10X 倍无损压缩比,在不影响数据准确性的前提下节省空间占用。
接待查看用户手册相识更多详细内容!
01 功能简介
Telegraf 是一个开源代理工具,用于收集、处理和传输度量数据,由 InfluxData 开发。
Telegraf 有以下特点:
[*]插件体系结构:Telegraf 的强大之处在于其广泛的插件生态体系。它支持多种输入、输出和处理器插件,可以与各种数据源和目标无缝集成。
[*]数据收集:Telegraf 善于从不同泉源收集度量数据,比方体系指标、日志、数据库等。其多功能性使其适用于监视应用程序、基础架构和物联网装备。
[*]输出目标:一旦收集到数据,可以将其发送到各种输出目标。这种灵活性使 Telegraf 适应不同的监视和分析设置。
[*]配置简易:Telegraf 的配置使用 TOML 文件举行。这种简单性使用户能够轻松界说输入、输出和处理器,使定制变得简单明了。
[*]社区与支持:作为开源项目,Telegraf 受益于活跃的社区。用户可以通过论坛和文档贡献插件、陈诉问题并寻求帮助。
Telegraf-IoTDB 插件可以将保存在 Telegraf 中的监控信息输出存储到 IoTDB,输出插件使用了 IoTDB session 举行毗连和数据写入。
02 安装步骤
Telegraf 支持多种操作体系,包括 Linux、Windows、macOS,Telegraf 的安装保举使用 root 管理员权限才能成功完成,具体安装要求及安装步骤请查看 InfluxData 官网。
注:此插件为 Telegraf 内置插件,无需举行二次安装。
03 使用说明
设置输入源
在“telegraf.conf”配置文件中找到“INPUT PLUGINS”配置输入源,具体配置内容如下表所示:
https://img2024.cnblogs.com/blog/3626153/202504/3626153-20250408201603654-918647867.png
https://img2024.cnblogs.com/blog/3626153/202504/3626153-20250408201616813-1583176206.png
设置输出源
在“telegraf.conf”配置文件中找到“outputs.iotdb”配置输出源,具体配置内容如下表所示:
https://img2024.cnblogs.com/blog/3626153/202504/3626153-20250408201639022-1892603646.png
https://img2024.cnblogs.com/blog/3626153/202504/3626153-20250408201648469-1081471866.png
*输入源示例可查看 InfluxData 官网。
启动 Telegraf 服务
telegraf -config /path/to/telegraf.conf
04 应用场景
可集成 Telegraf-IoTDB 插件的应用场景包括但不限于:
[*]物联网及时监控:利用 Telegraf-IoTDB 插件从各种物联网装备收集传感器上报的时序数据,并将其保存在 IoTDB 后端,从而实现对温度和湿度等环境条件的及时监控。同时,利用 IoTDB 的高效存储和查询功能,用户可以方便地分析随时间变化的数据趋势,并根据历史数据做出明智的决议。
[*]智慧农业数据采集:使用 Telegraf-IoTDB 插件收集智慧农业传感器上报的时序数据。通过将水分含量、养分含量和大气条件等指标传输到 IoTDB,农夫能够得到最适配的莳植、浇水时间规划,从而进步作物产量和资源管理效能。
[*]能源消耗分析:利用 Telegraf-IoTDB 插件实现对整个公用奇迹网络中智能电表能耗指标的全方位跟踪。集成 Telegraf-IoTDB 插件不但能够精准识别用电高峰,还能运用分析模子,预测将来的能耗消费趋势,终极帮助相干部门有效建立节能计划并改善公用奇迹管理模式。
[*]自动化工业装备监控:使用 Telegraf-IoTDB 插件采集制造厂机器的各项运行指标,并将其存储在 IoTDB 中以供分析。基于此项集成,可以帮助识别机器运行的低效环节,判断预测性维护需求,及时监测运行异常,确保机器处于最佳运行性能状态,并最大限度地淘汰不测停机时间。
05 使用示例
以下是一个使用 Telegraf 收集 CPU 数据并使用 Telegraf-IoTDB 输出到 IoTDB 的示例。使用 Telegraf 命令生成配置文件:
telegraf --sample-config --input-filter cpu --output-filter iotdb > cpu_iotdb.conf
[*]在 cpu_iotdb.conf 中修改 input cpu 插件的配置。其中,“name_override” 字段为输出到 IoTDB 时使用的自界说时间序列路径名:
# Read metrics about cpu usage
[]
## 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"
[*]在 cpu_iotdb.conf 中修改 output iotdb 插件的配置:
https://img2024.cnblogs.com/blog/3626153/202504/3626153-20250408201939444-2122844140.png
# Save metrics to an IoTDB Database
[]
## 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 tagstag1: "private" and tag2: "working" and
##fieldss1: 100 ands2: "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 = "device_id"
## Handling of unsupported characters
## Some characters in different versions of IoTDB are not supported in path name
## A guide with suggetions on valid paths can be found here:
## for iotdb 0.13.x -> https://iotdb.apache.org/UserGuide/V0.13.x/Reference/Syntax-Conventions.html#identifiers
## for iotdb 1.x.x and above-> https://iotdb.apache.org/UserGuide/V1.3.x/User-Manual/Syntax-Rule.html#identifier
##
## Available values are:
## - "1.0", "1.1", "1.2", "1.3"-- enclose in `` the world having forbidden character
## such as @ $ # : [ ] { } ( ) space
## - "0.13" -- enclose in `` the world having forbidden character
## such as space
##
## Keep this section commented if you don't want to sanitize the path
sanitize_tag = "1.3"
[*]使用 cpu_iotdb.conf 配置文件运行 Telegraf,运行一段时间后,可以在 IoTDB 中查询到 Telegraf 收集上报的数据。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]