]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard:Get "Different Storage Class" metrics in Prometheus dashboard
authorAashish Sharma <aasharma@redhat.com>
Tue, 19 Jul 2022 09:04:18 +0000 (14:34 +0530)
committerAashish Sharma <aasharma@redhat.com>
Tue, 16 Aug 2022 06:17:20 +0000 (11:47 +0530)
Get metrics of the different "HDDRule" and "MixedUse" classes of the "Raw Storage" for their ceph VMs. So that Prometheus can scrape the data and display it to them in grafana

Resolves: rhbz#2095632

Fixes: https://tracker.ceph.com/issues/56625
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
(cherry picked from commit 20705677acd5935981bd8510702b47e1b0678d27)
(cherry picked from commit 895536fb050e2767aa67373357569c8e4994693e)

src/pybind/mgr/prometheus/module.py

index ad7c32924ef582e64a9a60b922c0a3fe7d265944..56d239843d13731b2e016ba3d12931d5716a18a3 100644 (file)
@@ -794,6 +794,13 @@ class Module(MgrModule):
                 path,
                 'DF {}'.format(state),
             )
+            path = 'cluster_by_class_{}'.format(state)
+            metrics[path] = Metric(
+                'gauge',
+                path,
+                'DF {}'.format(state),
+                ('device_class',)
+            )
         for state in DF_POOL:
             path = 'pool_{}'.format(state)
             metrics[path] = Metric(
@@ -921,6 +928,8 @@ class Module(MgrModule):
         df = self.get('df')
         for stat in DF_CLUSTER:
             self.metrics['cluster_{}'.format(stat)].set(df['stats'][stat])
+            for device_class in df['stats_by_class']:
+                self.metrics['cluster_by_class_{}'.format(stat)].set(df['stats_by_class'][device_class][stat], (device_class,))
 
         for pool in df['pools']:
             for stat in DF_POOL: