背景
在無界面壓測情況下,我們需要去額外搭建可視化觀測平臺。借助于Influxdb+Grafana,我們可以輕松讓Jmeter的結(jié)果自動寫入Influxdb,Influxdb實時存儲運行結(jié)果,最后由Grafana作為展示
Jmeter
無界面運行需要修改配置(jmeter.properties)
- jmeter.save.saveservice.response_data=true
- jmeter.save.saveservice.output_format=csv
- jmeter.save.saveservice.samplerData=true
注:如果jmeter運行內(nèi)存過大導致卡死,可以修改jmeter.bat文件,把內(nèi)存改大
if not defined HEAP ( rem See the unix startup file for the rationale of the following parameters, rem including some tuning recommendations set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m )
無界面運行命令
- -n 無界面壓測
- -t 指定jmx腳本
- -l 生成jtl測試報告,后面跟隨目標路徑
- -e -o 直接生成報告html報告,后面跟隨目標路徑
jmeter -n -t <jmx腳本> -l <路徑>
?腳本制作需要最后添加后端監(jiān)聽器
?文章來源地址http://www.zghlxwxcb.cn/news/detail-837738.html
Influxdb
下載地址:https://www.influxdata.com/downloads/
通過上述地址找到對應版本,通常我們下載v1.8版本就夠用了,我用的是windows版本安裝的https://dl.influxdata.com/influxdb/releases/influxdb-1.8.10_windows_amd64.zip
?修改配置:
默認配置是#bind-address = "127.0.0.1"是用來監(jiān)聽本機的,意味著他只會和本機通信。如果Influxdb和Jmeter在同一機器上則無需修改。如果涉及分布式壓測則一定需要修改下方配置
# bind-address = "0.0.0.0:8088"
把可寫入置為true,數(shù)據(jù)庫名設置為jmeter
[[graphite]] # Determines whether the graphite endpoint is enabled. # enabled = true # database = "jmeter"
?啟動服務:
安裝地址cmd進入
輸入命令啟動服務
influxd --config influxdb.conf
?頁面如上圖所示,說明服務啟動成功
新開一個命令行工具
輸入命令登陸啟動的服務器
influx
?創(chuàng)建對應的數(shù)據(jù)庫(上面配置)的名字Jmeter
#查看對應庫是否存在
show databases
#創(chuàng)建對應庫
create database jmeter
?
Grafana
下載地址:https://grafana.com/grafana/download
配置data sources
?還需要添加一下數(shù)據(jù)庫的賬號密碼和庫名
?配置模版
使用官方模版:https://grafana.com/grafana/dashboards/
搜索對應模版
?copy模版ID
?黏貼對應的ID
?成功展示效果
文章來源:http://www.zghlxwxcb.cn/news/detail-837738.html
?
到了這里,關(guān)于Jmeter+Influxdb+Grafana搭建的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!