目录:
一, Ceph Dashboard 的部署
二, 在 k8s 中创建有状态 prometheus 及 Grafana 监控 Ceph 集群状态
一, Ceph Dashboard 介绍
Ceph 的监控可视化界面方案很多 ----grafana,Kraken. 但是从 Luminous 开始, Ceph 提供了原生的 Dashboard 功能, 通过 Dashboard 可以获取 Ceph 集群的各种基本状态信息.
mimic 版 (nautilus 版) dashboard 安装. 如果是 (nautilus 版) 需要安装 ceph-mgr-dashboard
二, 配置 Ceph Dashboard
1, 在每个 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,
2, 开启 mgr 功能
#ceph mgr module enable dashboard
开启之后可以查看我们的开启的模块
也可以通过 ceph -s 查看集群状态
这里会列出显示的 services, 这里显示 mgr 安装在三个节点上
- #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)
3, 生成并安装自签名的证书
#ceph dashboard create-self-signed-cert
4, 创建一个 dashboard 登录用户名密码
- #ceph dashboard ac-user-create guest 1a2s3d4f administrator
- {
- "username": "guest", "lastUpdate": 1583304693, "name": null, "roles": ["administrator"], "password": "$2b$12$RgzO9RZzWWCYVcPSs3ACXO5dClSJH1gLh3QAc6GlaDQbhzKKHAXFC", "email": null
- }
5, 查看服务访问方式
- #ceph mgr services
- {
- "dashboard": "https://cephnode01:8443/"
- }
6, 登录页面
7, 登录 ceph-dashboard 的管理页面
关于创建访问 ui 的用户基于权限的设置, 包含管理员, 只读, 块的管理者, cephfs 的管理者都可以去创建
三, 在 k8s 中使用 Grafana 以及 prometheus 监控 Ceph 集群
这里我是用 k8s 将 prometheus 和 grafana 部署起来的, 这里就不再将部署细节进行展示了, 之前写过这类的文档, 另外就是我们首先是去拿 ceph 的数据, 怎么去拿呢? 要就需要 ceph 提供的本身的 mgr 的模块对 prometheus 开启.
这里在 k8s 中部署 prometheus 的文档: https://blog.51cto.com/14143894/2438026
把这行获取收集 ceph 数据的模版加入 configmap 文件中
- - job_name: 'ceph_cluster'
- honor_labels: true
- scrape_interval: 5s
- static_configs:
- - targets: ['192.168.1.5:9283']
- labels:
- instance: ceph
部署完查看目前是没有获取到 ceph 的数据的, 因为我们现在还没有拿到数据
四, 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 状态
五, 配置 grafana
1), 浏览器登录 grafana 管理界面
2), 添加 data sources, 点击 configuration--》data sources
3),grafana 官方提供了很多的模版
https://grafana.com/grafana/dashboards
4), 搜索 ceph 的 dashboard , 这里我选择的是 2842 这个模版, 这个主要是监控集群
5.1, 监控 Ceph-cluster 集群
5,import 导入
这样就监控到我们的 ceph 集群的状态了, 并可以看到 ceph 的 pools,OSD 等相关数据
5.2, 监控 OSD, 模版编号 5336
5.3, 监控 POOLS , 监控模版编号 5342
import 导入模版
来源: http://www.bubuko.com/infodetail-3460170.html