cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
823
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameDatastore Capacity Report
Description

Prerequisites

Tested on UCSD 5.4.0.3

CategoryWorkflow
ComponentsvSphere 5.x
User Inputs


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.

Example on how to convert this screen:

Screen Shot 2016-06-16 at 6.22.36 AM.png

Into a workflow:

Screen Shot 2016-06-16 at 6.36.29 AM.png

That can send an e-mail (on a schedule):

Screen Shot 2016-06-16 at 6.37.16 AM.png

The Code:

importPackage(java.util);

importPackage(java.lang);

importPackage(java.io);

importPackage(com.cloupia.model.cEvent.notify);

importPackage(com.cloupia.model.cIM);

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

importPackage(com.cloupia.fw.objstore);

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

function getMailSettings()

{

      return ObjStoreHelper.getStore((new MailSettings()).getClass()).getSingleton();

}

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);

}

// Assume the To Email Addres is in the input variable 'Email Address'

var toEmail = [ ctxt.getInput("Email Address") ];

var message = new EmailMessageRequest();

message.setToAddrs(toEmail);

message.setSubject("Data Store Capacity");

message.setFromAddress("no-reply@cisco.com");

var buffer = new StringWriter();

var printer = new PrintWriter(buffer);

// Formatter exists in multiple packages, so it needs fully qualified name

var formatter = new com.cloupia.lib.util.managedreports.Formatter(new File("."), printer);

// Works var reportName  = "GLOBAL_VM_LIST_REPORT";

// No Work var reportName  = "SNAPSHOT-SUMMARY-T1";

var reportName  = "StorageFeature.global.vmware.datastore.config";

//var reportName  = "UCS-CHASSIS-T50";

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

var report = getReportView(repContext, reportName);

// Filter Active State VMs

report = report.filterRowsByColumn("IsAccessible", "ON", false);

formatter.printTable(report);

printer.close();

var body = "<head><style type='text/css'>";

// Specify CSS for the report

body = body + "table { font-family: Verdana, Geneva, sans-serif; font-size: 12px; border: thin solid #039; border-spacing: 0; background: #ffffff; } ";

body = body + " th { background-color: #6699FF; color: white; font-family: Verdana, Geneva, sans-serif; font-size: 10px; font-weight: bold; border-color: #CCF; border-style: solid; border-width: 1px 1px 0 0; margin: 0; padding: 5px; } ";

body = body + " td { font-family: Verdana, Geneva, sans-serif; font-size: 10px; border-color: #CCF; border-style: solid; border-width: 1px 1px 0 0; margin: 0; padding: 5px; background: #ffffff; }";

body = body + "</style></head>";

body = body+ "<body><h1>Data Store Capacity</h1><br>" + buffer.toString();

        

message.setMessageBody(body);

logger.addInfo("Sending email");

// Now, send the report via email. First parameter is just a label used in the

// internal logs

MailManager.sendEmail("Data Store Report", getMailSettings(), message);

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