JMeter+Grafana+InfluxDB性能监控平台(一)

目录

一、背景

二、环境

三、安装

1.安装InfluxDB

2.安装Grafana

3.配置JMeter

四、问题

五、参考资料


一、背景

JMeter的性能测试监控和报表一直被诟病,并且测试的数据也无法很好保存和展示。这里介绍一种JMeter稳定性测试监控平台的环境搭建方法以及问题的记录。

二、环境

JMeter v3.2 + Grafana v6.3.0 + InfluxDB v1.6.2

三、安装

1.安装InfluxDB

1)这里采用离线方式安装:# yum install influxdb-1.6.2.x86_64.rpm

2)修改配置:# vi /etc/influxdb/influxdb.conf

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

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

这里,database = "jmeter"表示存入监控数据段数据库名称为“jmeter”;bind-address = ":2003"表示存入监控数据的端口号为“2003”。

###
### [http]
###
### Controls how the HTTP endpoints are configured. These are the primary
### mechanism for getting data into and out of InfluxDB.
###

[http]
  # Determines whether HTTP endpoint is enabled.
  # enabled = true
  
  # The bind address used by the HTTP service.
  bind-address = ":8086"

这里,bind-address = ":8086"表示Grafana获取数据的端口。

3)启动InfluxDB:# systemctl start influxdb

2.安装Grafana

1)离线安装。# yum install grafana-6.3.0-1.x86_64.rpm

2)配置SMTP邮件发送。Grafana的配置文件在安装目录:/etc/grafana/grafana.ini

########################### SMTP  /  Emailing ###########################
[smtp]
enabled = true
host = 10.20.30.40:25      // SMTP服务器地址
user = tester@test.com    // 发送邮件的邮箱地址
# If the password contains # or; you have to wrap it with trippel quotes. Ex """#password;"""
password = 123456          // 发送邮件的邮箱密码
;cert_file = 
;key_file = 
skip_verify = true
from_address = tester@test.com    // 发送邮件的邮箱地址
from_name = Grafana

这里,host = 10.20.30.40:25 表示SMTP服务器地址和端口。邮箱以及密码就是自己的邮箱地址和登录密码。这里为示例。

3)启动Grafana:# systemctl start grafana-server

在浏览器中输入Grafana所在服务器地址:http://<IP地址>:3000/login,即可登录。缺省用户名/密码:admin/admin

3.配置JMeter

参数说明
graphiteMetricsSender将用作度量标准发送者的实现类
graphiteHostGraphite或InfluxDB(启用Graphite插件)服务器主机。InfluxDB所在主机。
graphitePortGraphite或InfluxDB(启用Graphite插件)服务端口,默认2003。注:PickleGraphiteMetricsSender(端口2004)只能与Graphite服务器通信。在InfluxDB配置文件的‘graphite’部分中指定的端口
rootMetricsPrefix

发送到后端的度量的前缀。默认为‘jmeter.’注意,jmeter不会在根前缀和samplerName之间添加分隔符,所以当前需要尾随“.”

summaryOnly如果只想在数据库中保存汇总结果并且不想在测试执行期间收集所有详细指标,设置为true
samplersList如果要将特定采样器仅发送到数据库,则使用该字段。定义要发送到后端的示例结果的名称。如果userRegexpForSamplersList=false,这是一个以分号分隔的名称列表。如果为true,这是一个将与名称匹配的正则表达式。
useRegexpForSamplersList考虑将samplersList作为正则表达式来选择要向后端报告度量值的sampler。默认为false
percentiles要发送到后端的百分比。百分位数可以包含小数部分,如12.5(分隔符始终为“.”)列表必须用分号分隔。通常3或4个值就足够

四、问题

1.可以安装InfluxDB Studio客户端来操作数据库。

下载地址:https://github.com/CymaticLabs/InfluxDBStudio

安装方法可参考:https://www.jianshu.com/p/e2e5fabeaee3

注意:InfluxDB Studio v0.2.0需要先安装.Net Framework v4.6.1。

2.InfluxDB与其他数据库的概念对比:

influxDB中的名词MySql中的概念
database数据库
measurement数据库中的表
point表中的一行数据
Point属性MySql中的概念
time每个数据记录时间,是数据库中的主索引(会自动生成)
fields各种记录值(没有索引的属性),也就是记录的值:如,响应时间,错误数
tags各种有索引的属性

五、参考资料

1.https://grafana.com/doc -- Grafana官网

2.https://blog.csdn.net/zuozewei/article/details/82911173

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值