性能测试 CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
性能测试 PTS,5000VUM额度
简介: 性能测试 CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据

CentOS下结合InfluxDBGrafana图表实时展示JMeter相关性能数据

 

by:授客QQ1033553122

 

实现功能1

测试环境1

环境搭建2

1、安装influxdb2

2、创建influxdb数据库3

3、安装grafana5

配置grafana图表数据源7

JMeter Backend Listener监听器配置9

运行jmeter10

新建grafana图表10


测试环境

Win7 64

 

Python 3.4.0

 

JMeter 2.13 r1665067

 

CentOS 6 64位(内核版本2.6.32-642.el6.x86_64

 

influxdb-1.5.2.x86_64.rpm

网盘下载地址:

https://pan.baidu.com/s/1jAbY4xz5gvzoXxLHesQ-PA

 

 

grafana-5.1.2-1.x86_64.rpm

下载地址:

https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.3-1.x86_64.rpm

下载地址:https://pan.baidu.com/s/1wtnPH-iYxaXc6FnL1i0ZVg

 

 

influxdb-5.0.0-py2.py3-none-any.whl

下载地址:

https://pypi.org/project/influxdb/#files

下载地址:https://pan.baidu.com/s/1DQ0HGYNg2a2-VnRSBdPHmg

 

 

环境搭建

1、安装influxdb

# rpm -ivh influxdb-1.5.2.x86_64.rpm

 

 

修改配置

如下,修改一下带背景色内容

# vim /etc/influxdb/influxdb.conf

 

[http]

 # Determines whether HTTP endpoint is enabled.

 enabled = true

 

 # The bind address used by the HTTP service.

 bind-address = ":8086"  

 

 # Determines whether user authentication is enabled over HTTP/HTTPS

 auth-enabled = false  

 

 说明:设置auth-enabled = false是为了免账号密码授权认证访问,图个方便

 

 # The default realm sent back when issuing a basic auth challenge.

 # realm = "InfluxDB"

 

 # Determines whether HTTP request logging is enabled.

 # log-enabled = true  

 

 

[[graphite]]

 #Determines whether the graphite endpoint is enabled.

 enabled = true

 database = "jmeter"

 # retention-policy = ""

 bind-address = ":2003"

 protocol = "tcp"

 consistency-level = "one"

 

#说明 设置consistency-level = "one"设置一致性级别,设置为one表示读操作不会对写操作造成延迟

 

 # These next lines control how batching works. You should have this enabled

 # otherwise you could get dropped metrics or poor performance. Batching

 # will buffer points in memory if you have many coming in.

 

 # Flush if this many points get buffered

 batch-size = 5000

 

 # number of batches that may be pending in memory

 batch-pending = 10

 

 # Flush at least this often even if we haven't hit buffer limit

 batch-timeout = "1s"

 

 # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.

 udp-read-buffer = 0

 

 ### This string joins multiple matching 'measurement' values providing more control over the final measurement name.

 separator = "."

 

说明:个人理解,这里的[[graphite]]配置主要是为收集JMeter性能数据配置的,如果不需要收集jmeter性能数据,应该可以不用配置(未测试)

 

启动/重启linfluxdb

# service influxdb start

 

# service influxdb restart

Stopping influxdb...

influxdb process was stopped [ OK ]

Starting influxdb...

influxdb process was started [ OK ]

 

查看是否在监听端口

[appdeploy@cnsz22VLK6817:/etc/influxdb]#netstat -antp | grep 2003

tcp        0      0 0.0.0.0:2003                0.0.0.0:*                   LISTEN      23994/influxd  

 

2、创建influxdb数据库

# /usr/bin/influx

 

Connected to http://localhost:8086 version 1.5.2

InfluxDB shell version: 1.5.2

# 查看有哪些数据库

> show databases

name: databases

name

----

_internal

 

# 创建数据库,库名为jmeter(create database dbname)

> create database jmeter

> show databases

name: databases

name

----

_internal

jmeter

 

# 附其它操作(类似mysql数据库)

# “切换到要操作的数据库(use dbname)

> use jmeter

 

# 查看有哪些数据表(influxdb中定义为measurement)

> show measurements

name: measurements

name

----

jmeter.all.a.count

jmeter.all.a.max

jmeter.all.a.min

jmeter.all.a.pct90

jmeter.all.a.pct95

jmeter.all.a.pct99

……

说明:以上数据是我跑压测后才有的,往下不再赘述

 

# 查询数据表数据 

> select * from "jmeter.all.a.max" limit 10

name: jmeter.all.a.max

time                value

----                -----

1526383743000000000 6

1526383744000000000 18

1526383745000000000 18

1526383746000000000 18

1526383747000000000 27

1526383962000000000 7

1526383963000000000 7

1526383964000000000 12

1526383965000000000 12

1526383966000000000 12

 

注意:表名为上述xx.xxx.xx的形式的时候,需要加双引号,删除的时候也是

 

# 删除数据表(drop measurement measurement_name)

>drop measurement " jmeter.all.a.max"

 

# 删除数据库

> drop database dbname

 

3、安装grafana

#rpm -ivh grafana-5.1.2-1.x86_64.rpm

 

检查、修改grafana.ini配置

#vim /etc/grafana/grafana.ini

####################################

[server]

# Protocol (http, https, socket)

;protocol = http

 

# The ip address to bind to, empty will bind to all interfaces

;http_addr =

 

# The http port  to use

;http_port = 3000

 

# The public facing domain name used to access grafana from a browser

;domain = localhost

 

……

 

[security]

# default admin user, created on startup

;admin_user = admin

 

# default admin password, can be changed before first start of grafana,  or in profile settings

;admin_password = admin

 

……

 

 

启动grafana

#/usr/local/grafana/etc/init.d/grafana-server start

Starting Grafana Server: ...                               [  OK  ]

 

不同系统可能不一样,也可能是 /usr/sbin/grafana-server

 

或者

# service grafana-server start

 

# sudo /bin/systemctl start grafana-server.service

 

自家电脑上安装时发现会出现没法启动的情况,tail -f /var/log/grafana/grafana.log 发现error="open /var/run/grafana/grafana-server.pid: permission denied"错误

解决方法:

# cd/var/run/

# chmod 777grafana/

 

设置系统启动时,自动启动grafana

#chkconfig --add grafana-server

 

相关实践学习
通过可观测可视化Grafana版进行数据可视化展示与分析
使用可观测可视化Grafana版进行数据可视化展示与分析。
目录
相关文章
|
2月前
|
测试技术 API C#
C#使用Bogus生成测试数据
C#使用Bogus生成测试数据
39 1
|
2月前
|
存储 人工智能 自然语言处理
知识库优化增强,支持多种数据类型、多种检索策略、召回测试 | Botnow上新
Botnow近期对其知识库功能进行了全面升级,显著提升了数据处理能力、检索效率及准确性。新版本支持多样化的数据格式,包括PDF、Word、TXT、Excel和CSV等文件,无需额外转换即可直接导入,极大地丰富了知识来源。此外,还新增了细致的文本分片管理和编辑功能,以及表格数据的结构化处理,使知识管理更为精细化。 同时,平台提供了多种检索策略,包括混合检索、语义检索和全文检索等,可根据具体需求灵活选择,有效解决了大模型幻觉问题,增强了专业领域的知识覆盖,从而显著提高了回复的准确性。这些改进广泛适用于客服咨询、知识问答等多种应用场景,极大提升了用户体验和交互质量。
58 4
|
18天前
|
存储 监控 安全
在自动化测试环境中,如何确保测试数据的安全性和隐私性
在自动化测试环境中,如何确保测试数据的安全性和隐私性
|
2月前
【Application Insights】使用Powershell命令向Application Insgihts发送测试数据
【Application Insights】使用Powershell命令向Application Insgihts发送测试数据
|
2月前
|
JSON Kubernetes Linux
【Application Insights】使用CURL命令向Application Insgihts发送测试数据
【Application Insights】使用CURL命令向Application Insgihts发送测试数据
|
2月前
|
关系型数据库 MySQL Python
[python]使用faker库生成测试数据
[python]使用faker库生成测试数据
|
2月前
|
安全 数据安全/隐私保护 架构师
用Vaadin打造坚不可摧的企业级应用:安全性考虑全解析
【8月更文挑战第31天】韩林是某金融科技公司的架构师,负责构建安全的企业级应用。在众多Web框架中,他选择了简化UI设计并内置多项安全特性的Vaadin。韩林在其技术博客中分享了使用Vaadin时的安全考虑与实现方法,包括数据加密、SSL/TLS保护、结合Spring Security的用户认证、XSS防护、CSRF防御及事务性UI更新机制。他强调,虽然Vaadin提供了丰富的安全功能,但还需根据具体需求进行调整和增强。通过合理设计,可以构建高效且安全的企业级Web应用。
35 0
|
2月前
|
测试技术 数据库
确保数据访问层的可靠性:详细解析使用Entity Framework Core进行隔离的单元测试方法
【8月更文挑战第31天】在软件开发中,单元测试是确保代码质量的关键。本文通过一个在线商店的商品查询功能案例,介绍了如何使用EF Core和Moq框架实现数据访问层的隔离测试。通过模拟`ApplicationDbContext`,我们能够在不访问真实数据库的情况下对`ProductService`进行单元测试,提高测试效率并保证测试稳定性。这种方法是实现高效、可靠单元测试的重要手段。
36 0
|
2月前
|
Linux C#
【Azure App Service】C#下制作的网站,所有网页本地测试运行无误,发布至Azure之后,包含CHART(图表)的网页打开报错,错误消息为 Runtime Error: Server Error in '/' Application
【Azure App Service】C#下制作的网站,所有网页本地测试运行无误,发布至Azure之后,包含CHART(图表)的网页打开报错,错误消息为 Runtime Error: Server Error in '/' Application
|
3月前
|
机器学习/深度学习 运维 算法
Doping:使用精心设计的合成数据测试和评估异常检测器的技术
在这篇文章中,我们将探讨测试和评估异常检测器的问题(这是一个众所周知的难题),并提出了一种解决方案被称为“Doping”方法。使用Doping方法,真实数据行会被(通常是)随机修改,修改的方式是确保它们在某些方面可能成为异常值,这时应该被异常检测器检测到。然后通过评估检测器检测Doping记录的效果来评估这些检测器。
42 0
下一篇
无影云桌面