Set Up Health Monitoring for a Solution
Last Updated December 19, 2024

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.
  • Verify that you have set up and started the EAM Sample Solution in an application server.
  • Verify that you have opened
    eam_work_folder
    \src\com\vmware\eam\sample\solution\Manager.java
    in an editor.
  • Examine the code of the
    VimHealthProvider.java
    and
    HealthStatusServlet.java
    classes to see how they extract health data from the EAM Sample Solution and publish it in an XML file.
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
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
. Solutions can provide the following statuses to
:
  • 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.
The EAM Sample Solution provides two classes that provide health data about the solution. You find these classes in
eam_work_folder
\src\com\vmware\eam\sample\solution\health
.
  • VimHealthProvider.java
    defines the health statuses for the EAM Sample Solution.
  • HealthStatusServlet.java
    dynamically creates the XML file in which the solution exposes health status data. For an example of the XML file that
    HealthStatusServlet.java
    creates, see Contents of the EAM Sample Solution Health XML File .
In the EAM Sample Solution, the
Manager.java
class implements
ExtensionHealthInfo
. The
Manager.java
class sets a URL to a health definition XML file in the
ExtensionHealthInfo
url
property. The URL that
Manager.java
provides is the path to the
health.xml
file that
HealthStatusServlet.java
creates.
  1. Create a program that defines the health statuses of the solution.
    The EAM Sample Solution defines the health statuses in the
    VimHealthProvider.java
    class.
  2. Create a program that creates an XML file that exposes the health status data, conforming to the VMware health service XSD.
    The EAM Sample Solution creates the health data XML file in the
    HealthStatusServlet.java
    class.
    HealthStatusServlet.java
    implements
    VimHealthProvider
    to 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 that
    VimHealthProvider
    provides.
  3. Create an instance of
    ExtensionHealthInfo
    in the program that manages the solution.
    The EAM Sample Solution implements
    ExtensionHealthInfo
    in
    Manager.java
    .
    private Extension createExtensionObject() { 
      Extension extension = new Extension();
      [...]
      ExtensionHealthInfo healthInfo = new ExtensionHealthInfo();
      [...]
    }
  4. Call the
    ExtensionHealthInfo.setUrl()
    method to set the URL at which the solution publishes its health data XML file.
    The EAM Sample Solution publishes an XML file,
    health.xml
    , that the
    HealthStatusServlet.java
    class generates.
    healthInfo.setUrl(_url.toString() + "/health/health.xml");
  5. Call the
    Extension.setHealthInfo()
    method to add the
    ExtensionHealthInfo
    object to the solution
    Manager.java
    provides a link to the
    health.xml
    XML file that the
    HealthStatusServlet.java
    class generates.
    private Extension createExtensionObject() { 
      Extension extension = new Extension();
      [...]
      ExtensionHealthInfo healthInfo = new ExtensionHealthInfo();
      healthInfo.setUrl(_url.toString() + "/health/health.xml");
      extension.setHealthInfo(healthInfo);
      [...]
    }
Contents of the EAM Sample Solution Health XML File
The EAM Sample Solution publishes health data at
http://
<solution_ip_address>
:
<solution_port>
/eam-sample/health/health.xml
. The
HealthStatusServlet.java
class in the EAM Sample Solution generates this file when the solution starts. This example shows the XML file that
HealthStatusServlet.java
generates when the EAM Sample Solution is running correctly.
<vimhealth schemaVersion="1.0">
  <health id="com.vmware.eam.sample.solution">
    <name>EAM Sample Solution</name>
    <status>green</status>
    <message id="com.vmware.eam.sample.solution" level="info" time="current date and time">Running</message>
  </health>
</vimhealth>