cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Update variable values on new Dashboard using workflow task

heramb_sawant
Organizer

Hi ,
I have new dashboard(not the classic), dashboard has tile shows metric data  i.e disk utilization based on parameter passed to to DQL. .

Dashboard tiles shows disk utilization based on host names passed in DQL , I wan to update this tile input ($Host_Name) i.e. values of 'Host name' from workflow. Workflow having task which gives me list  of host which has threshold violation.

So  on Dashboard , want to show disk % of of those host which has threshold violation. Can I used js code to update dashboard tile's dql query.

Regards,
Heramb 



1 REPLY 1

marco_irmer
Champion

I was able incorporate workflow results in a dashboard through the use of a code tile and I imagine something similar would be possible for a variable. You would do this by doing a 'code' variable that retrieves the output from the most recent execution of the workflow. Here's the code from my dashboard tile to help you get started.

import { executionsClient } from "@dynatrace-sdk/client-automation";

export default async function () {

  // Get the last successful execution
  const workflow_executions = await executionsClient.getExecutions({
    workflow: "<WORKFLOW_ID_HERE>",
    ordering: "-endedAt",
    state: "SUCCESS"
  });
  const last_execution = workflow_executions.results[0].id;
    
  // fetch results from the workflow task
  const task_result = await executionsClient.getTaskExecutionResult({
    executionId: last_execution,
    id: "<WORKFLOW_STEP_NAME_HERE>"
    });
  
  return task_result;

}

Featured Posts