UCSD - How to access and manipulate reports in CloupiaScript?

Version 4

Created by dgouju on Jul 27, 2016 4:06 PM. Last modified by dgouju on Nov 17, 2016 6:20 PM.

Purpose of the document

UCS Director collects a lot of information on the infrastructure. Manipulating these information in workflows and custom tasks is very useful in various use cases: extracting informations, cross-reference data... This document explain how to quickly access and manipulate these elements called reports in custom tasks.

Prerequisites

You have to enable developer mode in UCS Director as an admin, to access to report metadata:

Methodology

First, we will gather the elements that are needed:

Go to the report that interest you in UCS Director. In this example, you need to access to the VMs running on a specific node (see this task). Go to Virtual -> Compute, select a cloud (here "vc-labcloud"), go to Host nodes tab, select a host (here named "192.168.7.77") and click on View Details and go to VMs tab:

The developper menu feature enabled the Report Metadata, click on it and scroll to reportName:

The reportName is the generic identifier of this report. Now, we need to identify in which contexts this report exists.

Go to Admin -> User Interface Settings and select Report Customization tab. Add the ID column (it is hidden by default) using the blue wheel, and search for the reportName (ID) you noted:

The Context column give you the context(s) of this report. In this example, context is "hostnode". Now, we have all the information, we can start to code!

Attached to this document is a Script Module that you can import in the Orchestration module (like Workflows / tasks). Then, you can load this code in your custom tasks, it will provide the functions that create the TableView object that will contain these data and that you will manipulate. This module can be easily loaded at the beginning of your script: