From 8041797ae6fb1e98f2920715ac3a6e24a2d470ef Mon Sep 17 00:00:00 2001 From: hsiang41 Date: Fri, 4 Jan 2019 09:49:52 +0800 Subject: [PATCH] mgr: diskprediction_cloud Add nvme devcie support Parse nvme device information from the device health output. Signed-off-by: Rick Chen --- .../agent/metrics/ceph_cluster.py | 5 +- .../agent/metrics/ceph_mon_osd.py | 12 +- .../agent/metrics/ceph_pool.py | 3 +- .../agent/metrics/db_relay.py | 30 ++-- .../agent/metrics/sai_agent.py | 3 +- .../agent/metrics/sai_cluster.py | 3 +- .../agent/metrics/sai_disk.py | 3 +- .../agent/metrics/sai_disk_smart.py | 130 +++++++++++------- .../agent/metrics/sai_host.py | 9 +- 9 files changed, 102 insertions(+), 96 deletions(-) diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_cluster.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_cluster.py index 4477802a0bada..7c13d10afb42c 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_cluster.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_cluster.py @@ -54,8 +54,7 @@ class CephClusterAgent(MetricsAgent): c_data.tags['cluster_id'] = cluster_id c_data.fields['cluster_health'] = str(cluster_state) c_data.fields['agenthost'] = socket.gethostname() - c_data.tags['agenthost_domain_id'] = \ - '%s_%s' % (cluster_id, c_data.fields['agenthost']) + c_data.tags['agenthost_domain_id'] = cluster_id c_data.fields['osd_epoch'] = obj_api.get_osd_epoch() c_data.fields['num_mon'] = len(obj_api.get_mons()) c_data.fields['num_mon_quorum'] = \ @@ -86,7 +85,7 @@ class CephClusterAgent(MetricsAgent): c_data.fields['osd_bytes_avail'] = total_avail_bytes if total_bytes and total_avail_bytes: c_data.fields['osd_bytes_used_percentage'] = \ - round(float(total_used_bytes) / float(total_bytes) * 100, 4) + round((float(total_used_bytes) / float(total_bytes)) * 100, 4) else: c_data.fields['osd_bytes_used_percentage'] = 0.0000 diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_mon_osd.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_mon_osd.py index c8d9ae92f70ce..cbb0ef43719b2 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_mon_osd.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_mon_osd.py @@ -117,7 +117,7 @@ class CephMonOsdAgent(MetricsAgent): e_osd.fields['name'] = n e_osd.tags['cluster_id'] = cluster_id e_osd.fields['agenthost'] = socket.gethostname() - e_osd.tags['agenthost_domain_id'] = '%s_%s' % (cluster_id, socket.gethostname()) + e_osd.tags['agenthost_domain_id'] = cluster_id e_osd.tags['host_domain_id'] = '%s_%s' % (cluster_id, socket.gethostname()) for k in n_value.keys(): e_osd.fields[k] = str(n_value[k]) @@ -131,7 +131,7 @@ class CephMonOsdAgent(MetricsAgent): n_node = CephOsdTree() n_node.tags['cluster_id'] = cluster_id n_node.fields['agenthost'] = socket.gethostname() - n_node.tags['agenthost_domain_id'] = '%s_%s' % (cluster_id, socket.gethostname()) + n_node.tags['agenthost_domain_id'] = cluster_id n_node.tags['host_domain_id'] = '%s_%s' % (cluster_id, socket.gethostname()) n_node.fields['children'] = ','.join(str(x) for x in node.get('children', [])) n_node.fields['type_id'] = str(node.get('type_id', '')) @@ -153,8 +153,7 @@ class CephMonOsdAgent(MetricsAgent): d_osd.tags['cluster_id'] = cluster_id d_osd.tags['osd_id'] = service_name[4:] d_osd.fields['agenthost'] = socket.gethostname() - d_osd.tags['agenthost_domain_id'] = \ - '%s_%s' % (cluster_id, d_osd.fields['agenthost']) + d_osd.tags['agenthost_domain_id'] = cluster_id d_osd.tags['host_domain_id'] = \ '%s_%s' % (cluster_id, obj_api.get_osd_hostname(d_osd.tags['osd_id'])) @@ -177,7 +176,7 @@ class CephMonOsdAgent(MetricsAgent): if stat_bytes and stat_bytes_used: d_osd.fields['stat_bytes_used_percentage'] = \ - round(float(stat_bytes_used) / float(stat_bytes) * 100, 4) + round((float(stat_bytes_used) / float(stat_bytes)) * 100, 4) else: d_osd.fields['stat_bytes_used_percentage'] = 0.0000 self.data.append(d_osd) @@ -187,8 +186,7 @@ class CephMonOsdAgent(MetricsAgent): d_mon.tags['cluster_id'] = cluster_id d_mon.tags['mon_id'] = service_name[4:] d_mon.fields['agenthost'] = socket.gethostname() - d_mon.tags['agenthost_domain_id'] = \ - '%s_%s' % (cluster_id, d_mon.fields['agenthost']) + d_mon.tags['agenthost_domain_id'] = cluster_id d_mon.fields['num_sessions'] = \ perf_counts.get('mon.num_sessions', {}).get('value', 0) d_mon.fields['session_add'] = \ diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_pool.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_pool.py index b2aec5756bf27..e8b3956661f76 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_pool.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/ceph_pool.py @@ -39,8 +39,7 @@ class CephPoolAgent(MetricsAgent): d_pool.tags['cluster_id'] = cluster_id d_pool.tags['pool_id'] = p_id d_pool.fields['agenthost'] = socket.gethostname() - d_pool.tags['agenthost_domain_id'] = \ - '%s_%s' % (cluster_id, d_pool.fields['agenthost']) + d_pool.tags['agenthost_domain_id'] = cluster_id d_pool.fields['bytes_used'] = \ pool.get('stats', {}).get('bytes_used', 0) d_pool.fields['max_avail'] = \ diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/db_relay.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/db_relay.py index 4a92a079a01f5..2f5d60dbd90e0 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/db_relay.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/db_relay.py @@ -501,8 +501,7 @@ class DBRelayAgent(MetricsAgent): ) cluster_host = socket.gethostname() data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -521,8 +520,7 @@ class DBRelayAgent(MetricsAgent): ) cluster_host = socket.gethostname() data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (self._cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = self._cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -542,8 +540,7 @@ class DBRelayAgent(MetricsAgent): ) cluster_host = socket.gethostname() data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id, data data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -563,8 +560,7 @@ class DBRelayAgent(MetricsAgent): ) cluster_host = socket.gethostname() data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -591,8 +587,7 @@ class DBRelayAgent(MetricsAgent): d_node, v) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -611,8 +606,7 @@ class DBRelayAgent(MetricsAgent): 'VmHostContainsVmDisk' ) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -632,8 +626,7 @@ class DBRelayAgent(MetricsAgent): 'OsdContainsPool' ) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -652,8 +645,7 @@ class DBRelayAgent(MetricsAgent): 'PoolContainsRBD' ) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -675,8 +667,7 @@ class DBRelayAgent(MetricsAgent): 'MetadataPoolContainsFS' if p_attr == 'metadata_pool' else 'DataPoolContainsFS' ) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) @@ -691,8 +682,7 @@ class DBRelayAgent(MetricsAgent): 'MDSContainsFS' ) data.fields['agenthost'] = cluster_host - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['host'] = cluster_host data.fields['cmd'] = str(cypher_cmd) self.data.append(data) diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_agent.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_agent.py index 63c8e870f712d..81fbdf96c8890 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_agent.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_agent.py @@ -50,8 +50,7 @@ class SAIAgent(MetricsAgent): cluster_id = obj_api.get_cluster_id() c_data.fields['cluster_domain_id'] = str(cluster_id) c_data.fields['agenthost'] = str(socket.gethostname()) - c_data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, c_data.fields['agenthost'])) + c_data.tags['agenthost_domain_id'] = cluster_id c_data.fields['heartbeat_interval'] = \ int(obj_api.get_configuration('diskprediction_upload_metrics_interval')) c_data.fields['host_ip'] = str(mgr_meta.get('addr', '127.0.0.1')) diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_cluster.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_cluster.py index f1f23beec523d..d444f9a26770e 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_cluster.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_cluster.py @@ -30,7 +30,6 @@ class SAICluserAgent(MetricsAgent): c_data.tags['domain_id'] = str(cluster_id) c_data.tags['host_domain_id'] = '%s_%s' % (str(cluster_id), str(socket.gethostname())) c_data.fields['agenthost'] = str(socket.gethostname()) - c_data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, c_data.fields['agenthost'])) + c_data.tags['agenthost_domain_id'] = cluster_id c_data.fields['name'] = 'Ceph mgr plugin' self.data.append(c_data) diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk.py index 1f3e1e54d9911..3b177e6939419 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk.py @@ -92,8 +92,7 @@ class SAIDiskAgent(MetricsAgent): str('%s_%s' % (cluster_id, osds_meta.get('hostname', 'None'))) d_data.fields['agenthost'] = str(socket.gethostname()) - d_data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, d_data.fields['agenthost'])) + d_data.tags['agenthost_domain_id'] = cluster_id serial_number = s_val.get('serial_number') wwn = s_val.get('wwn', {}) wwpn = '' diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk_smart.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk_smart.py index 0f03a82526ba7..1ad34784aaaae 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk_smart.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_disk_smart.py @@ -61,62 +61,88 @@ class SAIDiskSmartAgent(MetricsAgent): str('%s_%s' % (cluster_id, osds_meta.get('hostname', 'None'))) smart_data.fields['agenthost'] = str(socket.gethostname()) - smart_data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, smart_data.fields['agenthost'])) + smart_data.tags['agenthost_domain_id'] = cluster_id # parse attributes - ata_smart = s_val.get('ata_smart_attributes', {}) - for attr in ata_smart.get('table', []): - if attr.get('raw', {}).get('string'): - if str(attr.get('raw', {}).get('string', '0')).isdigit(): - smart_data.fields['%s_raw' % attr.get('id')] = \ - int(attr.get('raw', {}).get('string', '0')) + protocol = s_val.get('device', {}).get('protocol', '') + if str(protocol).lower() == 'nvme': + nvme_info = s_val.get('nvme_smart_health_information_log', {}) + smart_data['CriticalWarniing_raw'] = int(nvme_info.get('critical_warning', 0)) + smart_data['CurrentDriveTemperature_raw'] = int(nvme_info.get('temperature', 0)) + smart_data['AvailableSpare_raw'] = int(nvme_info.get('available_spare', 0)) + smart_data['AvailableSpareThreshold_raw'] = int(nvme_info.get('available_spare_threshold', 0)) + smart_data['PercentageUsed_raw'] = int(nvme_info.get('percentage_used', 0)) + smart_data['DataUnitsRead_raw'] = int(nvme_info.get('data_units_read', 0)) + smart_data['DataUnitsRead'] = int(nvme_info.get('data_units_written', 0)) + smart_data['HostReadCommands_raw'] = int(nvme_info.get('host_reads', 0)) + smart_data['HostWriteCommands_raw'] = int(nvme_info.get('host_writes', 0)) + smart_data['ControllerBusyTime_raw'] = int(nvme_info.get('controller_busy_time', 0)) + smart_data['PowerCycles_raw'] = int(nvme_info.get('power_cycles', 0)) + smart_data['PowerOnHours_raw'] = int(nvme_info.get('power_on_hours', 0)) + smart_data['UnsafeShutdowns_raw'] = int(nvme_info.get('unsafe_shutdowns', 0)) + smart_data['MediaandDataIntegrityErrors_raw'] = int(nvme_info.get('media_errors', 0)) + smart_data['ErrorInformationLogEntries'] = int(nvme_info.get('num_err_log_entries')) + nvme_addition = s_val.get('nvme_smart_health_information_add_log', {}) + for k, v in nvme_addition.get("Device stats", {}).items(): + if v.get('raw') is None: + continue + if isinstance(v.get('raw'), int): + smart_data[k] = int(v['raw']) else: - if str(attr.get('raw', {}).get('string', '0')).split(' ')[0].isdigit(): + smart_data[k] = str(v.get('raw')) + else: + ata_smart = s_val.get('ata_smart_attributes', {}) + for attr in ata_smart.get('table', []): + if attr.get('raw', {}).get('string'): + if str(attr.get('raw', {}).get('string', '0')).isdigit(): smart_data.fields['%s_raw' % attr.get('id')] = \ - int(attr.get('raw', {}).get('string', '0').split(' ')[0]) + int(attr.get('raw', {}).get('string', '0')) else: - smart_data.fields['%s_raw' % attr.get('id')] = \ - attr.get('raw', {}).get('value', 0) - smart_data.fields['raw_data'] = str(json.dumps(osds_smart[s_date]).replace("\"", "\'")) - if s_val.get('temperature', {}).get('current') is not None: - smart_data.fields['CurrentDriveTemperature_raw'] = \ - int(s_val['temperature']['current']) - if s_val.get('temperature', {}).get('drive_trip') is not None: - smart_data.fields['DriveTripTemperature_raw'] = \ - int(s_val['temperature']['drive_trip']) - if s_val.get('elements_grown_list') is not None: - smart_data.fields['ElementsInGrownDefectList_raw'] = int(s_val['elements_grown_list']) - if s_val.get('power_on_time', {}).get('hours') is not None: - smart_data.fields['9_raw'] = int(s_val['power_on_time']['hours']) - if s_val.get('scsi_percentage_used_endurance_indicator') is not None: - smart_data.fields['PercentageUsedEnduranceIndicator_raw'] = \ - int(s_val['scsi_percentage_used_endurance_indicator']) - if s_val.get('scsi_error_counter_log') is not None: - s_err_counter = s_val['scsi_error_counter_log'] - for s_key in s_err_counter.keys(): - if s_key.lower() in ['read', 'write']: - for s1_key in s_err_counter[s_key].keys(): - if s1_key.lower() == 'errors_corrected_by_eccfast': - smart_data.fields['ErrorsCorrectedbyECCFast%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['errors_corrected_by_eccfast']) - elif s1_key.lower() == 'errors_corrected_by_eccdelayed': - smart_data.fields['ErrorsCorrectedbyECCDelayed%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['errors_corrected_by_eccdelayed']) - elif s1_key.lower() == 'errors_corrected_by_rereads_rewrites': - smart_data.fields['ErrorCorrectedByRereadsRewrites%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['errors_corrected_by_rereads_rewrites']) - elif s1_key.lower() == 'total_errors_corrected': - smart_data.fields['TotalErrorsCorrected%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['total_errors_corrected']) - elif s1_key.lower() == 'correction_algorithm_invocations': - smart_data.fields['CorrectionAlgorithmInvocations%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['correction_algorithm_invocations']) - elif s1_key.lower() == 'gigabytes_processed': - smart_data.fields['GigaBytesProcessed%s_raw' % s_key.capitalize()] = \ - float(s_err_counter[s_key]['gigabytes_processed']) - elif s1_key.lower() == 'total_uncorrected_errors': - smart_data.fields['TotalUncorrectedErrors%s_raw' % s_key.capitalize()] = \ - int(s_err_counter[s_key]['total_uncorrected_errors']) + if str(attr.get('raw', {}).get('string', '0')).split(' ')[0].isdigit(): + smart_data.fields['%s_raw' % attr.get('id')] = \ + int(attr.get('raw', {}).get('string', '0').split(' ')[0]) + else: + smart_data.fields['%s_raw' % attr.get('id')] = \ + attr.get('raw', {}).get('value', 0) + smart_data.fields['raw_data'] = str(json.dumps(osds_smart[s_date]).replace("\"", "\'")) + if s_val.get('temperature', {}).get('current') is not None: + smart_data.fields['CurrentDriveTemperature_raw'] = \ + int(s_val['temperature']['current']) + if s_val.get('temperature', {}).get('drive_trip') is not None: + smart_data.fields['DriveTripTemperature_raw'] = \ + int(s_val['temperature']['drive_trip']) + if s_val.get('elements_grown_list') is not None: + smart_data.fields['ElementsInGrownDefectList_raw'] = int(s_val['elements_grown_list']) + if s_val.get('power_on_time', {}).get('hours') is not None: + smart_data.fields['9_raw'] = int(s_val['power_on_time']['hours']) + if s_val.get('scsi_percentage_used_endurance_indicator') is not None: + smart_data.fields['PercentageUsedEnduranceIndicator_raw'] = \ + int(s_val['scsi_percentage_used_endurance_indicator']) + if s_val.get('scsi_error_counter_log') is not None: + s_err_counter = s_val['scsi_error_counter_log'] + for s_key in s_err_counter.keys(): + if s_key.lower() in ['read', 'write']: + for s1_key in s_err_counter[s_key].keys(): + if s1_key.lower() == 'errors_corrected_by_eccfast': + smart_data.fields['ErrorsCorrectedbyECCFast%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['errors_corrected_by_eccfast']) + elif s1_key.lower() == 'errors_corrected_by_eccdelayed': + smart_data.fields['ErrorsCorrectedbyECCDelayed%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['errors_corrected_by_eccdelayed']) + elif s1_key.lower() == 'errors_corrected_by_rereads_rewrites': + smart_data.fields['ErrorCorrectedByRereadsRewrites%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['errors_corrected_by_rereads_rewrites']) + elif s1_key.lower() == 'total_errors_corrected': + smart_data.fields['TotalErrorsCorrected%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['total_errors_corrected']) + elif s1_key.lower() == 'correction_algorithm_invocations': + smart_data.fields['CorrectionAlgorithmInvocations%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['correction_algorithm_invocations']) + elif s1_key.lower() == 'gigabytes_processed': + smart_data.fields['GigaBytesProcessed%s_raw' % s_key.capitalize()] = \ + float(s_err_counter[s_key]['gigabytes_processed']) + elif s1_key.lower() == 'total_uncorrected_errors': + smart_data.fields['TotalUncorrectedErrors%s_raw' % s_key.capitalize()] = \ + int(s_err_counter[s_key]['total_uncorrected_errors']) serial_number = s_val.get('serial_number') wwn = s_val.get('wwn', {}) diff --git a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_host.py b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_host.py index ec1e4cb6a9b3b..0f3698ad69774 100644 --- a/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_host.py +++ b/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_host.py @@ -48,8 +48,7 @@ class SAIHostAgent(MetricsAgent): if osd_host not in hosts: data = SAIHostFields() data.fields['agenthost'] = str(socket.gethostname()) - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['domain_id'] = \ str('%s_%s' % (cluster_id, osd_host)) data.fields['cluster_domain_id'] = str(cluster_id) @@ -72,8 +71,7 @@ class SAIHostAgent(MetricsAgent): if mon_host not in hosts: data = SAIHostFields() data.fields['agenthost'] = str(socket.gethostname()) - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['domain_id'] = \ str('%s_%s' % (cluster_id, mon_host)) data.fields['cluster_domain_id'] = str(cluster_id) @@ -95,8 +93,7 @@ class SAIHostAgent(MetricsAgent): if mds_host not in hosts: data = SAIHostFields() data.fields['agenthost'] = str(socket.gethostname()) - data.tags['agenthost_domain_id'] = \ - str('%s_%s' % (cluster_id, data.fields['agenthost'])) + data.tags['agenthost_domain_id'] = cluster_id data.tags['domain_id'] = \ str('%s_%s' % (cluster_id, mds_host)) data.fields['cluster_domain_id'] = str(cluster_id) -- 2.39.5