diff --git a/tendrl/commons/utils/monitoring_utils.py b/tendrl/commons/utils/monitoring_utils.py new file mode 100644 index 00000000..a708a4f0 --- /dev/null +++ b/tendrl/commons/utils/monitoring_utils.py @@ -0,0 +1,25 @@ +import uuid + +from tendrl.commons.objects.job import Job + + +def update_dashboard(res_name, res_type, integration_id, action): + _job_id = str(uuid.uuid4()) + _params = { + "TendrlContext.integration_id": NS.tendrl_context.integration_id, + "Trigger.resource_name": res_name, + "Trigger.resource_type": res_type, + "Trigger.action": action + } + _job_payload = { + "tags": ["tendrl/integration/monitoring"], + "run": "monitoring.flows.UpdateDashboard", + "status": "new", + "parameters": _params, + "type": "monitoring" + } + Job( + job_id=_job_id, + status="new", + payload=_job_payload + ).save()