服务器端 性能数据监控
2020-09-18 本文已影响0人
bonnie_xing
说在前面:接着上一条 locust实现压力测试 测试报告 性能监控平台
在实现了TPS和RT监控之后,现在需要对系统的数据进行监控。
一下介绍将再上一条基础上。继续使用Prometheus、Grafana进行数据收集和展示
效果图
先来一个搭建好之后的效果图

实现方式
一、修改Prometheus的配置文件
增加 node-exporter 的数据收集
该文件存储在了对应的性能测试脚本下:
/home/ops/bonnie/load_test_0806/prometheus.yml
global:
scrape_interval: 10s
evaluation_interval: 10s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['host.docker.internal:9090']
labels:
instance: prometheus
- job_name: locust
metrics_path: '/export/prometheus'
static_configs:
- targets: ['172.28.249.182:8089']
labels:
instance: locust
- job_name: 'server'
static_configs:
- targets: ['172.17.0.1:9100']
labels:
instance: server
二、运行启动 node-exporter,进行数据上报
docker run -itd --name=node-exporter -p 9100:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" --restart=always prom/node-exporter
三、重启Prometheus
找到正在运行的Prometheus的docker
重新启动
docker ps -a
docker restart d945c8a3773e

四、配置Grafana模板
直接选择现有的模板即可

参考链接
https://blog.csdn.net/catoop/article/details/103992643
https://segmentfault.com/a/1190000022547814