This document supports the version of each product listed and
supports all subsequent versions until the document is replaced
by a new edition. To check for more recent editions of this
document, see http://www.vmware.com/support/pubs.
EN-000422-00
Using VMware vCenter Orchestrator Plug-Ins
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2 VMware, Inc.
Contents
Using VMware vCenter Orchestrator Plug-Ins7
Introduction to Orchestrator Plug-Ins9
1
Orchestrator Architecture 9
Default Orchestrator Plug-Ins 10
Access the Orchestrator API Explorer 12
Using the vCenter Server 4.1 Plug-In15
2
Configure the vCenter Server 4.1 Plug-In 15
vCenter Server 4.1 Plug-In Scripting API 16
vCenter Server Scripting Examples 16
Using the vCenter Server 4.1 Plug-In Inventory 18
Access the vCenter Server 4.1 Plug-In Workflow Library 18
vCenter Server 4.1 Plug-In Workflow Library 19
Using the vCO Library Plug-In29
3
vCO Library Plug-In Workflows 29
Using the Database Plug-In31
4
Database Plug-In Scripting API 31
Connection Class 31
JDBCConnection Class 31
PreparedStatement Class 32
ResultSet Class 32
Running the JDBC Sample Workflows 33
Generate a JDBC URL 33
Test a JDBC Connection 34
Create a Table by Using JDBC 34
Insert a Row into a JBCD Table 35
Select Rows from a JDBC Table 35
Delete an Entry from a JDBC Table 36
Delete All Entries from a JDBC Table 36
Drop a JDBC Table 37
Run a Complete JDBC Cycle 37
VMware, Inc.
Using the SSH Plug-In39
5
Configure the SSH Plug-In 39
SSH Plug-In Scripting API 40
SSH:File Type 40
SSH:Folder Type 40
SSH:RootFolder Type 40
3
Using VMware vCenter Orchestrator Plug-Ins
SSH:SshConnection Type 40
KeyPairManager Class 40
SSHCommand Class 41
SSHFile Class 42
SSHFolder Class 42
SSHSession Class 43
Running the SSH Plug-In Sample Workflows 44
Generate a Key Pair 44
Change the Key Pair Passphrase 45
Register an Orchestrator Public Key on an SSH Host 45
Run an SSH Command 46
Copy a File from an SSH Host 46
Copy a File to an SSH Host 47
Using the XML Plug-In49
6
XML Plug-In Scripting API 49
XMLDocument Class 49
XMLElement Class 50
XMLManager Class 51
XMLNamedNodeMap Class 51
XMLNode Class 52
XMLNodeList Class 53
Running the XML Plug-In Sample Workflows 53
Create a Simple XML Document 53
Find an Element in an XML Document 54
Modify an XML Document 54
Create an Example Address Book from XML 55
Using the Mail Plug-In57
7
Define the Default SMTP Connection 57
Mail Plug-In Scripting API 58
EmailMessage Class 58
Email Scripting Examples 58
Using the Mail Plug-In Sample Workflows 59
Access the Mail Plug-In Sample Workflows 59
Mail Plug-In Sample Workflows 59
Test an Example Interaction with Email 60
Using the Net Plug-In61
8
Net Plug-In Scripting API 61
FTPClient Class 61
POP3Client Class 62
POP3Message Class 63
TelnetClient Class 63
Using the Enumeration Plug-In65
9
Enumeration Plug-In Scrpting API 65
Time Zone Codes 66
4 VMware, Inc.
Index69
Contents
VMware, Inc. 5
Using VMware vCenter Orchestrator Plug-Ins
6 VMware, Inc.
Using VMware vCenter Orchestrator Plug-Ins
The Using VMware vCenter Orchestrator Plug-Ins provides information and instructions about configuring and
using the official set of plug-ins installed with VMware® vCenter Orchestrator.
Intended Audience
This information is intended for advanced vSphere administrators and experienced system administrators
who are familiar with virtual machine technology and datacenter operations.
VMware, Inc. 7
Using VMware vCenter Orchestrator Plug-Ins
8 VMware, Inc.
Introduction to Orchestrator Plug-Ins1
Plug-ins allow you to use Orchestrator to access and control external technologies and applications. Exposing
an external technology in an Orchestrator plug-in allows you to incorporate objects and functions in workflows
that access the objects and functions of that external technology.
The external technologies that you can access by using plug-ins can include virtualization management tools,
email systems, databases, directory services, and remote control interfaces.
Orchestrator provides a set of standard plug-ins to allow you to incorporate such technologies as the VMware
vCenter Server API and email capabilities into workflows. In addition, the Orchestrator open plug-in
architecture allows you to develop plug-ins to access other applications. Orchestrator implements open
standards, to simplify integration with external systems. For information about developing custom content,
see Developing with VMware vCenter Orchestrator.
Plug-ins extend the Orchestrator scripting engine with new object types and methods, and plug-ins publish
notification events from the external system that trigger events in Orchestrator and in the plugged-in
technology. Plug-ins provide an inventory of JavaScript objects that you can access on the Orchestrator
Inventory tab. Each plug-in can provide one or more packages of workflows and actions that you can run on
the objects in the inventory to automate the typical use cases of the integrated product.
This chapter includes the following topics:
n
“Orchestrator Architecture,” on page 9
n
“Default Orchestrator Plug-Ins,” on page 10
n
“Access the Orchestrator API Explorer,” on page 12
Orchestrator Architecture
Orchestrator contains a workflow library and a workflow engine to allow you to create and run workflows
that automate orchestration processes. You run workflows on the objects of different technologies that
Orchestrator accesses through a series of plug-ins.
Orchestrator provides a standard set of plug-ins, including a plug-in for vCenter Server, to allow you to
orchestrate tasks in the different environments that the plug-ins expose.
Orchestrator also presents an open architecture to allow you to plug in external third-party applications to the
orchestration platform. You can run workflows on the objects of the plugged-in technologies that you define
yourself. Orchestrator connects to a directory services server to manage user accounts, and to a database to
store information from the workflows that it runs. You can access Orchestrator, the Orchestrator workflows,
and the objects it exposes through the Orchestrator client interface, through a Web browser, or through Web
services.
Orchestrator includes a collection of plug-ins. Each plug-in exposes an external product API to the Orchestrator
platform. Plug-ins provide inventory classes, extend the scripting engine with new object types, and publish
notification events from the external system. Each plug-in can also provide a library of workflows that
represents the typical use cases of the integrated product in an automated fashion.
You can see the list of available plug-ins from the Plug-ins tab in the Orchestrator configuration interface. Plug-
ins that require configuration add separate tabs to the interface.
Table 1-1. Plug-Ins Installed with Orchestrator by Default
Provides access to the
vCenter Server 4.1 API, so
that you can incorporate all
of the vCenter Server objects
and functions into the
management processes that
you use Orchestrator to
automate.
as basic building blocks for
customization and
automation of client
processes. The workflow
library includes templates
for lifecycle management,
provisioning, disaster
recovery, hot backup, and
many other standard
processes. Sources of library
processes are accessible and
can be copied and edited.
(JDBC) API is the industry
standard for databaseindependent connectivity
between the Java
programming language and
a wide range of databases.
The databases include SQL
databases and other tabular
data sources, such as
spreadsheets or flat files. The
JDBC API provides a calllevel API for SQL-based
database access from
workflows.
SSHProvides an implementation
of the Secure Shell v2 (SSH-2)
protocol. Allows remote
command and file transfer
sessions with password and
public key-based
authentication in workflows.
Optionally, the SSH plug-in
can provide remote file
system browsing directly in
the vCO inventory.
XMLA complete Document
Object Model (DOM) XML
parser that you can
implement in workflows.
Alternatively, you can use
the ECMAScript for XML
(E4X) implementation in the
Orchestrator JavaScript API.
MailUses Simple Mail Transfer
Protocol (SMTP) to send
email from workflows.
NetWraps the Jakarta Apache
Commons Net Library.
Provides implementations of
Telnet, FTP, and POP3. The
POP3 part allows reading
email. In combination with
the Mail plug-in, the Net
plug-in provides full email
sending and receiving
capabilities in workflows.
enumerated types that can be
used in workflows by other
plug-ins.
A Web view that allows you
to access the workflows in
the Orchestrator library and
interact with them across a
network by using a Web
browser. See Administering
VMware vCenter Orchestrator,
Weboperator Web View.
Plug-In Components
Each plug-in is a DAR file package. The DAR files are stored in
server\server\vmo\plugins on the Orchestrator server system. The components of each plug-in, such as
workflow categories and API modules, can use different naming conventions.
Table 1-2. Names of Plug-In Components
Plug-In Name in the
Configuration UIDAR Name
vCenter Server 4.1
vCO Library
Database
SSH
XML
Mail
Net
Common
enumerated types
vCO WebOperator
o11nplugin-vsphere41.dar
o11nplugin-library.dar
o11nplugin-jdbc.dar
o11nplugin-ssh.dar
o11nplugin-xml.dar
o11nplugin-mail.dar
o11nplugin-jakartacommonsnet.dar
o11nplugin-enums.dar
o11nplugin-weboperator.dar
NoneJavaScript
Enumerations
NoneNoneNoneExposes
Orchestrator_installation_path
Workflow
CategoriesAPI Module
vCenter
Locking
Orchestrator
Troubleshooting
JDBC
SSH
XML
Mail
None
None
NoneN/A
NoneExposes
nothing in
the
inventory.
nothing in
the
inventory.
\app-
VC
N/A
Database
SSH
XML
Mail
Net
Enums
Access the Orchestrator API Explorer
Orchestrator provides an API Explorer to allow you to search the Orchestrator API and see the documentation
for JavaScript objects that you can use in scripted elements.
You can consult an online version of the Scripting API for the vCenter Server plug-in on the Orchestrator
documentation home page.
12 VMware, Inc.
Chapter 1 Introduction to Orchestrator Plug-Ins
Procedure
u
Access the API Explorer from either the Orchestrator client or from the Scripting tabs of the workflow,
policy, and action editors.
n
To access the API Explorer from the Orchestrator client, click Tools > API Explorer in the Orchestrator
client tool bar.
n
To access the API Explorer from the Scripting tabs of the workflow, policy, and action editors, click
Search API on the left.
The API Explorer appears, allowing you to search all the objects and functions of the Orchestrator API.
What to do next
Use the API Explorer to write scripts for scriptable elements.
VMware, Inc. 13
Using VMware vCenter Orchestrator Plug-Ins
14 VMware, Inc.
Using the vCenter Server 4.1 Plug-In2
You can use the vCenter Server 4.1 plug-in to manage multiple vCenter Server hosts. You can create workflows
that use the vCenter Server plug-in API to automate tasks in your vCenter Server environment.
The vCenter Server plug-in maps the vCenter Server API to the JavaScript that you can use in workflows. It
also provides actions that perform individual vCenter Server tasks that you can include in workflows.
The vCenter Server plug-in provides a library of standard workflows that automate vCenter Server operations.
For example, you can run workflows that create, clone, migrate, or delete virtual machines.
This chapter includes the following topics:
n
“Configure the vCenter Server 4.1 Plug-In,” on page 15
n
“vCenter Server 4.1 Plug-In Scripting API,” on page 16
n
“vCenter Server Scripting Examples,” on page 16
n
“Using the vCenter Server 4.1 Plug-In Inventory,” on page 18
n
“Access the vCenter Server 4.1 Plug-In Workflow Library,” on page 18
n
“vCenter Server 4.1 Plug-In Workflow Library,” on page 19
Configure the vCenter Server 4.1 Plug-In
Orchestrator uses the vCenter Web Service API to control vCenter Server. You can set the parameters to enable
Orchestrator to connect to your vCenter Sever instances.
Prerequisites
Import the SSL certificates for each vCenter Server instance you define. For more information, see Installing
and Configuring VMware vCenter Orchestrator.
Procedure
1Log in to the Orchestrator configuration interface as vmware.
2Click vCenter Server 4.1.
3Click New vCenter Server Host.
4From the Available drop-down menu, select Enabled.
5In the Host text box, type the IP address or the DNS name of the vCenter Server host.
6In the Port text box, retain the default value, 443.
7(Optional) Select the Secure channel check box to establish a secure connection to your vCenter Server
host.
VMware, Inc.
15
Using VMware vCenter Orchestrator Plug-Ins
8In the Path text box, retain the default value, /sdk.
This is the location of the SDK that you use to connect to your vCenter Server instance.
9In the User name and Password text boxes, type the credentials for Orchestrator to use to establish the
connection to the vCenter Server host.
The user that you select must be a valid user with administrative privileges on your vCenter Server,
preferably at the top of the vCenter Server tree structure. Orchestrator uses these credentials to monitor
the vCenter Web service (typically to operate Orchestrator system workflows). All other requests inherit
the credentials of the user who triggers an action.
10 Specify the method you use to manage user access on the vCenter Server host.
OptionAction
Share a unique session
Session per user
11 Click Apply changes.
Select this option to allow Orchestrator to create only one connection to
vCenter Server. Type the credentials of a user who is a vCenter Server
administrator.
Select this option if your vCenter Server is in an Active Directory domain.
Make sure that the user has the necessary permissions to perform the
required operations.
CAUTION Each user who logs in to Orchestrator creates a new session to
vCenter Server. This might rapidly use CPU, memory, and bandwidth.
The URL to the newly configured vCenter Server host is added to the list of defined hosts.
12 Repeat Step 3 through Step 11 for each vCenter Server instance.
vCenter Server 4.1 Plug-In Scripting API
The VC scripting API contains classes, with their respective attributes, methods, and constructors that allow
interaction between vCenter Orchestrator and vCenter Server. You can use the API to develop custom
workflows.
Workflow scripted elements can include scripting of common vCenter Server tasks. You can cut, paste, and
adapt these examples into your scripted elements.
Access Managed Object Types
The following JavaScript example allows Orchestrator to use scripting to access vCenter Server managed
objects through the vCenter Server plug-in.
var vm = ...;
// Get the property 'name'
var name = vm.name; // returns a string
// return a VcEnvironmentBrowser managed object
var environmentBrowser = vm.environmentBrowser;
16 VMware, Inc.
Chapter 2 Using the vCenter Server 4.1 Plug-In
Access Managed Object Reference Types
The following JavaScript example allows Orchestrator to access data objects with the return type
ManagedObjectReference. Getters and setters that end with
List<ManagedObjects>
// virtualMachine is a workflow input parameter
var virtualMachineSnapshotInfo = virtualMachine.snapshot;
var virtualMachineSnapshot = virtualMachineSnapshotInfo.currentSnapshot;
// The reverse operation
virtualMachineSnapshotInfo.currentSnapshot = virtualMachineSnapshot;
.
_ManagedOjects
return
ManagedObject
In versions of Orchestrator earlier than 4.1, you must use the toManagedObject() method to convert object
references, for example workflow input parameter objects, to managed objects. The following JavaScript
operation works in Orchestrator 4.1, but it is no longer necessary.
// vCenter Server 4.0 plug-in code
var virtualMachineSnapshot = VcPlugin.toManagedObject(
virtualMachine, virtualMachineSnapshot);
Handle Enumeration Types
or
The following JavaScript example allows Orchestrator to use scripting to handle vCenter Server enumerations
through the vCenter Server plug-in.
// a VcSharesLevel FINDER ENUMERATION TYPE, for example
// received from an input parameter
var sharesLevel = ...
// get the String value of the FINDER ENUMERATION TYPE
var sharesLevelString = sharesLevel.value;
// Assign to a DataObject
var sharesInfo = new VcSharesInfo();
sharesInfo.level = sharesLevel;
Discover Host Machines and Virtual Machines
The following JavaScript example allows Orchestrator to use scripting to find host machines and virtual
machines through the vCenter Server plug-in.
var sdkConnections = VcPlugin.allSdkConnections;
System.log(sdkConnections.length + " SdkConnections found");
for (var i = 0; i < sdkConnections.length; i++) {
var sdkConnection = sdkConnections[i];
System.log("SdkConnection '" + sdkConnection.id + "'");
// Hierarchy entry point
var rootFolder = sdkConnection.rootFolder;
// Get the property 'name'
var name = rootFolder.name;
System.log("--- Root folder '" + name + "'");
// Get the folder's data centers
VMware, Inc. 17
Using VMware vCenter Orchestrator Plug-Ins
var datacenters = rootFolder.datacenter;
if (datacenters != null) {
for (var j = 0; j < datacenters.length; j++) {
var datacenter = datacenters[j];
System.log("--- Datacenter '" + datacenter.id + "'");
}
}
// Method to get all the virtual machines in a vCenter Server host
var vms = sdkConnection.getAllVirtualMachines();
if (vms != null) {
for (var j = 0; j < vms.length; j++) {
var vm = vms[j];
System.log("--- VM '" + vm.id + "'");
System.log("--- VM '" + vm.name + "'");
var guestInfo = vm.guest;
System.log("--- VM guestInfo '" + guestInfo + "'");
if (guestInfo != null) {
System.log("--- VM guestInfo.guestFamily '" + guestInfo.guestFamily + "'");
}
}
}
}
Set vCenter Server Option Values
The following JavaScript example allows Orchestrator to set vCenter VcOptionManager option values.
var myVcOptionValue = new VcOptionValue();
myVcOptionValue.key = VimAdvancedOptionKey;
myVcOptionValue.value_LongValue = VimAdvancedOptionValue;
You can set the following optional value types as VcOptionValue attributes.
value
value_FloatValue
value_IntValue
value_LongValue
Attribute is a string value.
Attribute value is a float value.
Attribute value is an integer value.
Attribute value is a long value.
Using the vCenter Server 4.1 Plug-In Inventory
The vCenter Server plug-in exposes all objects of the connected vCenter Server hosts in the Inventory view.
You can use the Inventory view to add authorization elements or to run workflows on vCenter Server objects.
If the Use contextual menu in inventory option is enabled, all of the workflows that you can run on the selected
inventory object appear in a contextual menu.
Access the vCenter Server 4.1 Plug-In Workflow Library
You must use the Orchestrator client to access the elements from the vCenter Server 4.1 plug-in workflow
library.
Prerequisites
n
The vCenter Server 4.1 plug-in must be enabled and configured in the Orchestrator configuration interface.
18 VMware, Inc.
n
You must be logged in to the Orchestrator client as a user who can run vCenter workflows.
Procedure
1Click the Workflows view in the Orchestrator client.
2Expand the hierarchical list to Library > vCenter.
What to do next
Review the workflow library.
vCenter Server 4.1 Plug-In Workflow Library
The vCenter Server 4.1 plug-in workflow library contains workflows that allow you to run automated processes
related to the management of vCenter Server.
Batch Workflows
You access these workflows from Library > vCenter > Batch.
Chapter 2 Using the vCenter Server 4.1 Plug-In
Fill batch configuration
elements
Run a workflow on a
selection of objects
Populates the configuration elements that the Run a workflow on a selection
of objects workflow uses. Resets the BatchObject and BatchAction
configuration elements. Fills the BatchObject configuration element with all of
the workflows that have only one input parameter. Fills the BatchAction
configuration element with all of the actions that have no input parameters or
one input parameter and that have an array as the returnType.
Runs a workflow on a selection of vCenter Server objects, taking one action as
input. This is the action that retrieves the list of objects on which to run the
workflow. To return the objects without running the selected workflow, run
the workflow in simulation mode.
Cluster and Compute Resource Workflows
You access these workflows from Library > vCenter > Cluster and Compute Resource.
Create cluster
Delete cluster
Disable HA on cluster
Enable HA on cluster
Rename cluster
Creates a new cluster in a given host folder.
Deletes a given cluster.
Disables high availability on a given cluster.
Enables high availability on a given cluster.
Renames a given cluster.
Custom Attribute Workflows
You access these workflows from Library > vCenter > Custom Attributes.
Add custom attribute to
a virtual machine
Add custom attribute to
multiple virtual
machines
Get custom attribute
VMware, Inc. 19
Adds a custom attribute to a given virtual machine.
Adds a custom attribute to a selection of virtual machines.
Gets a custom attribute for a given virtual machine in vCenter Server.
Using VMware vCenter Orchestrator Plug-Ins
Datacenter Workflows
You access these workflows from Library > vCenter > Datacenter.
Create datacenter
Delete datacenter
Reload datacenter
Rename a datacenter
Rescan datacenter
HBAs
Creates a new datacenter in a given datacenter folder and returns the new
datacenter.
Deletes a given datacenter.
Forces vCenter Server to reload data from a datacenter.
Renames a given datacenter and waits for the task to complete.
Scans the hosts in a datacenter and initiates a rescan on the host's HBAs to
discover new storage.
Datastore and Files Workflows
You access these workflows from Library > vCenter > Datastore and Files.
Delete all files
Delete all unused
datastore files
Export unused datastore
files
Find unused files in
datastores
Deletes a list of files.
Searches all datastores in the vCenter Server environment and deletes all
unused files.
Searches all datastores and creates and XML descriptor file that lists all unused
files.
Searches the vCenter Server environment for all unused disks (*.vmdk), virtual
machines (*.vmx), and template (*.vmtx) files that are not associated with any
vCenter Server instances that are registered with Orchestrator.
Get all configuration,
template, and disk files
from virtual machines
Log all datastore files
Log unused datastore
files
Creates a list of all virtual machine descriptor files and a list of all virtual
machine disk files, for all datastores.
Creates a log for every virtual machine configuration file and every virtual
machine file found in all datastores.
Searches the vCenter Server environment for unused files that are registered
on virtual machines and exports a log of the files in a text file.
Datacenter FolderManagementWorkflows
You access these workflows from Library > vCenter > Folder management > Datacenter folder.
Create datacenter folder
Delete datacenter folder
Rename datacenter
folder
Creates a datacenter folder and returns it.
Deletes a datacenter folder and waits for the task to complete.
Renames a datacenter folder and waits for the task to complete.
20 VMware, Inc.
Chapter 2 Using the vCenter Server 4.1 Plug-In
Host FolderManagementWorkflows
You access these workflows from Library > vCenter > Folder management > Host folder.
Create host folder
Delete host folder
Rename host folder
Creates a host folder and returns it.
Deletes a host folder and waits for the task to complete.
Renames a host folder and waits for the task to complete.
Virtual Machine FolderManagementWorkflows
You access these workflows from Library > vCenter > Folder management > VM folder.
Create virtual machine
folder
Delete virtual machine
folder
Rename virtual machine
folder
Creates a virtual machine folder.
Deletes a virtual machine folder and waits for the task to complete.
Renames a virtual machine folder and waits for the task to complete.
Basic HostManagementWorkflows
You access these workflows from Library > vCenter > Host management > Basic.
Enter maintenance
mode
Exit maintenance mode
Puts the host into maintenance mode. The task can be canceled.
Exits maintenance mode. The task can be canceled.
Move host into cluster
Move host to folder
Reload host
Moves an existing host into a cluster. The host must be part of the same
datacenter, and if the host is part of a cluster, the host must be in maintenance
mode.
Moves a host into a folder as a standalone host (ComputeResource). The host
must be part of a ClusterComputeResource in the same datacenter and the host
must be in maintenance mode.
Forces vCenter Server to reload data from an ESX host.
Host Management Power Workflows
You access these workflows from Library > vCenter > Host management > Power.
Reboot host
Shut down host
Reboots a host. If the Orchestrator client is connected directly to the host, it
does not receive any indication of success in the returned task, but rather loses
the connection to the host if the operation succeeds.
Shuts down a host. If the Orchestrator client is connected directly to the host,
it does not receive any indication of success in the returned task, but rather
loses the connection to the host if the operation succeeds.
VMware, Inc. 21
Loading...
+ 49 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.