Prometheus+Grafana

231 阅读1分钟

step1 : 安装并配置node_exporter 参考

node_exporter:想要获取一台服务器的运行参数,比如当前的cpu负载,系统负载,内存消耗,硬盘使用量,网络io等,就可以在服务器上运行一个node_exporter,它可以将以上参数收集好,暴露一个接口去查询

cd /opt
wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
tar -zxvf node_exporter-0.17.0.linux-amd64.tar.gz
./node_exporter

运行后,返回如下界面:

image.png

step2 :访问

host:9100

image.png

点击metrics

image.png

配置安装Prometheus 参考

image.png

下载

启动服务

./prometheus --config.file=/opt/prometheus-2.26.0.linux-amd64/prometheus.yml &

vim prometheus.yml

配置普罗米修斯job及instance

image.png

配置完成后需要重启

重启普罗米修斯 [root@11111 ~]# pkill prometheus

[root@11111 ~]# cd /Prometheus/

./prometheus --config.file=/opt/prometheus-2.26.0.linux-amd64/prometheus.yml &

浏览器访问

http://host:9090/

进入target,查看目前启动的服务

image.png

image.png

grafana中添加普罗米修斯数据源

image.png

使用一个现有模板

image.png

image.png