我已经配置了Telegraf从mqtt队列中收集,但它不工作,我看不出原因。
误差
2022 - 11 - 15 t19:30:13z E !运行代理错误:加载错误配置文件/etc/telegraf/telegraf.conf:第128行:配置指定字段["measurement_name"],但是它们没有被使用
相关配置
# Configuration for sending metrics to InfluxDB
[[outputs.influxdb_v2]]
urls = ["<removed>.aws.cloud2.influxdata.com"]
bucket = "ems-esp"
token = "<removed>"
organization = "<removed>"
# Below is line 128 where the error occurs
[[inputs.mqtt_consumer]]
## Broker URLs for the MQTT server or cluster. To connect to multiple
## clusters or standalone servers, use a separate plugin instance.
## example: servers = ["tcp://localhost:1883"]
## servers = ["ssl://localhost:1883"]
## servers = ["ws://localhost:1883"]
servers = ["tcp://192.168.178.61:1883"]
topics = [
"ems-esp/boiler_data_ww",
"ems-esp/boiler_data",
"ems-esp/thermostat_data",
"ems-esp/thermostat_data_hc1",
"ems-esp/solar_data",
"ems-esp/heartbeat",
"ems-esp/info",
]
data_format = "json"
[[inputs.mqtt_consumer]]
servers = ["tcp://192.168.178.61:1883"]
topics = [
"shellies/ht_lounge/info"
]
data_format = "json"
但是它指向的线只是定义[[inputs.mqtt_consumer]]
,我看不出问题。我在文件中也找不到任何不正确的内容。
我的telgraf配置也有类似的问题:
[[inputs.http]]
urls = ["http://relay.local/~mat/proxy_boiler.php"]
data_format = "json"
method = "GET"
timeout = "5s"
[[inputs.http]]
urls = ["http://relay.local/~mat/proxy_boiler.php?memory=true"]
name = "memory"
data_format = "json"
method = "GET"
timeout = "10s"
产生的错误:
[telegraf]运行代理错误:错误加载配置文件/etc/telegraf/telegraf.conf:插件输入。Http:第22行:配置指定了字段["name"],但没有使用
第22行指向输入的第一个实例。HTTP,但实际问题是在第32行,名称= "memory"我相信这在最近的Telegraf版本中被低估了,所以删除这一行可以让Telegraf运行。
尝试搜索"measurement_name"在你的代码中删除它。