我可以使用inputs.mqtt_consumer
电报插件接收消息,但它在influxdb中给了我很多数据。
在Telegram配置中,我如何只计算接收到的字节和消息的数量,并将其报告给Inflow db?
# Configuration for telegraf agent
[agent]
interval = "20s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb_v2]]
urls = ["XXXXXXXXXXXXXXXX"]
token = "$INFLUX_TOKEN"
organization = "XXXXXXXXXXXXXXX"
bucket = "XXXXXXXXXXXXXXX"
[[inputs.mqtt_consumer]]
servers = ["tcp://XXXXXXXXXXXXXXXXXXXXX:1883"]
topics = [
"#",
]
data_format = "value"
data_type = "string"
我试着四处搜索,但找不到任何明确的方法。
我只想要所选主题每分钟接收的字节数和消息数
我没有设法接收到所有消息并对其进行计数,但我找到了一个可以从代理获取数据的解决方案。不完全是我想要的,但我需要的很好。
topics = [
"$SYS/broker/load/messages/received/1min",
"$SYS/broker/load/messages/sent/1min",
]
...
data_format = "value"
data_type = "float"