From fd154ee58be4b1ccf3ae37e1d48768a37f19a998 Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Thu, 12 Apr 2018 18:11:51 +0200 Subject: [PATCH] prometheus: Implement rgw_metadata metric This maps rgw id to its hostname and ceph version running on the node. Signed-off-by: Boris Ranto (cherry picked from commit c7cbc24803da9474c9d1d15a52da8d0eed2d49af) --- src/pybind/mgr/prometheus/module.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 421ca1e7309a4..129c75d7835a9 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -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() -- 2.39.5