1、安裝docker-compose
第一步:sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
第二步:sudo chmod +x /usr/local/bin/docker-compose
第三步:docker-compose --version
2、克隆 gitee上的文件(具體的文件已經(jīng)上傳到自己的git倉(cāng)庫(kù)榜跌,可以直接從https://gitee.com/xcjcode/docker-prometheus.git 處下載)
注意:環(huán)境可能沒(méi)有安裝git,可通過(guò)yum install git 進(jìn)行安裝
第一步:cd /opt
第二步:mkdir data
第三步:cd data/
第四步:git clone https://gitee.com/xcjcode/docker-prometheus-andinfluxdb-andgrafana.git
3、防火墻開(kāi)通對(duì)應(yīng)的端口
第一步:
prometheus端口9090:firewall-cmd --zone=public --add-port=9090/tcp --permanent
influxdb端口8086:firewall-cmd --zone=public --add-port=8086/tcp --permanent
alertmanager端口9093:firewall-cmd --zone=public --add-port=9093/tcp --permanent
cadvisor端口8080:firewall-cmd --zone=public --add-port=8080/tcp --permanent
node_exporter端口9100:firewall-cmd --zone=public --add-port=9100/tcp --permanent
grafana端口3000:firewall-cmd --zone=public --add-port=3000/tcp --permanent
第二步:重啟防火墻
systemctl restart firewalld.service
4重虑、進(jìn)入/opt/data/docker-prometheus-andinfluxdb-andgrafana目錄,通過(guò)docker-compose命令啟動(dòng)容器秦士,出現(xiàn)以下界面嚎尤,則表示啟動(dòng)容器成功
第一步:cd /opt/data/docker-prometheus-andinfluxdb-andgrafana/
第二步:docker-compose up -d
image.png
5、關(guān)閉防火墻伍宦,主要防止客戶端訪問(wèn)失敗
systemctl stop firewalld
6芽死、驗(yàn)證是否安裝成功
(1)、登錄prometheus:http://192.168.247.132:9090/
(2)次洼、登錄Alertmanager:http://192.168.247.132:9093/
(3)关贵、登錄node-exporter:http://192.168.247.132:9100/metrics
(4)、登錄grafana:http://192.168.247.132:3000/login(賬號(hào)密碼默認(rèn)都是admin)
7卖毁、配置influxdb數(shù)據(jù)庫(kù)
(1):進(jìn)入influxdb容器:docker exec -it influxdb bash
(2):輸入influx命令揖曾,進(jìn)入到客戶端和influxdb的交互模式
(3):在交互模式中輸入:show databases; 可以查看現(xiàn)有的數(shù)據(jù)庫(kù)
(4):在交互模式中輸入:create database jmeter 創(chuàng)建一個(gè)jmeter數(shù)據(jù)庫(kù)
(5):在交互模式中輸入:use jmeter 切換到j(luò)meter數(shù)據(jù)庫(kù)
(6):在交互模式中輸入:show measurements 查看當(dāng)前數(shù)據(jù)庫(kù)中的表
8、grafana配置數(shù)據(jù)源
prometheus數(shù)據(jù)源配置.png
influxdb數(shù)據(jù)源配置.png
9亥啦、配置面板
image.png
image.png
在這個(gè)地方找到需要的模板https://grafana.com/grafana/dashboards/5496-apache-jmeter-dashboard-by-ubikloadpack/
image.png
image.png
image.png
10炭剪、jmeter后端監(jiān)視器配置
image.png