node_exporter
node_exporter是采集主机计数器用的,需要采集哪台主机的计数器,就在哪台主机上启动
- 下载解压
[root@VM_0_11_centos packages]# wget -c https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
[root@VM_0_11_centos packages]# tar zxvf prometheus-2.15.1.linux-amd64.tar.gz
- 启动
[root@VM_0_11_centos packages]# cd prometheus-2.15.1.linux-amd64
[root@VM_0_11_centos packages]# ./node_exporter &
- 查看帮助信息
./node_exporter --help
prometheus
收集主机(node_exporter)计数器,可以不用和node_exporter搭在一台机器
- 下载解压
[root@VM_0_11_centos packages]# wget -c https://github.com/prometheus/prometheus/releases/download/v2.15.1/prometheus-2.15.1.linux-amd64.tar.gz
[root@VM_0_11_centos packages]# tar zxvf prometheus-2.15.1.linux-amd64.tar.gz
- 配置
在prometheus.yml中加入如下配置:
- job_name: 'test98'
static_configs:
- targets: ['192.168.1.98:9100']
添加的是node_exporter
的启动机器和端口
- 启动
./prometheus &
- 查看帮助信息
./prometheus --help
启动之后访问http://192.168.1.99:19090/targets

grafana
grafana用于展示数据,有现成的模板
- docker安装
docker run -d --name=grafana -p 3000:3000 grafana/grafana
- rpm搭建
# yum localinstall grafana-6.5.2-1.x86_64.rpm
# /sbin/chkconfig --add grafana-server #配置开机启动
# systemctl daemon-reload #重载所有修改过的配置文件
# systemctl start grafana-server #启动grafana-server
# systemctl status grafana-server #查看状态
# sudo systemctl enable grafana-server.service #设置开机启动
- 配置数据源
点击Add data source



- 导入dashboard
点击manage-import。


输入dashboard id(8919)。点击load

展示

Jmeter数据输出到Grafana配置
docker搭建 influxdb
- influxdb安装
docker run -d -p 8086:8086 -p 8083:8083 --name=jmeterdb influxdb
- 进入容器内部
docker exec –it jmeterdb bash
- 进入influx,创建数据库
influx
create database jmeter;
Jmeter创建脚本
-
在JMeter中添加 Backend Listener 组件,⽤于收集数据并发送给influxdb
image.png
image.png
grafana从influxdb读取数据
- 添加数据源


- import Dashboard

输入模板ID或者导入json

网友评论