- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
07-27-2016 09:06 AM - edited 03-01-2019 06:42 AM
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:
Download the Cloupia Script bundle, to get access to JavaDoc (and multiple custom tasks samples):
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:
loadLibrary("ReportManipulation/ReportCloupiaScripts")
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:
var reportName = "PER_HOSTNODE_VM_LIST_CONFIG_REPORT";
First one is an object created using the createContext method. Here is the documentation from the JavaDoc:
- The contextName is the context we got from the Report Customization page. In this example: contextName = "hostnode"
- 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
- The value is the object name. In this example, the host name we want the VMs running on is 192.168.7.77 : value = "192.168.7.77"
So, you can now create the context:
var reportContext = util.createContext("hostnode", "vc-labcloud", "192.168.7.77");
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!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
A must have in your bookmark!
Thank you Damien ;-)

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I would need to your CCO id to do that
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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
/Ola
APIC_NEIGHBORS_REPORT
Report Definition
APIC_NEIGHBORS_REPORT
L2 Neigbors