今日涉及的技术比较多,会将相关文章以列表的形式,在前置中显示 ,整体效果如下图
安装可视化平台,需要一些前置条件,如下表:
文章 | 链接 |
---|---|
docker linux离线环境安装 20.1.0.12 | 地址 |
JMeter压测接口 | 地址 |
JMeter高级使用-让你与众不同 | 地址 |
在线安装走下面路线,离线安装走此路线。
docker pull influxdb:1.8
启动 InfluxDB 的容器,并将端口 8083 和 8086 映射出来:
docker run -d --name influxdb -p 8086:8086 -p 8083:8083 influxdb:1.8
进入容器内部,创建名为 jmeter 的数据:
进入 jmeter-influx 容器
docker exec -it influxdb /bin/bash
[root@hadoop01 ~]# docker exec -it influxdb /bin/bash
root@bfb5c0cb29e9:/# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> create database jmeter
> show databases
name: databases
name
----
_internal
jmeter
> use jmeter
Using database jmeter
> select * from jmeter
jmeter 进行相关的配置,如对 jmeter 有疑问,请移步至 JMeter压测接口
对上图相关属性进行说明,如下:
运行 JMeter 脚本,然后再次在 influxdb 中查看数据,发现类似下面的数据,说明输入导入成功。
在线安装走下面路线,离线安装走此路线。
docker pull grafana/grafana
启动 Grafana
容器,将 3000
端口映射出来
docker run -d --name grafana -p 3000:3000 grafana/grafana
网页端访问 http://10.32.xx.142:3000
,验证部署成功。
模板导入分别有以下3种方式
下载地址
# 解压
mkdir /usr/local/soft
tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz -C /usr/local/soft/
# 启动
cd /usr/local/soft/node_exporter-0.18.1.linux-amd64
nohup ./node_exporter > node.log 2>&1 &
执行如下:
Last login: Thu Nov 2 13:07:44 2023 from 10.35.232.70
[root@hadoop04 ~]# mkdir /usr/local/soft
[root@hadoop04 ~]# tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz -C /usr/local/soft/
node_exporter-0.18.1.linux-amd64/
node_exporter-0.18.1.linux-amd64/node_exporter
node_exporter-0.18.1.linux-amd64/NOTICE
node_exporter-0.18.1.linux-amd64/LICENSE
[root@hadoop04 ~]# cd /usr/local/soft/node_exporter-0.18.1.linux-amd64
[root@hadoop04 node_exporter-0.18.1.linux-amd64]# nohup ./node_exporter > node.log 2>&1 &
[1] 9261
[root@hadoop04 node_exporter-0.18.1.linux-amd64]#
下载地址
# 解压
tar -zxvf prometheus-2.15.1.linux-amd64.tar.gz -C /usr/local/soft/
cd /usr/local/soft/prometheus-2.15.1.linux-amd64
# 运行
nohup ./prometheus > prometheus.log 2>&1 &
在 prometheus.yml 中加入如下配置:
scrape_configs:
# The job name is added as a label `job=` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['10.32.36.142:9090','10.32.36.143:9090','10.32.36.144:9090','10.32.36.145:9090']
[root@hadoop01 prometheus-2.15.1.linux-amd64]# netstat -nlp | grep 'prometheus'
[2]+ 完成 nohup ./prometheus > prometheus.log 2>&1
[root@hadoop01 prometheus-2.15.1.linux-amd64]# netstat -nlp | grep 'prometheus'
[root@hadoop01 prometheus-2.15.1.linux-amd64]# pwd
/usr/local/soft/prometheus-2.15.1.linux-amd64
[root@hadoop01 prometheus-2.15.1.linux-amd64]# ls
console_libraries consoles data LICENSE NOTICE prometheus prometheus.log prometheus.yml promtool tsdb
[root@hadoop01 prometheus-2.15.1.linux-amd64]# vi prometheus.yml
关于 grafana 安装出现的问题
能看到以前的数据,但不刷新,后来查看,linux 服务器时间与现实时间差了20多分钟,没办法,只能与现实时间同步一下。
搭建压测可视化平台-如何离线完成至此就完成了,如有问题,欢迎评论区留言。