快速构建ceph可视化监控系统(在任意mon节点安装)
前言
ceph的可视化方案很多,本篇介绍的是比较简单的一种方式,并且对包都进行了二次封装,所以能够在极短的时间内构建出一个可视化的监控系统
本系统组件如下:
资源如下:
http://static.zybuluo.com/zphj1987/jiwx305b8q1hwc5uulo0z7ft/ceph_exporter-2.0.0-1.x86_64.rpm
http://static.zybuluo.com/zphj1987/7ro7up6r03kx52rkwy1qjuwm/prometheus-2.3.2-1.x86_64.rpm
https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.1-1.x86_64.rpm
http://static.zybuluo.com/zphj1987/1nu2k4cpcery94q2re3u6s1t/ceph-cluster_rev1.json
以上资源均可以直接用wget进行下载,然后直接安装(本地源中tools目录也有 可以直接下载)
监控的架构介绍
通过ceph_exporter抓取的ceph相关的数据并且在本地监听端口9128端口
prometheus抓取ceph_exporter的9128的端口的数据存储在本地的/var/lib/prometheus/目录下面
grafana抓取prometheus的数据进行渲染成web页面
页面的模板就是使用的grafana的ceph模板插件
那么我们就根据上面的架构去一步步的把系统配置起来
配置监控系统
安装ceph_exporter
[root@ceph-node2 ~]# ls
ceph_exporter-2.0.0-1.x86_64.rpm grafana-5.3.0-1.x86_64.rpm prometheus-2.3.2-1.x86_64.rpm
[root@ceph-node2 ~]# rpm -qpl ceph_exporter-2.0.0-1.x86_64.rpm
/usr/bin/ceph_exporter
/usr/lib/systemd/system/ceph_exporter.service
[root@ceph-node2 ~]# rpm -ivh ceph_exporter-2.0.0-1.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:ceph_exporter-2:2.0.0-1 ################################# [100%]
[root@ceph-node2 ~]# systemctl start ceph_exporter
[root@ceph-node2 ~]# systemctl enable ceph_exporter
[root@ceph-node2 ~]# netstat -utpln |grep 9128
tcp6 0 0 :::9128 :::* LISTEN 30641/ceph_exporter
可以看到端口起来了就是安装成功了,这个ceph_exporter建议是安装在管理节点上,也就是能够执行出ceph -s的节点上面的
安装prometheus
[root@ceph-node2 ~]# rpm -qpl prometheus-2.3.2-1.x86_64.rpm
/etc/ceph/prometheus.yml
/usr/bin/prometheus
/usr/lib/systemd/system/prometheus.service
[root@ceph-node2 ~]# rpm -ivh prometheus-2.3.2-1.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:prometheus-2:2.3.2-1 ################################# [100%]
[root@ceph-node2 ~]# systemctl start prometheus
[root@ceph-node2 ~]# netstat -utpln |grep 9090
tcp6 0 0 :::9090 :::* LISTEN 30750/prometheus
这个地方默认是认为prometheus和ceph_exporter在一台机器上面,所以配置文件的/etc/ceph/prometheus.yml里面的targets写的是127.0.0.1,如果不同机器,需要修改成exporter ip地址
prometheus的默认监听端口为9090,到这个时候直接去web 上面就可以看到prometheus的抓取的数据了
到这里是数据到prometheus的已经完成了,下面就去做跟grafana相关的配置了
安装grafana
[root@ceph-node2 ~]# yum localinstall grafana-5.3.0-1.x86_64.rpm
[root@ceph-node2 ~]# systemctl start grafana-server.service
[root@ceph-node2 ~]# netstat -tunlp|grep gra
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::3000 :::* LISTEN 31164/grafana-serve
grafana默认监听的3000的端口
默认登陆的用户名密码为admin admin,登陆成功后会强制修改密码
配置grafana
这里如果能上网就直接输入id 917 ,如果不能上网就把上面的ceph-cluster_rev1.json文件弄到本地去,导入进去即可