在Ceph Luminous之前的版本,可以使用第三方的Prometheus exporterceph_exporter。 Ceph Luminous 12.2.1的mgr中自带了Prometheus插件,内置了 Prometheus ceph exporter,可以使用Ceph mgr内置的exporter作为Prometheus的target。
方案一: 使用ceph mgr prometheus插件
启用Ceph的Prometheus插件:
ceph mgr module enable prometheus
ceph mgr module ls
[
"dashboard",
"prometheus"
]启用成功后在激活(active)的mgr节点上可以看到:
netstat -nltp | grep mgr
tcp 0 0 0.0.0.0:6804 0.0.0.0:* LISTEN 159556/ceph-mgr
tcp6 0 0 :::7000 :::* LISTEN 159556/ceph-mgr
tcp6 0 0 :::9283 :::* LISTEN 159556/ceph-mgr其中9283是ceph exporter的监听端口,curl 127.0.0.1:9283可以获取到metrics。将这个exporter作为Prometheus的target即可。
- job_name: 'ceph'
honor_labels: true
static_configs:
- targets:
- 192.168.61.21:9283
labels:
instance: ceph图表和告警这里略过……
2.方案二: 使用digitalocean ceph_exporter
因为我们正式环境中使用的是第三方的Prometheus ceph_exporter。