前言
ceph的可視化方案很多,本篇介紹的是比較簡單的一種方式,并且對包都進行了二次封裝,是以能夠在極短的時間内建構出一個可視化的監控系統
本系統元件如下:
- ceph-jewel版本
- ceph_exporter的jewel版本
- prometheus的2.3.2版本
- grafana的grafana-5.2.1版本
- Ceph grafana的插件- Clusterby Cristian Calin
适配的系統為centos7
資源如下:
http://static.zybuluo.com/zphj1987/jiwx305b8q1hwc5uulo0z7ft/ceph_exporter-2.0.0-1.x86_64.rpm
http://static.zybuluo.com/zphj1987/1nu2k4cpcery94q2re3u6s1t/ceph-cluster_rev1.json
http://static.zybuluo.com/zphj1987/7ro7up6r03kx52rkwy1qjuwm/prometheus-2.3.2-1.x86_64.rpm
http://mysrc.cn-bj.ufileos.com/grafana-5.2.1-1.x86_64.rpm
以上資源均可以直接用wget進行下載下傳,然後直接安裝
監控的架構介紹
通過ceph_exporter抓取的ceph相關的資料并且在本地監聽端口9128端口
prometheus抓取ceph_exporter的9128的端口的資料存儲在本地的/var/lib/prometheus/目錄下面
grafana抓取prometheus的資料進行渲染成web頁面
頁面的模闆就是使用的grafana的ceph模闆插件
那麼我們就根據上面的架構去一步步的把系統配置起來
配置監控系統
安裝ceph_exporter
[root@lab101 install]# wget http://static.zybuluo.com/zphj1987/jiwx305b8q1hwc5uulo0z7ft/ceph_exporter-2.0.0-1.x86_64.rpm
[root@lab101 install]# rpm -qpl ceph_exporter-2.0.0-1.x86_64.rpm
/usr/bin/ceph_exporter
/usr/lib/systemd/system/ceph_exporter.service
[root@lab101 install]# rpm -ivh ceph_exporter-2.0.0-1.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:ceph_exporter-2:2.0.0-1 ################################# [100%]
[root@lab101 install]# systemctl start ceph_exporter
[root@lab101 install]# systemctl enable ceph_exporter
[root@lab101 install]# netstat -tunlp|grep 9128
tcp6 0 0 :::9128 :::* LISTEN 35853/ceph_exporter
可以看到端口起來了就是安裝成功了,這個ceph_exporter建議是安裝在管理節點上,也就是能夠執行出ceph -s的節點上面的
安裝prometheus
[root@lab101 install]# wget http://static.zybuluo.com/zphj1987/7ro7up6r03kx52rkwy1qjuwm/prometheus-2.3.2-1.x86_64.rpm
[root@lab101 install]# rpm -qpl prometheus-2.3.2-1.x86_64.rpm
/etc/ceph/prometheus.yml
/usr/bin/prometheus
/usr/lib/systemd/system/prometheus.service
[root@lab101 install]# rpm -ivh prometheus-2.3.2-1.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:prometheus-2:2.3.2-1 ################################# [100%]
[root@lab101 install]# systemctl start prometheus
[root@lab101 install]# netstat -tunlp|grep 9090
tcp6 0 0 :::9090 :::* LISTEN 36163/prometheus
這個地方預設是認為prometheus和ceph_exporter在一台機器上面,是以配置檔案的/etc/ceph/prometheus.yml裡面的targets寫的是127.0.0.1,根據需要修改成ceph_exporter的ip位址即可
prometheus的預設監聽端口為9090,到這個時候直接去web 上面就可以看到prometheus的抓取的資料了

到這裡是資料到prometheus的已經完成了,下面就去做跟grafana相關的配置了
安裝grafana
[root@lab101 install]# wget http://mysrc.cn-bj.ufileos.com/grafana-5.2.1-1.x86_64.rpm
[root@lab101 install]# yum localinstall grafana-5.2.1-1.x86_64.rpm
[root@lab101 install]# systemctl start grafana-server.service
[root@lab101 install]# netstat -tunlp|grep gra
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::3000 :::* LISTEN 36730/grafana-serve
grafana預設監聽的3000的端口
預設登陸的使用者名密碼為admin admin,登陸成功後會強制修改密碼
配置grafana
首先增加資料源
這裡如果能上網就直接輸入id 917 ,如果不能上網就把上面的ceph-cluster_rev1.json檔案弄到本地去,導入進去即可
總結
變更記錄
Why | Who | When |
---|---|---|
建立 | 武漢-運維-磨渣 | 2018-07-17 |