如何从Gatling写入InfluxDB?

时间:2017-10-12 20:30:32

标签: influxdb gatling

我的问题已被提出,但我没有成功解决我的问题。

我没有成功将Gatling的数据实时发送到InfluxDB。

我在Windows 10上。 加特林版本: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接受了石墨协议。我假设我可以将数据从Gatling发送到InfluxDB。我当然错过了一些东西。

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

在此先感谢您的帮助,我绝对需要它!

安东尼

1 个答案:

答案 0 :(得分: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