计算涌入的字节

发布于 2025-01-18 06:21:05 字数 790 浏览 3 评论 0原文

我可以接收带有inputs.mqtt_consumer telegraf插件的消息,但它为我提供了大量InfluxDB数据。

我如何在Telegraf配置中只计算接收到的字节和消息的数量并将其报告给涌入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"

我试图搜索谷歌,但没有找到任何明确的方法来做到这一点。

我只想每分钟接收到选定主题的每分钟数量和消息

I can receive messages with the inputs.mqtt_consumer telegraf plugin, but it gives me a lot of data in influxdb.

How can I in the telegraf configuration just count the number of received bytes and messages and report that to influx 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"

I tried to google around but din't find any clear ways to do it.

I just want number of bytes and messages received each minute for the selected topic

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦上情书 2025-01-25 06:21:05

我没有设法接收所有消息并计算它们,但是我找到了可以从经纪人那里获取数据的解决方案。不完全是我想要的,但我需要的东西很好。

  topics = [
    "$SYS/broker/load/messages/received/1min",
    "$SYS/broker/load/messages/sent/1min",
  ]
  ...
  data_format = "value"
  data_type = "float"

I did not manage to receive all the messages and count them, but I found a solution where I can get the data from the broker. Not exactly what I asked for but fine for what I need.

  topics = [
    "$SYS/broker/load/messages/received/1min",
    "$SYS/broker/load/messages/sent/1min",
  ]
  ...
  data_format = "value"
  data_type = "float"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文