]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/diskprediction_cloud/agent/metrics/sai_cluster.py
bump version to 15.2.11-pve1
[ceph.git] / ceph / src / pybind / mgr / diskprediction_cloud / agent / metrics / sai_cluster.py
1 from __future__ import absolute_import
2
3 import socket
4
5 from . import AGENT_VERSION, MetricsAgent, MetricsField
6 from ...common.clusterdata import ClusterAPI
7
8
9 class SAIClusterFields(MetricsField):
10 """ SAI Host structure """
11 measurement = 'sai_cluster'
12
13 def __init__(self):
14 super(SAIClusterFields, self).__init__()
15 self.tags['domain_id'] = None
16 self.fields['agenthost'] = None
17 self.fields['agenthost_domain_id'] = None
18 self.fields['name'] = None
19 self.fields['agent_version'] = str(AGENT_VERSION)
20
21
22 class SAICluserAgent(MetricsAgent):
23 measurement = 'sai_cluster'
24
25 def _collect_data(self):
26 c_data = SAIClusterFields()
27 obj_api = ClusterAPI(self._module_inst)
28 cluster_id = obj_api.get_cluster_id()
29
30 c_data.tags['domain_id'] = str(cluster_id)
31 c_data.tags['host_domain_id'] = '%s_%s' % (str(cluster_id), str(socket.gethostname()))
32 c_data.fields['agenthost'] = str(socket.gethostname())
33 c_data.tags['agenthost_domain_id'] = cluster_id
34 c_data.fields['name'] = 'Ceph mgr plugin'
35 self.data.append(c_data)