influxdb 客户端工具_性能工具之Jmeter小白入门系列之六

05959d1a0afe4df593b6f4296226e78c.png

Jmeter + Grafana + InfluxDB 性能平台搭建

环境:Linux环境

centos 6

重启防火墙:service iptables rstart

查看状态:service iptabes status

关闭防火墙:service iptables stop

关闭防火墙(重启生效):chkconfig iptables  off(关闭)/on(开启)

 查看自启动状态列表  chkconfig  iptables --list 

centos7使用如下:

关闭防火墙:systemctl stop firewalld.service

查看状态:systemctl status firewalld.service

           绿的running表示防火墙开启

禁用防火墙(系统启动时不启动防火墙服务):systemctl disable firewalld

systemctl is-enabled firewalld

安装文件上传工具:

yum install -y lrzsz

62e5378e794e6634cfa828d70f52be86.png

上传:

grafana-4.5.2-1.x86_64.rpm、influxdb-1.2.2.x86_64.rpm

本机上传路径

108ce55c0bf37e9743c2e1c04f0850f9.png

提示:

151d160d4af7ee9feb3636787c110ea0.png

安装方法:

wget et https://dl.influxdata.com/influxdb/releases/influxdb-1.6.2.x86_64.rpmrpm -ivh influxdb-1.2.0.x86_64.rpm

76bc54732831a2af88fd4e50e101bc53.png

提示:

c376dbf27a2c808d8d4bdd56bbe0c9e3.png

执行命令:

[root@localhost ~]# rpm -ivh influxdb-1.2.2.x86_64.rpm Preparing...                          ################################# [100%]Updating / installing...   1:influxdb-1.2.2-1                 ################################# [100%]Created symlink from /etc/systemd/system/influxd.service to /usr/lib/systemd/system/influxdb.service.Created symlink from /etc/systemd/system/multi-user.target.wants/influxdb.service to /usr/lib/systemd/system/influxdb.service.

yum下载Grafana并且安装

https://grafana.com/docs/installation/rpm/yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.1-1.x86_64.rpm

结果:

34a41a2a0bd088f953b99b3febba84d7.png

提示:

[root@localhost ~]# rpm -ivh grafana-4.5.2-1.x86_64.rpm warning: grafana-4.5.2-1.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 24098cb6: NOKEYerror: Failed dependencies:        fontconfig is needed by grafana-4.5.2-1.x86_64        urw-fonts is needed by grafana-4.5.2-1.x86_64

9481079182a2ad58ac05d1dbd49c9c21.png

执行

[root@localhost ~]# yum install -y urw-fontsrpm -ivh grafana-4.5.2-1.x86_64.rpm

adbd143bea53ca0831be45916cc9b6f8.png

执行命令:

root@localhost ~]# rpm -ivh grafana-4.5.2-1.x86_64.rpm warning: grafana-4.5.2-1.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 24098cb6: NOKEYPreparing...                          ################################# [100%]Updating / installing...   1:grafana-4.5.2-1                  ################################# [100%]### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable grafana-server.service### You can start grafana-server by executing sudo /bin/systemctl start grafana-server.servicePOSTTRANS: Running script[root@localhost ~]#
InfluxDB的配置

主要配置jmeter存储的数据库与端口号,还有需要将UI端口开放

修改配置influxdb.conf
[root@localhost ~]# vi /etc/influxdb/influxdb.conf # 找到graphite并且修改它的库与端口[[graphite]]enabled = truebind-address = ":2003"database = "jmeter"retention-policy = ""protocol = "tcp"batch-size = 5000batch-pending = 10batch-timeout = "1s"consistency-level = "one"separator = "."udp-read-buffer = 0 

如图:

b9462331a60c4107943dd1bc5b6a11f0.png

修改配置

找到admin,将前面的#号去掉,开放它的UI端口

# 找到admin,将前面的#号去掉,开放它的UI端口[admin]  # Determines whether the admin service is enabled.  enabled = true  # The default bind address used by the admin service.  bind-address = ":8083"  # Whether the admin service should use HTTPS.  # https-enabled = false  # The SSL certificate used when HTTPS is enabled.  # https-certificate = "/etc/ssl/influxdb.pem

如图:

c84142d078e7e2ada303b975588f2147.png

保存并推出:【:wq】

a464b9e59edca113378c8b64d7b7c1bc.png

启动InfluxDB
[root@localhost ~]# /etc/init.d/influxdb restartStopping influxdb...influxdb process was stopped [ OK ]Starting influxdb...influxdb process was started [ OK ]

如图

cd9bbecbdbc2bfdbe9ac1a95d74ea703.png

centos7:启动方式

[root@localhost ~]# service influxd.service start                               Redirecting to /bin/systemctl start influxd.service  / systemctl restart influxd.service[root@localhost ~]#[root@localhost ~]# influxConnected to http://localhost:8086 version 1.2.2InfluxDB shell version: 1.2.2> exit##启动后TCP端口:8083 为InfluxDB 管理控制台##TCP端口:8086 为客户端和InfluxDB通信时的HTTP API
检查:端口是否启动[netstat -ntlp]

fe30f4dab5bfac69b44b595b6d067541.png

查看防火墙

9bf80f01df82550a33c3d445f66bc5d4.png

页面访问:

a12c1e19773635ba0eb488e19e75e3b4.png

创建数据库
CREATE DATABASE "jmeter"

10407b55ffbaecbe9da69a64a98711c2.png

创建成功提示:

99ead2324d3c3a1de24b75b7b16a8c18.png

验证数据数据

8f52827f5a00153b571b541dd6b4d983.png

启动Grafana
/etc/init.d/grafana-server restart

e053e3b167ab750985202874a9122105.png

centos7:

 service grafana-server start/ systemctl restart grafana-server

1a9d923a71f6c7e7cb2c783b986e7865.png

查看相关服务

[root@localhost ~]# ps -ef | grep grafanagrafana   1751     1  0 06:52 ?        00:00:00 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/pluginsroot      1786  1507  0 07:00 pts/0    00:00:00 grep --color=auto grafana[root@localhost ~]# ps -ef | grep influxdinfluxdb  1775     1  0 06:55 ?        00:00:00 /usr/bin/influxd -config /etc/influxdb/influxdb.confroot      1849  1507  0 07:00 pts/0    00:00:00 grep --color=auto influxd[root@localhost ~]#[root@localhost ~]# netstat -nlp | grep 1751tcp6       0      0 :::3000                 :::*                    LISTEN      1751/grafana-server [root@localhost ~]#

208e81c849d8962eca3dee02107b7ad6.png

通过进程查看端口:netstat -nlp | grep 1751

19b491a49f9cfc0f9cecb4f64a637fb1.png

验证  http://IP:3000/login

65ef15588b8d840406815699f58b6ba5.png

输入用户名,密码登录系统。用户名与密码都是"admin"

配置相关数据:

添加InfluxDB数据库配置。输入帐号密码“admin / admin”,点击Test & Save 提示“Success”说明成功了

【注意】URL的端口是8086,而刚才配置的8083UI的端口。

    - 8083端口是InfluxDB的UI界面展示的端口

    - 8086端口是Grafana用来从数据库取数据的端口

    - 2003端口则是刚刚设置的,Jmeter往数据库发数据的端口

2a3cd9c8da38ef2b58674b5b44857c02.png

配置连接成功

f78f000e6421effd2e5a7982bb9e1f36.png

配置:

选择导入模板

12531311585f817767c8c15667d60f2a.png

下载模板:

https://grafana.com/grafana/dashboards

e713a6cf46fae90007b0a170611f1b3f.png

或者选择:

ec0ed9ebf33f0f441d4d1ffaf8fc985a.png

下载模板

c19736ae5ce075685c6170636fd4e463.png

导入下载模板

333a3b92116853133454c6916b1fd4ae.png

选择数据源

bf754eb26e8e0526e789bc209512ec14.png

或者选择

ed57f5b9452a1b1fda3f24f31b39fbb1.png

显示成功:

11b9d340b09e32537ccdab6f6ae939b4.png

调试整个显示:

6f504c8960158be923607e67a451739f.png

相关说明:

线程数/用户相关指标
  1. test.minAT-Min active threads:最小活跃线程数

  2. test.maxAT-Max active threads:最大活跃线程数

  3. test.meanAT-Mean active threads:活跃线程数

  4. test.startedT-Started threads:启动线程数

  5. test.endedT-Finished threads:结束线程数

响应时间指标
  1. .ok.count:采样器的成功响应数

  2. .h.count:每秒点击数

  3. .ok.min:采样器成功最短响应时间

  4. .ok.max:采样器成功最长响应时间

  5. .ok.avg:采样器成功平均响应时间

  6. .ok.pct:采样器成功响应百分比

  7. .ko.count:采样器失败响应数

  8. .ko.min:采样器失败的响应最短时间

  9. .ko.max:采样称失败最长响应时间

  10. .ko.avg:采样器失败平均响应时间

  11. .ko.pct:采样器失败响应百分比

  12. .a.count:采样器响应数(ok.count和ko.count的总和)

  13. .a.min:采样器最小响应时间(ok.count和ko.count的最小值)

  14. .a.max:采样器最大响应时间(ok.count和ko.count的最大值)

  15. .a.avg:采样器平均响应时间(ok.count和ko.count的平均值)

  16. .a.pct:采样器响应百分比(根据和失败样本的总数计算)

Backend Listener的默认百分位设置为“90;95;99”,即百分位数为90%,95%和99%。

Graphite使用点(“.”)去拆分的元素,这可能与十进制百分位值混淆。JMeter转换任何此类值,用下划线(“ - ”)替换点(“.”)。例如,“99.9 ”变为“99_9 ”

默认情况下,JMeter发送在samplerName“all”下累计的所有采样器的指标。如果配置了 BackendListenerSamplersList,那么JMeter还会发送匹配样本名称的指标,前提是配置 summaryOnly=true

Jmeter参数文件设置:

创建线程组

01f9e00646e79494cba370cdc9c1f099.png

选择监听器backend Listener

【注意】如果要监控的话,Jmeter上的“Backend Listener”修改如下参数

1. 将“summanyOnly”修改成False,

2. 将“userRegexpForSamplersList”修改成True,

3. 并且要设置“samplersList”的值,“samplersList”是可以支持正则表达式的,“samplersList”的设置要与请求对应,否则找不到该请求。如图

828c0cc634fe2509ba0233e0db078f3a.png

influxdbMetricsSenderorg.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender
influxdbUrlhttp://192.168.7.129:8086/write?db=jmeter
applicationJmeter_test
measurementjmeter
summaryOnlyFALSE
samplersRegex^[^#_].*
percentiles50;90;95;99
testTitletest
eventTags

简单介绍:

名称描述

jmeter.all.h.count所有请求的TPS

jmeter..h.count对应的TPS

jmeter.all.ok.pct9999%的请求响应时间

jmeter..ok.pct99对应99%的请求响应时间

jmeter.all.test.startedT线程数

验证结果:

07e335f416dcea569b704ecdc60d44a1.png

实战数据显示

c66fd7d14d3676ab9be4cf67b415d939.png

实战数据

bbfb7a52ef63acae76db3bfae17291c2.png

4eb5007a891cea6ef47f8ac7db44b539.png

90f97e2c722a4364718a3a0450d598ff.png

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值