1.修改gatling配置文件gatling.conf
data {
writers = [console, file, graphite]
}
graphite {
host = "x.x.x.x" # InfluxDB的服务器地址
port = 2003 # 回写端口
protocol = "tcp" # 传输协议,tcp或udp
rootPathPrefix = "gatling" # 发送数据的前缀
bufferSize = 8192 # 缓冲池大小
writeInterval = 1 # 回写频率,单位秒
}
2.安装influxdb,并修改influxdb.conf。
[[graphite]]
enabled = true
database = "gatlingdb"
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one"
templates = [
"gatling.*.*.*.* measurement.simulation.request.status.field",
"gatling.*.users.*.* measurement.simulation.measurement.request.field"
]
配置完成后,指定配置文件,启动influxd --config /etc/influxdb/influxdb.conf 成功启动后,查看2003端口是否已经启用 lsof -i:2003
3.运行Gatling,运行结果会实时写入influxdb数据库 如未成功,可配置输出日志,查看详细输出结果:$GATLING_HOME/conf/logback.xml,修改log level