cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2102
Views
0
Helpful
3
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee

Developed by Russ Whitear

Task NameThis custom workflow task can determine which ESX host nodes belong to each ESX cluster.
Description
  1. This custom workflow task can determine which ESX host nodes belong to each ESX cluster.
Prerequisites
  1. Custom workflow needs to be loaded
  2. Regular workflow needs to be loaded
CategoryFile
ComponentsvSphere 5.x
User Inputs

Instructions for Custom Workflow Use:

  1.   Download the attached .ZIP file to your computer. Note: Remember the location of the saved file on your computer.
  2.   Unzip the file on your computer. The unzipped file ends up with an extension .WFDX file.
  3.   Log in to UCS Director as a user that has the system admin privileges.
  4.   Choose Policies > Orchestration, and then click the Custom Workflow Tasks tab.
  5.   Click Import Tasks.
  6.   In the Import Tasks dialog box, click Browse and choose the downloaded file for upload. Click Upload. A successful file upload message appears.
  7.   Click OK.
  8.   Click Next.
  9. The Save Tasks window displays the task exported time, task exported username, and comments provided when the task is exported. The imported task details appear in a table format.
  10. Check the Overwrite if the task exists with same name check box to overwrite the existing task with the imported task.
  11. If this check box is unchecked, a new task will be added with a number (n) to make the name unique.
  12. Click Import.
  13. The custom workflow task is imported and is immediately available for use in the workflow.
  14. Create a basic workflow. For more information, see the Creating a Workflow section in the Cisco UCS Director Orchestration Guide, Release 4.1.
  15. Add the imported workflow task to the workflow. For more information see the Adding Tasks to a Workflow section in the Cisco UCS Director Orchestration Guide, Release 4.1
  16. Click Submit.
  17. Click the workflow, the workflow designer opens.
  18. In the workflow designer window, click the Execute Now button.
  19. A service request is created for the workflow.

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

Script Example:

// Report Skeleton.

importPackage(java.lang);

importPackage(java.util);

importPackage(com.cloupia.lib.util.managedreports);

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

function getReport(reportContext, reportName)

{

     var report = null;

      try

      {

             report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);

      } catch(e)

      {

      }

      if (report == null)

      {

             return ctxt.getAPI().getTabularReport(reportName, reportContext);

      } else

     {

           var source = report.getSourceReport();

           return ctxt.getAPI().getTabularReport(source, reportContext);

     }

}

function getReportView(reportContext, reportName)

{

      var report = getReport(reportContext, reportName);

     if (report == null)

     {

           logger.addError("No such report exists for the specified context "+reportName);

           return null;

     }

     return new TableView(report);

}

var cloudName = input.cloudName;

var repContext = util.createContext("cloud", cloudName, null);

var report = getReportView(repContext, "PER_CLOUD_CLUSTER_LIST");

var numRowsFound = report.rowCount();

logger.addInfo("Number of Rows found: " + numRowsFound);

// Retrieve ESX Cluster Names. We will use these to then retrieve the ESX hostnames

// for each cluster.

var ClusterNameArray = [];

for (var i=0; i<report.rowCount(); i++)

{

  ClusterNameArray[i] = report.getColumnValue(i, "Cluster Name");

           

            logger.addInfo("Column [" + i + "]: " + ClusterNameArray[i]);

}

for(i=0; i<ClusterNameArray.length; i++)

{

            var repContext = util.createContext("cloud", cloudName, ClusterNameArray[i]);

            var report = getReportView(repContext, "PER_CLUSTER_HOSTNODE_INVENTORY_LIST")

            var numRowsFound = report.rowCount();

            logger.addInfo("Number of Rows found for cluster " + ClusterNameArray[i] + ": " + numRowsFound);

            for (var j=0; j<report.rowCount(); j++)

                     logger.addInfo("Node [" + j + "]: " + report.getColumnValue(j, "Host Node") );

}

Comments
gene.williams
Level 1
Level 1

Is there supposed to be a zip file attached?

Orf Gelbrich
Cisco Employee
Cisco Employee

Looks like you need to paste the java script into a custom task. Russ wrote this.

gene.williams
Level 1
Level 1

Ok, cool.  Thanks Orf.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links