"cpu_utilization": "cpu",
}
+METRIC_MAPPINGS_FOR_PROMETHEUS_TSBD = {
+ "cpu_utilization": "cpu",
+ "average_memory_utilization": "memory_usage",
+ "disk_read_ops": "disk_device_read_requests",
+ "disk_write_ops": "disk_device_write_requests",
+ "disk_read_bytes": "disk_device_read_bytes",
+ "disk_write_bytes": "disk_device_write_bytes",
+ "packets_in_dropped": "network_incoming_packets_drop",
+ "packets_out_dropped": "network_outgoing_packets_drop",
+ "packets_received": "network_incoming_packets",
+ "packets_sent": "network_outgoing_packets",
+}
+
# Metrics which have new names in Rocky and higher releases
METRIC_MAPPINGS_FOR_ROCKY_AND_NEWER_RELEASES = {
"disk_read_ops": "disk.device.read.requests",
if "monitoring-parameter" in vdu:
for param in vdu["monitoring-parameter"]:
metric_name = param["performance-metric"]
- log.debug(f"Using an {type(self.backend)} as backend")
+ log.info(f"Using an {type(self.backend)} as backend")
if type(self.backend) is PrometheusTSBDBackend:
openstack_metric_name = self.backend.map_metric(metric_name)
else:
class PrometheusTSBDBackend(OpenstackBackend):
def __init__(self, vim_account: dict):
- self.cred = vim_account["prometheus-config"]["prometheus_cred"]
- self.map = vim_account["prometheus-config"]["prometheus_map"]
- self.client = self._build_prometheus_client(vim_account)
+ self.map = self._build_map(vim_account)
+ self.cred = vim_account["prometheus-config"].get("prometheus-cred")
+ self.client = self._build_prometheus_client(
+ vim_account["prometheus-config"]["prometheus-url"]
+ )
- def _build_prometheus_client(self, vim_account: dict) -> prometheus_client:
- url = vim_account["prometheus-config"]["prometheus_url"]
+ def _build_prometheus_client(self, url: str) -> prometheus_client:
return prometheus_client(url, disable_ssl=True)
+ def _build_map(self, vim_account: dict) -> dict:
+ custom_map = METRIC_MAPPINGS_FOR_PROMETHEUS_TSBD
+ if "prometheus-map" in vim_account["prometheus-config"]:
+ custom_map.update(vim_account["prometheus-config"]["prometheus-map"])
+ return custom_map
+
def collect_metric(
self, metric_type: MetricType, metric_name: str, resource_id: str
):