How do I integrate a solution with vCenter
Server Extensions
vCenter
Server Extensions
You can use the vSphere Web Services API to add a solution to
vCenter
Server Extensions
.Add a solution to vCenter
Server Extensions
vCenter
Server Extensions
You add a solution to
vCenter
Server Extensions
by setting the shownInSolutionManager
property in the implementation of the Extension
data object that manages the solution.You can set the
shownInSolutionManager
property in the MyManager.java
class. - Call theExtSolutionManagerInfo()constructor to create an instance ofExtSolutionManagerInfoin the class that implementsExtension.You can add the following code to theMyManager.javaclass to create an instance ofExtSolutionManagerInfofor your solution.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] }
- Call thesetSolutionManagerInfo()method to set theExtSolutionManagerInfoinstance in the solution implementation.You can add the following code to theMyManager.javaclass to call thesetSolutionManagerInfo()method.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] extension.setSolutionManagerInfo(extSolutionManagerInfo); }
- Set the value of theshownInSolutionManagerproperty to true by calling thesetShownInSolutionManager()method on the implementation of theExtensionobject.You can add the following code to theMyManager.javaclass to set theshownInSolutionManagerproperty.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] extension.setSolutionManagerInfo(extSolutionManagerInfo); extension.setShownInSolutionManager(true); [...] }
You set the
shownInSolutionManager
property in the implementation of the Extension
data object that defines the solution. By setting the shownInSolutionManager
property to true
, a solution appears in vCenter
Server Extensions
when it registers with vCenter Server
.Set the icon for a type of virtual machine or vApp that an extension manages
You can provide an icon for each type of virtual machine or vApp that an extension manages by setting the
smallIconUrl
property of ExtManagedEntityInfo
.- Verify that you have set themanagedByproperty in the configuration of the virtual machines or vApps that an extension deploys. See Identify the virtual machines or vApps that an extension manages.
- Verify that you have created an instance ofExtManagedEntityInfoin the program that defines an extension.
The icon that you set with the
smallIconUrl
property of ExtManagedEntityInfo
allows you to identify the types of virtual machines or vApps that your extension deploys. If an extension deploys different types of virtual machines, you can create several ExtManagedEntityInfo
instances, with a different icon for each type. The virtual machines that the extension deploys appear in the vCenter Server
inventory with the icons that you set.The icon image must be in the PNG format and must measure 16 by 16 pixels. You must save the icon image to an appropriate location in the Web application that defines the extension. You provide a URL or path to the image to the
ExtManagedEntityInfo
instance for the type of virtual machine or vApp that this icon represents. Extensions access the icon image by using HTTP. Extensions do not support HTTPS URLs to icon images.- Create an icon image of typePNGand of dimensions 16 by 16 pixels.
- Save the icon image to an appropriate location in the Web application that defines your extension.
- CallExtManagedEntityInfo.setSmallIconUrl()to set thesmallIconUrlproperty for a type of virtual machine or vApp that the extension deploys.Extension extension = new Extension(); ExtManagedEntityInfo extManagedEntityInfo = new ExtManagedEntityInfo(); extManagedEntityInfo.setType("my_vm_type"); extManagedEntityInfo.setDescription("Description of this type of virtual machine or vApp."); extManagedEntityInfo.setSmallIconUrl("path_to_PNG_image"); extension.getManagedEntityInfo().add(extManagedEntityInfo);
Virtual machines and vApps that your extension deploys appear in the
vCenter Server
inventory with the icon that you set.Add tabs to a solution
When you create a solution, you can add tabs to your solution to allow users to configure the solution and to access the functions of the solution in the
vSphere Client
.You define the content of tabs as dynamic Web pages. For example, you can define tabs that allow you to perform the following kinds of actions.
- Configure the solution.
- Show events triggered by the solution events orvCenter Server.
- Deploy predefined virtual machines or vApps of different types.
- Monitor the solution application or the virtual machines that it deploys.
- Uninstall the solution.
You create tabs by implementing the
ExtSolutionManagerInfoTabInfo
data object in the program that manages the solution. You set properties in ExtSolutionManagerInfoTabInfo
to provide a label for the tabs and a URL to the dynamic Web pages that provide the content of the tabs. You create one ExtSolutionManagerInfoTabInfo
instance for each tab that you add to your solution. You pass that instance to ExtSolutionManagerInfo
in an array.How you define the content of the tabs depends on the function of the application that the solution adds to
vCenter Server
.You can implement
ExtSolutionManagerInfoTabInfo
in the MyManager.java
class.- Create an instance ofExtSolutionManagerInfoin the program that manages the solution.Add the following lines in theMyManager.javaclass to create an instance ofExtSolutionManagerInfo.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] }
- Create an instance ofExtSolutionManagerInfoTabInfoto contain the name of the page and a link to the Web page that defines its contents.ExtSolutionManagerInfoTabInfo extSolutionManagerInfoTabInfo = new ExtSolutionManagerInfoTabInfo();
- Call theExtSolutionManagerInfoTabInfo.setLabel()method to provide a name for the page.Add the following line toMyManager.javato name your solution Configuration page.extSolutionManagerInfoTabInfo.setLabel("Configuration");
- Call theExtSolutionManagerInfoTabInfo.setUrl()method to provide a URL to the Web page that defines the contents of your solution Configuration page.You can set inMyManager.javathat your solution uses theconfig.htmlWeb page to define the contents of the configuration page.extSolutionManagerInfoTabInfo.setUrl("/config.html");
- Add the tab to the array ofExtSolutionManagerInfoTabInfoinstances that define the tabs for the solution in theExtSolutionManagerInfoobject.extSolutionManagerInfo.getTab().add(extSolutionManagerInfoTabInfo);
You added solution-specific tabs that appear on the Summary page of your solution.
Set up health monitoring for the solution and the objects that it manages.
Set up health monitoring for a solution
vCenter Server
pulls data from solutions about their health status. Solutions expose health data by providing a URL to an XML file that defines the health model of the solution.All solutions must provide an XML file that specifies their health model. The health specification XML file for your solution must conform to the VMware Health Service extensible schema definition (XSD). See Solution health XML schema for the complete VMware solution health schema.
Solutions expose health data about themselves to
vCenter Server
by publishing XML documents that declare different health statuses, depending on the events that occur in the solution. You provide messages to accompany each health status in the XML document that the solution exposes to vCenter Server
. Solutions can provide the following statuses to vCenter Server
:- alert
- warning
- info
When you develop a solution, you must include a program or function that generates the health status XML file for the solution. The health status of a solution can be red, yellow, or green.
You must pass a URL to the XML file that defines the health model for a solution to the
ExtensionHealthInfo
object in the program that manages the solution. For example, you can create the following classes as part of your solution:- MyHealthProvider.javadefine the health statuses for your solution.
- MyHealthStatusServlet.javadynamically create the XML file in which the solution exposes health status data.
You can implement the
ExtensionHealthInfo
in the MyManager.java
class. The MyManager.java
class can set a URL to a health definition XML file in the ExtensionHealthInfo
url
property. The URL that MyManager.java
provides must be the path to the health.xml
file that MyHealthStatusServlet.java
will create.- Create a program that defines the health statuses of the solution.You can define the health statuses of your solution in theMyHealthProvider.javaclass.
- Create a program that creates an XML file that exposes the health status data, conforming to the VMware health service XSD.You can create the health data XML file in theMyHealthStatusServlet.javaclass.MyHealthStatusServlet.javaimplementsMyHealthProviderto extract the health status from the solution. The class creates an XML file,health.xml, that exposes the health data about the solution according to the health status thatMyHealthProviderprovides.
- Create an instance ofExtensionHealthInfoin the program that manages the solution.You can implementExtensionHealthInfoinMyManager.java.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtensionHealthInfo healthInfo = new ExtensionHealthInfo(); [...] }
- Call theExtensionHealthInfo.setUrl()method to set the URL at which the solution publishes its health data XML file.Your solution can publish an XML file,health.xml, that theMyHealthStatusServlet.javaclass generates.healthInfo.setUrl(_url.toString() + "/health/health.xml");
- Call theExtension.setHealthInfo()method to add theExtensionHealthInfoobject to the solution.MyManager.javacan provide a link to thehealth.xmlXML file that theMyHealthStatusServlet.javaclass generates.private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtensionHealthInfo healthInfo = new ExtensionHealthInfo(); healthInfo.setUrl(_url.toString() + "/health/health.xml"); extension.setHealthInfo(healthInfo); [...] }
Contents of a solution health XML file
Your solution can publish health data at
http://
. The <solution_ip_address>
:<solution_port>
/my_sample/health/health.xmlMyHealthStatusServlet.java
class in your solution can generate this file when the solution starts. This example shows the XML file that MyHealthStatusServlet.java
generates when your solution is running correctly.<vimhealth schemaVersion="1.0"> <health id="com.mycompany.mysolution"> <name>My Solution</name> <status>green</status> <message id="com.mycompany.mysolution" level="info" time="<current_date_and_time>">Running</message> </health> </vimhealth>
Solution health XML schema
Solutions must provide data about their health status to
vCenter Server
in XML documents.The health status XML documents that a solutions pushes to
vCenter Server
must conform to the VMware health schema.<?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://www.vmware.com/vi/healthservice" elementFormDefault="qualified" xmlns="http://www.vmware.com/vi/healthservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"> <xs:complexType name="healthType"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/> <xs:element name="status" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="green" /> <xs:enumeration value="yellow" /> <xs:enumeration value="red" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="message" minOccurs="0" maxOccurs="unbounded"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required"/> <xs:attribute name="level" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="info" /> <xs:enumeration value="warning" /> <xs:enumeration value="alert" /> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="time" type="xs:dateTime" use="required"/> </xs:complexType> </xs:element> <xs:element name="health" type="healthType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required"/> </xs:complexType> <xs:element name="vimhealth"> <xs:complexType> <xs:sequence> <xs:element name="health" type="healthType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="schemaVersion" type="xs:decimal" use="required"/> </xs:complexType> </xs:element> </xs:schema>