influxdb 客户端工具_性能工具之Jmeter小白入门系列之六
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上傳:
grafana-4.5.2-1.x86_64.rpm、influxdb-1.2.2.x86_64.rpm本機上傳路徑
提示:
安裝方法:
wget et https://dl.influxdata.com/influxdb/releases/influxdb-1.6.2.x86_64.rpmrpm -ivh influxdb-1.2.0.x86_64.rpm提示:
執行命令:
[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結果:
提示:
[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執行
[root@localhost?~]#?yum?install?-y?urw-fontsrpm?-ivh?grafana-4.5.2-1.x86_64.rpm執行命令:
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如圖:
修改配置
找到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如圖:
保存并推出:【:wq】
啟動InfluxDB
[root@localhost ~]# /etc/init.d/influxdb restartStopping influxdb...influxdb process was stopped [ OK ]Starting influxdb...influxdb process was started [ OK ]如圖
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]
查看防火墻
頁面訪問:
創建數據庫
CREATE DATABASE "jmeter"創建成功提示:
驗證數據數據
啟動Grafana
/etc/init.d/grafana-server restartcentos7:
service grafana-server start/ systemctl restart grafana-server查看相關服務
[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 ~]#通過進程查看端口:netstat -nlp | grep 1751
驗證 ?http://IP:3000/login
輸入用戶名,密碼登錄系統。用戶名與密碼都是"admin"
配置相關數據:
添加InfluxDB數據庫配置。輸入帳號密碼“admin / admin”,點擊Test & Save 提示“Success”說明成功了
【注意】URL的端口是8086,而剛才配置的8083是UI的端口。
??? - 8083端口是InfluxDB的UI界面展示的端口
??? - 8086端口是Grafana用來從數據庫取數據的端口
??? - 2003端口則是剛剛設置的,Jmeter往數據庫發數據的端口
配置連接成功
配置:
選擇導入模板
下載模板:
https://grafana.com/grafana/dashboards
或者選擇:
下載模板
導入下載模板
選擇數據源
或者選擇
顯示成功:
調試整個顯示:
相關說明:
線程數/用戶相關指標
test.minAT-Min active threads:最小活躍線程數
test.maxAT-Max active threads:最大活躍線程數
test.meanAT-Mean active threads:活躍線程數
test.startedT-Started threads:啟動線程數
test.endedT-Finished threads:結束線程數
響應時間指標
.ok.count:采樣器的成功響應數
.h.count:每秒點擊數
.ok.min:采樣器成功最短響應時間
.ok.max:采樣器成功最長響應時間
.ok.avg:采樣器成功平均響應時間
.ok.pct:采樣器成功響應百分比
.ko.count:采樣器失敗響應數
.ko.min:采樣器失敗的響應最短時間
.ko.max:采樣稱失敗最長響應時間
.ko.avg:采樣器失敗平均響應時間
.ko.pct:采樣器失敗響應百分比
.a.count:采樣器響應數(ok.count和ko.count的總和)
.a.min:采樣器最小響應時間(ok.count和ko.count的最小值)
.a.max:采樣器最大響應時間(ok.count和ko.count的最大值)
.a.avg:采樣器平均響應時間(ok.count和ko.count的平均值)
.a.pct:采樣器響應百分比(根據和失敗樣本的總數計算)
Backend Listener的默認百分位設置為“90;95;99”,即百分位數為90%,95%和99%。
Graphite使用點(“.”)去拆分的元素,這可能與十進制百分位值混淆。JMeter轉換任何此類值,用下劃線(“ - ”)替換點(“.”)。例如,“99.9 ”變為“99_9 ”
默認情況下,JMeter發送在samplerName“all”下累計的所有采樣器的指標。如果配置了 BackendListenerSamplersList,那么JMeter還會發送匹配樣本名稱的指標,前提是配置 summaryOnly=true
Jmeter參數文件設置:
創建線程組
選擇監聽器backend Listener
【注意】如果要監控的話,Jmeter上的“Backend Listener”修改如下參數
1. 將“summanyOnly”修改成False,
2. 將“userRegexpForSamplersList”修改成True,
3. 并且要設置“samplersList”的值,“samplersList”是可以支持正則表達式的,“samplersList”的設置要與請求對應,否則找不到該請求。如圖
| influxdbMetricsSender | org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender |
| influxdbUrl | http://192.168.7.129:8086/write?db=jmeter |
| application | Jmeter_test |
| measurement | jmeter |
| summaryOnly | FALSE |
| samplersRegex | ^[^#_].* |
| percentiles | 50;90;95;99 |
| testTitle | test |
| eventTags |
簡單介紹:
名稱描述
jmeter.all.h.count所有請求的TPS
jmeter..h.count對應的TPS
jmeter.all.ok.pct9999%的請求響應時間
jmeter..ok.pct99對應99%的請求響應時間
jmeter.all.test.startedT線程數
驗證結果:
實戰數據顯示
實戰數據
總結
以上是生活随笔為你收集整理的influxdb 客户端工具_性能工具之Jmeter小白入门系列之六的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 风险变异系数
- 下一篇: 添加vlan后无法上网_VLAN攻击如何