在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插件:

1ceph mgr module enable prometheus
2
3ceph mgr module ls
4[
5    "dashboard",
6    "prometheus"
7]

启用成功后在激活(active)的mgr节点上可以看到:

1netstat -nltp | grep mgr
2tcp        0      0 0.0.0.0:6804            0.0.0.0:*               LISTEN      159556/ceph-mgr
3tcp6       0      0 :::7000                 :::*                    LISTEN      159556/ceph-mgr
4tcp6       0      0 :::9283                 :::*                    LISTEN      159556/ceph-mgr

其中9283是ceph exporter的监听端口,curl 127.0.0.1:9283可以获取到metrics。将这个exporter作为Prometheus的target即可。

1- job_name: 'ceph'
2    honor_labels: true
3    static_configs:
4     - targets:
5        - 192.168.61.21:9283
6       labels:
7         instance: ceph

图表和告警这里略过……

2.方案二: 使用digitalocean ceph_exporter

因为我们正式环境中使用的是第三方的Prometheus ceph_exporter

参考