目录
输入和输出集成概述
MQTT Telegraf 插件旨在从指定的 MQTT 主题读取数据并创建指标,使用户能够利用 MQTT 进行实时数据收集和监控。
此插件将 Telegraf 指标保存到 Apache IoTDB 后端,支持会话连接和数据插入。
集成详情
MQTT
MQTT 插件允许从指定的 MQTT 主题读取指标,并使用支持的输入数据格式创建指标。此插件作为服务输入运行,监听传入的指标或事件,而不是像普通插件那样按设定的间隔收集它们。该插件的灵活性通过支持各种 Broker URL、主题和连接功能(包括服务质量 (QoS) 级别和持久会话)得到增强。其配置选项结合了全局设置,可修改指标并有效处理启动错误。它还支持用于保护用户名和密码选项的密钥存储配置,确保与 MQTT 服务器的安全连接。
IoTDB
Apache IoTDB(物联网数据库)是一种物联网原生数据库,具有高性能的数据管理和分析能力,可部署在边缘和云端。其轻量级架构、高性能和丰富的功能集非常适合物联网工业领域的海量数据存储、高速数据摄取和复杂分析。IoTDB 与 Apache Hadoop、Spark 和 Flink 深度集成,进一步增强了其处理大规模数据和复杂处理任务的能力。
配置
MQTT
[[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:1883"]
topics = [
"telegraf/host01/cpu",
"telegraf/+/mem",
"sensors/#",
]
# topic_tag = "topic"
# qos = 0
# connection_timeout = "30s"
# keepalive = "60s"
# ping_timeout = "10s"
# max_undelivered_messages = 1000
# persistent_session = false
# client_id = ""
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
# insecure_skip_verify = false
# client_trace = false
data_format = "influx"
# [[inputs.mqtt_consumer.topic_parsing]]
# topic = ""
# measurement = ""
# tags = ""
# fields = ""
# [inputs.mqtt_consumer.topic_parsing.types]
# key = type
IoTDB
[[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 = "nanosecond"
## 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 = "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"
输入和输出集成示例
MQTT
-
智能家居监控:使用 MQTT Consumer 插件监控智能家居设置中的各种传感器。 在这种情况下,可以将插件配置为订阅不同设备的主题,例如温度、湿度和能耗。 通过聚合这些数据,房主可以可视化趋势并接收异常模式的警报,从而提高家庭自动化系统的整体质量和效率。
-
物联网环境传感:部署 MQTT Consumer 以收集来自分布在不同位置的传感器的环境数据。 例如,这可以包括来自空气质量传感器、温度传感器和噪声水平计的读数。 该插件可以配置为从 MQTT 主题中提取相关标签和字段,从而可以对大规模环境条件进行详细分析和报告,从而为城市规划或环境倡议提供更好的决策支持。
-
实时车辆跟踪和遥测:将 MQTT Consumer 插件集成到车辆遥测系统中,该系统实时收集来自各种传感器的数据。 通过该插件,可以将与车辆性能、位置和燃料消耗相关的指标发送到中央监控仪表板。 这种实时遥测数据使车队经理能够通过主动数据分析来优化路线、降低燃料成本并改进车辆维护计划。
-
农业监控系统:利用此插件收集来自农业传感器的数据,这些传感器监控土壤湿度、作物健康和天气状况。 MQTT Consumer 可以订阅与农业设备和环境传感器相关的多个主题,使农民能够做出数据驱动的决策,以提高作物产量,同时节约资源,从而提高农业的可持续性。
IoTDB
-
实时物联网监控:利用 IoTDB 插件收集来自各种物联网设备的传感器数据,并将其保存在 Apache IoTDB 后端,从而实现对环境条件(如温度和湿度)的实时监控。 此用例使组织能够分析随时间变化的趋势,并根据历史数据做出明智的决策,同时还可以利用 IoTDB 的高效存储和查询功能。
-
智能农业数据采集:使用 IoTDB 插件收集来自部署在田间的智能农业传感器的指标。 通过将湿度水平、养分含量和大气条件传输到 IoTDB,农民可以访问有关最佳种植和浇水计划的详细见解,从而提高作物产量和资源管理水平。
-
能耗分析:利用 IoTDB 插件跟踪来自整个公用事业网络智能电表的能耗指标。 这种集成支持分析以识别使用高峰并预测未来的消费模式,最终支持节能措施和改进的公用事业管理。
-
自动化工业设备监控:使用此插件收集来自制造工厂机械的操作指标,并将其存储在 IoTDB 中进行分析。 此设置可以帮助识别效率低下、预测性维护需求和操作异常,从而确保最佳性能并最大限度地减少意外停机时间。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。