快速構建ceph可視化監控系統-轉載


前言

ceph的可視化方案不少,本篇介紹的是比較簡單的一種方式,而且對包都進行了二次封裝,因此可以在極短的時間內構建出一個可視化的監控系統web

本系統組件以下:json

  • ceph-jewel版本
  • ceph_exporter的jewel版本
  • prometheus的2.3.2版本
  • grafana的grafana-5.2.1版本
  • Ceph grafana的插件- Clusterby Cristian Calin

適配的系統爲centos7centos

資源以下:架構

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.rpmtcp

以上資源都可以直接用wget進行下載,而後直接安裝centos7

監控的架構介紹

經過ceph_exporter抓取的ceph相關的數據而且在本地監聽端口9128端口spa

prometheus抓取ceph_exporter的9128的端口的數據存儲在本地的/var/lib/prometheus/目錄下面插件

grafana抓取prometheus的數據進行渲染成web頁面code

頁面的模板就是使用的grafana的ceph模板插件server

那麼咱們就根據上面的架構去一步步的把系統配置起來

配置監控系統

安裝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文件弄到本地去,導入進去便可

到這裏就完成了配置了

總結

以上爲了方便都把相關的軟件作成了rpm包,從安裝方便角度來看,grafana,ceph_exporter,還有prometheus都採用的是單二進制文件的方式,稍微組合一下大大的下降了部署難度,好比那個ceph_exporter須要用go進行編譯,封好包之後就不須要這個過程,而且接口由於有版本的限制,因此這樣直接對應版本安裝也避免了出錯

本篇的環境所述均爲jewel適配版本

相關文章
相關標籤/搜索