Showing results for 
Search instead for 
Did you mean: 

UCSD - How to access and manipulate reports in CloupiaScript?


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.


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


Download the Cloupia Script bundle, to get access to JavaDoc (and multiple custom tasks samples):



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 "") 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:


This module provides a function getReportView which requires 2 arguments: getReportView(reportContext, reportName);

Second one is easy, it is the name of the report, so in this example:


First one is an object created using the createContext method. Here is the documentation from the JavaDoc:


  1. The contextName is the context we got from the Report Customization page. In this example: contextName = "hostnode"
  2. If contextName is cloud or hostnode, this should be set to the cloud name. In this example, the cloud name is vc-labcloud: cloud = "vc-labcloud" Otherwise, it should be set to null
  3. The value is the object name. In this example, the host name we want the VMs running on is : value = ""

So, you can now create the context:

var reportContext = util.createContext("hostnode", "vc-labcloud", "");

And now you can get the report data using these two informations:

var report = getReportView(reportContext, reportName);

This function returns a TableView object, and all the methods to manipulate it (filter,...) are documented in the JavaDoc:


This workflow allows you to discover the columnLabels of the report, or you can just loop on it:

for (i=0;i<report.columnCount();i++)


     logger.addInfo("Column "+i+" : " + report.getColumnLabel(i))


And you can do whatever you want , keeping only powered-on vm with the name prefixed by "dc-web", and then store the VM-ID of the first VM of the table:

report = report.filterRowsByColumn("Power Status", "ON", false);

report = report.filterRowsByColumn("Instance Name", "dc-web.*", true);

vmid = report.getColumnValue(0,"VM-ID");

Now you can easily manipulate reports!

Community Member

A must have in your bookmark!

Thank you Damien ;-)


Hey I am a new to this, and i would like explore on the cloupia scripts. Could you publish the cloupia scripts SDK bundle 6.5.

Cisco Employee

I would need to your CCO id to do that


Hi Orf

Will this work also in version 6.7  and if not what do I need to do?, I want to add som columns to L2 APIC reports for CDP neighbors and try to find how to change the build in report and add a column for "description"  filed 



Report Definition

L2 Neigbors

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards