启用 Manager 组件的 Prometheus 模块
Ceph 的 Manager 组件内置了 Prometheus exporter,负责采集集群指标。启用后,每个节点都会运行 exporter 进程,默认监听 9283 端口。
[root@ceph-node-1 ~]# ceph mgr module enable prometheus
验证端口监听状态:
[root@ceph-node-1 ~]# netstat -lnpt | grep 9283
tcp6 0 0 :::9283 :::* LISTEN 938527/ceph-mgr
访问 https://<IP>:9283/metrics 即可看到原始监控数据。

部署并配置 Prometheus
安装服务端
添加官方 YUM 源并安装。这里以 CentOS 环境为例:
vim /etc/yum.repos.d/prometheus.repo
# [prometheus]
# name=prometheus
# baseurl=https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
# repo_gpgcheck=1
# enabled=1
# gpgcheck=0
# metadata_expire=300
yum -y install prometheus
systemctl start prometheus
systemctl status prometheus
启动后访问 http://<IP>:9090 进入管理界面。

添加 Ceph 监控目标
主要是在 Prometheus 中将 Ceph exporter 组件的地址添加到监控系统中。编辑配置文件 /etc/prometheus/prometheus.yml:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
[]
[]







