grafana + prometheus + node_exporter搭建监控平台
grafana + prometheus + node_exporter
- 背景:在性能测试中,监控硬件服务器资源利用是必备的
 - grafana:专门用于数据展示的前端平台,通过浏览器来访问
 - prometheus: 时序数据库, 存储数据的
 - node_exporter: 收集数据(收集监控数据、收集linux系统资源利用数据)
 
安装grafana
- 官网:https://grafana.com/grafana/download?pg=graf-deployment-options&plcmt=deploy-box-1
 - 选择相应的版本,以及linux的类型,centos为例:
 - wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.0.3-1.x86_64.rpm
 - sudo yum install grafana-enterprise-9.0.3-1.x86_64.rpm
 - 或者直接安装压缩包:
yum install grafana-7.4.3-1.x86_64.rpm -y - 注意:**7.4版本prometheus数据源展示有问题,要安装8以上的版本,但是8以上的版本必须要非Google浏览器打开,也是无语
 - 7、启动:systemctl restart grafana-server
 - 8、配置:
 - 访问grafana: http://grafana-server-ip:3000 admin admin
 
安装prometheus
- 开源,直接解压就可以使用
 - tar.gz包,解压,然后启动 ./prometheus
 - 默认端口: 9090 http://prometheus_ip:9090
 
- 安装node_exporter------安装在被测服务器上
 - 解压tar.gz包   然后启动 
./node_exporter - 默认端口:9100 http://node_exporter_ip:9100
 
配置prometheus + node_exporter结合
修改prometheus配置文件: prometheus.yml
- job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090']
- grafana 中配置展示Prometheus中的数据
 - 登录
 - add data source 选择 prometheus
 - URL: http://prometheus_ip:9090
 - import 模板
 
正文到此结束