【问题标题】:How can I write in InfluxDB from Gatling?我如何在 Gatling 的 InfluxDB 中编写代码?
【发布时间】:2018-03-24 21:48:51
【问题描述】:

我的问题已经被问到,但我没有成功解决我的问题。

我无法将我的数据从 Gatling 实时发送到 InfluxDB。

我使用的是 Windows 10。 Gatling 版本:2.3.0(最后一个)。 InfluxDB版本:1.3.5(最后是1.3.6)。

我的 gatling.conf:

data {
    writers = [console, file, graphite]      # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite, jdbc)
    console {
      #light = false                # When set to true, displays a light version without detailed request stats
    }
    file {
      #bufferSize = 8192            # FileDataWriter's internal data buffer size, in bytes
    }
    leak {
      #noActivityTimeout = 30  # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening
    }
    graphite {
      #light = false              # only send the all* stats
      host = "127.0.0.1"         # The host where the Carbon server is located
      port = "2003"              # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
      protocol = "tcp"           # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
      rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
      #bufferSize = 8192          # GraphiteDataWriter's internal data buffer size, in bytes
      #writeInterval = 1          # GraphiteDataWriter's write interval, in seconds
    }
  }

我的 influxdb.conf:

[http]
  # Determines whether HTTP endpoint is enabled.
   enabled = true


  # The bind address used by the HTTP service.
   bind-address = "127.0.0.1:8086"


###
### [[graphite]]
###
### Controls one or many listeners for Graphite data.
###


[[graphite]]
  # Determines whether the graphite endpoint is enabled.
   enabled = true
   database = "gatlingdb"
  # retention-policy = ""
   bind-address = ":2003"
   protocol = "tcp"
  # consistency-level = "one"
   templates = [
       "gatling.*.*.*.*.measurement.simulation.request.status.field"
   ]

我的 gatlingdb 数据库是在 InfluxDB 上创建的,它保持为空。

当我尝试时:

C:\InfluxDB-1.3.5-1>influx -host 127.0.0.1

我已连接到 InfluxDB

>USE gatlingdb

我已连接到我的数据库。那么:

>SHOW SERIES

和

>SELECT * FROM gatling

不要返回任何东西。它是空的。

注意:我输入“FROM gatling”是因为我把它放在了我的 gatling.conf 中:rootPathPrefix = "gatling"

我没有下载 Graphite,但我看到 InfluxDB 接受了 Graphite 协议。我假设我可以将数据从 Gatling 发送到 InfluxDB。我当然错过了什么。

我成功地将 InfluxDB 连接到 Grafana 并显示来自其他数据库的数据。我只是错过了 Gatling 和 InfluxDB 之间的联系。

提前感谢您的帮助,我绝对需要它!

安东尼

【问题讨论】:

    标签: influxdb gatling


    【解决方案1】:

    我几乎完成了这篇文章,它展示了使用 Gatling、Grafana 和 InfluxDB(顺便说一句,没有单独安装 Graphite)创建整个监控基础架构所需的所有步骤,这对我来说非常有效。 我想我会在几天后将它发布在我在 blazemeter.com 上的博客中!所以请继续关注! http://blazemeter.com/blog

    在那里,您甚至可以找到现成的解决方案来启动 Docker 中的所有内容。

    但在此之前(如果它对您来说很紧急),可以分享我的 InfluxDB 配置部分:

    [[graphite]]
    enabled = true
    bind-address = ":2003"
    database = "graphite"
    retention-policy = ""
    protocol = "tcp"
    batch-size = 5000
    batch-pending = 10
    batch-timeout = "1s"
    consistency-level = "one"
    separator = "."
    udp-read-buffer = 0
    

    gatling.conf:

    graphite {
      light = false              # only send the all* stats
      host = "localhost"         # The host where the Carbon server is located
      port = 2003                # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
      protocol = "tcp"           # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
      rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
      bufferSize = 8192          # GraphiteDataWriter's internal data buffer size, in bytes
      writeInterval = 1          # GraphiteDataWriter's write interval, in seconds
    }
    

    您需要检查的第一件事是 InfluxDB 实际上通过石墨协议接受传入的指标。例如,在 InfluxDB 启动日志期间,您应该找到以下行:

    influxdb_1  | [I] 2018-01-26T13:40:37Z Listening on TCP: [::]:2003 service=graphite addr=:2003
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-14
      • 1970-01-01
      • 2014-08-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-23
      • 1970-01-01
      • 2019-06-13
      相关资源
      最近更新 更多