前面有文章写了使用rook搭建ceph。本文将使用外部的Prometheus健康ceph集群,并提供告警功能。
采集ceph指标
进入到monitoring,执行:
kubectl apply -f rbac.yaml #必须执行,否则operator会报错的哦
kubectl apply -f service-monitor.yaml
kubectl apply -f exporter-service-monitor.yaml
修改cluster.yaml中的
monitoring:
# requires Prometheus to be pre-installed
enabled: true
# Whether to disable the metrics reported by Ceph. If false, the prometheus mgr module and Ceph exporter are enabled.
# If true, the prometheus mgr module and Ceph exporter are both disabled. Default is false.
metricsDisabled: false
然后验证metric指标
[root@sc-neutral-2 ~]# kubectl -n rook-ceph get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rook-ceph-mgr ClusterIP 10.104.175.66 <none> 9283/TCP 9d
rook-ceph-mgr-dashboard ClusterIP 10.108.126.89 <none> 8443/TCP 7d4h
rook-ceph-rgw-knowdee-s3-object-store ClusterIP 10.106.225.66 <none> 9080/TCP 9d
[root@sc-neutral-2 ~]# curl http://10.104.175.66:9283/metrics |more
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
# HELP ceph_health_status Cluster health status
# TYPE ceph_health_status untyped
ceph_health_status 0.0
# HELP ceph_mon_quorum_status Monitors in quorum
# TYPE ceph_mon_quorum_status gauge
ceph_mon_quorum_status{ceph_daemon="mon.a"} 1.0
ceph_mon_quorum_status{ceph_daemon="mon.c"} 1.0
ceph_mon_quorum_status{ceph_daemon="mon.d"} 1.0
# HELP ceph_fs_metadata FS Metadata
# TYPE ceph_fs_metadata untyped
ceph_fs_metadata{data_pools="4",fs_id="1",metadata_pool="3",name="cephfs"} 1.0
# HELP ceph_mds_metadata MDS Metadata
# TYPE ceph_mds_metadata untyped
ceph_mds_metadata{ceph_daemon="mds.cephfs-b",fs_id="1",hostname="sc-neutral-3",public_addr="172.70.10.24:6801/2418714164",rank="0",ceph_version="ceph version 17.2.6 (d7ff0d10654d2280e08f1ab989c7cdf3064
446a5) quincy (stable)"} 1.0
ceph_mds_metadata{ceph_daemon="mds.cephfs-a",fs_id="1",hostname="sc-neutral-1",public_addr="172.70.21.19:6801/2999471209",rank="0",ceph_version="ceph version 17.2.6 (d7ff0d10654d2280e08f1ab989c7cdf3064
446a5) quincy (stable)"} 1.0
# HELP ceph_mon_metadata MON Metadata
.....................................
.....................
很长很长