@@ -89,6 +89,11 @@ def health_status_to_number(status: str) -> int:
8989 'front_iface' , 'hostname' , 'objectstore' , 'public_addr' ,
9090 'ceph_version' )
9191
92+
93+ OSD_NEARFULL_RATIO = ()
94+
95+ OSD_FULL_RATIO = ()
96+
9297OSD_STATUS = ['weight' , 'up' , 'in' ]
9398
9499OSD_STATS = ['apply_latency_ms' , 'commit_latency_ms' ]
@@ -703,6 +708,18 @@ def _setup_static_metrics(self) -> Dict[str, Metric]:
703708 'OSD Metadata' ,
704709 OSD_METADATA
705710 )
711+ metrics ['osd_nearfull_ratio' ] = Metric (
712+ 'gauge' ,
713+ 'osd_nearfull_ratio' ,
714+ 'OSD cluster-wide nearfull ratio' ,
715+ ()
716+ )
717+ metrics ['osd_full_ratio' ] = Metric ( # <-- Add this block
718+ 'gauge' ,
719+ 'osd_full_ratio' ,
720+ 'OSD cluster-wide full ratio' ,
721+ ()
722+ )
706723
707724 # The reason for having this separate to OSD_METADATA is
708725 # so that we can stably use the same tag names that
@@ -1138,6 +1155,14 @@ def get_service_list(self) -> Dict[Tuple[str, str], Tuple[str, str, str]]:
11381155 @profile_method ()
11391156 def get_metadata_and_osd_status (self ) -> None :
11401157 osd_map = self .get ('osd_map' )
1158+
1159+ cluster_nearfull_ratio = osd_map .get ('nearfull_ratio' , None )
1160+ cluster_full_ratio = osd_map .get ('full_ratio' , None )
1161+ if cluster_nearfull_ratio is not None :
1162+ self .metrics ['osd_nearfull_ratio' ].set (cluster_nearfull_ratio , ('cluster' ,))
1163+ if cluster_full_ratio is not None :
1164+ self .metrics ['osd_full_ratio' ].set (cluster_full_ratio , ('cluster' ,))
1165+
11411166 osd_flags = osd_map ['flags' ].split (',' )
11421167 for flag in OSD_FLAGS :
11431168 self .metrics ['osd_flag_{}' .format (flag )].set (
0 commit comments