]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
prometheus: Implement rgw_metadata metric
authorBoris Ranto <branto@redhat.com>
Thu, 12 Apr 2018 16:11:51 +0000 (18:11 +0200)
committerBoris Ranto <branto@redhat.com>
Wed, 18 Apr 2018 10:48:11 +0000 (12:48 +0200)
This maps rgw id to its hostname and ceph version running on the node.

Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit c7cbc24803da9474c9d1d15a52da8d0eed2d49af)

src/pybind/mgr/prometheus/module.py

index 421ca1e7309a49996c9252ebc474ab15f5eb2a82..129c75d7835a96ba28793c67ee6b4a8b940e69bf 100644 (file)
@@ -71,6 +71,8 @@ OSD_STATS = ['apply_latency_ms', 'commit_latency_ms']
 
 POOL_METADATA = ('pool_id', 'name')
 
+RGW_METADATA = ('id', 'hostname', 'ceph_version')
+
 DISK_OCCUPATION = ('instance', 'device', 'ceph_daemon')
 
 
@@ -181,6 +183,13 @@ class Metrics(object):
             POOL_METADATA
         )
 
+        metrics['rgw_metadata'] = Metric(
+            'untyped',
+            'rgw_metadata',
+            'RGW Metadata',
+            RGW_METADATA
+        )
+
         metrics['pg_total'] = Metric(
             'gauge',
             'pg_total',
@@ -481,6 +490,18 @@ class Module(MgrModule):
         for pool in osd_map['pools']:
             self.metrics.append('pool_metadata', 1, (pool['pool'], pool['pool_name']))
 
+        # Populate rgw_metadata
+        for key, value in servers.items():
+            service_id, service_type = key
+            if service_type != 'rgw':
+                continue
+            hostname, version = value
+            self.metrics.append(
+                'rgw_metadata',
+                1,
+                (service_id, hostname, version)
+            )
+
     def collect(self):
         self.get_health()
         self.get_df()