operation = alarm_descriptor["operation"]
rel_operator = self.rel_operation_types.get(operation, "<=")
metric_selector = f'{metric_name}{{ns_id="{nsr_id}", vnf_member_index="{vnf_member_index}", vdu_id="{vdu_id}"}}'
- expression = (
- f"avg({metric_selector}) {rel_operator} {metric_threshold}"
- )
+ expression = f"{metric_selector} {rel_operator} {metric_threshold}"
labels = {
"ns_id": nsr_id,
"vnf_member_index": vnf_member_index,
"vdu_id": vdu_id,
+ "vdu_name": "{{ $labels.vdu_name }}",
}
prom_cfg = {
"alert": alert_name,
"actions" in alarm_descriptor
and action_type in alarm_descriptor["actions"]
):
- for url in alarm_descriptor["actions"][action_type]:
- if "webhook" in alarm_action:
- alarm_action["webhook"].append(url["url"])
- else:
- alarm_action["webhook"] = [url["url"]]
-
+ alarm_action[action_type] = alarm_descriptor["actions"][
+ action_type
+ ]
alert = {
"uuid": uuid,
"name": alert_name,