目錄:
1、Ceph Dashboard的部署
2、在k8s中建立有狀態prometheus及Grafana監控Ceph集羣狀態node
Ceph 的監控可視化界面方案不少----grafana、Kraken。可是從Luminous開始,Ceph 提供了原生的Dashboard功能,經過Dashboard能夠獲取Ceph集羣的各類基本狀態信息。
mimic版 (nautilus版) dashboard 安裝。若是是 (nautilus版) 須要安裝 ceph-mgr-dashboard ios
一、在每一個mgr節點安裝,儘可能保證在每一個節點都安裝dashboard由於當一個節點掛了的話,去訪問其餘的節點,其餘的節點沒有這個dashboard的話就訪問不到了瀏覽器
#yum -y install ceph-mgr-dashboard #ceph mgr module ls |more { "enabled_modules": [ "dashboard", "iostat", "restful" ], "disabled_modules": [ { "name": "ansible", "can_run": true,
二、開啓mgr功能#ceph mgr module enable dashboard
restful
開啓以後能夠查看咱們的開啓的模塊
也能夠經過ceph -s查看集羣狀態
這裏會列出顯示的services,這裏顯示mgr安裝在三個節點上curl
#ceph -s cluster: id: 75aade75-8a3a-47d5-ae44-ec3a84394033 health: HEALTH_OK services: mon: 3 daemons, quorum cephnode01,cephnode02,cephnode03 (age 34m) mgr: cephnode01(active, since 5m), standbys: cephnode02, cephnode03 mds: cephfs:2 {0=cephnode02=up:active,1=cephnode03=up:active} 1 up:standby osd: 3 osds: 3 up (since 47m), 3 in (since 23h) rgw: 1 daemon active (cephnode01)
三、生成並安裝自簽名的證書tcp
#ceph dashboard create-self-signed-cert
四、建立一個dashboard登陸用戶名密碼ide
#ceph dashboard ac-user-create guest 1a2s3d4f administrator {"username": "guest", "lastUpdate": 1583304693, "name": null, "roles": ["administrator"], "password": "$2b$12$RgzO9RZzWWCYVcPSs3ACXO5dClSJH1gLh3QAc6GlaDQbhzKKHAXFC", "email": null}
五、查看服務訪問方式測試
#ceph mgr services { "dashboard": "https://cephnode01:8443/" }
六、登陸頁面ui
七、登陸ceph-dashboard的管理頁面
關於建立訪問ui的用戶基於權限的設置,包含管理員,只讀,塊的管理者,cephfs的管理者均可以去建立url
這裏我是用k8s將prometheus和grafana部署起來的,這裏就再也不將部署細節進行展現了,以前寫過這類的文檔,另外就是咱們首先是去拿ceph的數據,怎麼去拿呢?要就須要ceph提供的自己的mgr的模塊對prometheus開啓。
這裏在k8s中部署prometheus的文檔:http://www.javashuo.com/article/p-fwrlpmgx-dt.html
把這行獲取收集ceph數據的模版加入configmap文件中
- job_name: 'ceph_cluster' honor_labels: true scrape_interval: 5s static_configs: - targets: ['192.168.1.5:9283'] labels: instance: ceph
部署完查看目前是沒有獲取到ceph的數據的,由於咱們如今尚未拿到數據
4、ceph mgr prometheus插件配置
這裏去獲取ceph的數據的方式有不少種,好比使用ceph-exporter是採集ceph集羣數據的客戶端程序運的,在nautilus版本中能夠直接開啓這個進程,開啓以後就會自動的將數據拿到,而後經過prometheus進行收集起來,再經過grafana將ceph的圖形展現出來
這個在ceph管理節點開啓
# ceph mgr module enable prometheus # netstat -nltp | grep mgr 檢查端口 tcp 0 0 0.0.0.0:6800 0.0.0.0:* LISTEN 10311/ceph-mgr tcp 0 0 0.0.0.0:6801 0.0.0.0:* LISTEN 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45594 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.11:51040 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.11:51044 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45602 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45600 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.11:51042 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.12:60668 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.12:60666 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:45600 192.168.1.10:6800 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.11:51038 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.12:60670 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:33400 192.168.1.10:3300 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45598 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45596 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.12:60672 ESTABLISHED 10311/ceph-mgr tcp 0 0 192.168.1.10:6800 192.168.1.10:45592 ESTABLISHED 10311/ceph-mgr tcp6 0 0 :::9283 :::* LISTEN 10311/ceph-mgr tcp6 0 0 192.168.1.10:9283 192.168.1.15:22202 ESTABLISHED 10311/ceph-mgr # curl 192.168.1.10:9283/metrics 測試返回值
查看數據已經被prometheus收集到,並顯示爲UP狀態
1)、瀏覽器登陸 grafana 管理界面
2)、添加data sources,點擊configuration--》data sources
3)、grafana官方提供了不少的模版
https://grafana.com/grafana/dashboards
4)、搜索ceph的dashboard ,這裏我選擇的是2842這個模版,這個主要是監控集羣
5.一、監控Ceph-cluster集羣
五、import導入
這樣就監控到咱們的ceph集羣的狀態了,並能夠看到ceph的pools、OSD等相關數據
5.二、監控OSD,模版編號5336
5.三、監控POOLS ,監控模版編號5342
import導入模版