Centos7.7搭建Prometheus2.0+Grafana监控Docker容器

一.下载所有安装包

1.> 下载go语言包(其他服务器都要安装go语言包)

https://golang.org/dl/

2.> 下载Prometheus安装包

https://prometheus.io/download/#prometheus

3.> 下载Grafana安装包

https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm

4.> 下载node_exporter安装包(其他服务器也要安装node_exporter)

https://prometheus.io/download/

二.搭建

1.> 解压go安装包,然后编辑/etc/profile文件

tar -zxf go..........
vim /etc/profile
#添加环境变量
export PATH=$PATH:/usr/local/go/bin  #go安装包的路径
#退出并保存,输入go version是否能输出版本
go version go1.8.3 linux/amd64

2.>解压prometheus安装包

tar -zxf prometheus....... -C /usr/local/
#做软连接
ln -sv /usr/local/prometheus-2.3.2.linux-amd64/ /usr/local/Prometheus
#配置prometheus.yml文件

 #启动prometheus监控

cd /usr/local/Prometheus/prometheus-2.3.2.linux-amd64/
./prometheus

3.>访问web

192.168.33.9:9090/targets

三.给prometheus更换面板

1.>解压已下载的Grafana安装包

tar -zxf Grafana........ -C /usr/local/

2.>安装已解压的rpm包

rpm -ivh Grafana...rpm

3.>把grafana加入到系统服务,将服务启动

/sbin/chkconfig --add grafana-server
service grafana-server start

4.> 访问web

192.168.33.9:3000
# 初始账号密码都是admin,第一次登陆必须要更改密码

5.>添加仪表盘

然后点击add datasource,选中 Prometheus 2.0 Stats后,就可以呈现如下的监控面板了

猜你喜欢

转载自www.cnblogs.com/lfl17718347843/p/12313100.html