Home  Administration > CMDB Administration > Source Manager Administration > Custom Source Adapter Details > XML File



XML File

The XML File source retrieves topology information from an XML file produced by an external system that you define. The XML file contains the definition of CIs. This source includes a predefined generic adapter.

For more details about the source's template, see XML File Template.

XML File Parameters

The source parameters in the New Source or Edit Source dialog box are:

When to Use XML File Source Adapter

Use the XML File source adapter when you want to create a hierarchy that is different from the hierarchies offered by the other source adapters.

The user with the appropriate permissions that creates an XML File source adapter must know how the data is stored in the CMDB (using the CI Type manager).

Scenario

You want to create a hierarchy and a view that includes hosts and monitors as follows:

Example of XML File tree of information

The hierarchy is as follows:

XML File example view hierarchy

The view is as follows:

XML File example view

The steps to follow to create such a hierarchy are:

Writing the XML File Template

Use the following XML File template:

<adapterTemplate>

<description>Customized XML Adapter</description>

<type>XML File</type>

<logicType>User Experience</logicType>

<classPath>com.mercury.topaz.tdm.adapters.XMLFileAdapter.XMLFileAdapterImpl</classPath>

<autoMapEntities>true</autoMapEntities>

<autoMappingEntities>

<entity id="monitor">

<basicEntity>Mercury:sitescope_monitor</basicEntity>

<contextmenu>ssMonitorMenu</contextmenu>

<dimensions>

<dimension id="1">

<logics>

<logic id="4" />

</logics>

<selectors type="AND">

<selector key="sampleType" operator="EQ" value="ss_monitor_t" dataType="String" readOnly="true" />

<selector key="u_iConnectionId" operator="EQ" value="" dataType="Long" reference="true" referencedProperty="monitor_id" />

<selector key="u_iSessionId" operator="EQ" value="" dataType="Long" reference="true" referencedProperty="session_id" />

</selectors>

</dimension>

</dimensions>

</entity>

<entity id="machine">

<basicEntity>host</basicEntity>

<contextmenu>groupMenu</contextmenu>

<dimensions>

<dimension id="1">

<logics>

<logic id="1" />

</logics>

</dimension>

</dimensions>

</entity>

</autoMappingEntities>

<autoMappingLinks>

<link type="Mercury:monitored_by" src_obj_type="host" dest_obj_type=
"Mercury:sitescope_monitor" weight="1" />

</autoMappingLinks>

<displayNameMapping />

</adapterTemplate>

The template maps the following elements:

entity id
basicEntity
contextmenu
dimension (KPI)
logic
(business rule)
monitor
Mercury:
sitescope_
monitor
ssMonitorMenu - SiteScope Monitor Menu
1 - System
4 - SiteScope Monitor
machine
host
groupMenu - Group Menu
1 - System
1 - Worst Child

The monitor entity has the following selectors:

<selectors type="AND">

<selector key="sampleType" operator="EQ" value="ss_monitor_t" dataType="String" readOnly="true" />

<selector key="u_iConnectionId" operator="EQ" value="" dataType="Long" reference="true" referencedProperty="monitor_id" />

<selector key="u_iSessionId" operator="EQ" value="" dataType="Long" reference="true" referencedProperty="session_id" />

</selectors>

The following relationships are defined:

<autoMappingLinks>

<link type="Mercury:monitored_by" src_obj_type="host" dest_obj_type="Mercury:sitescope_monitor" weight="1" />

</autoMappingLinks>

Writing the Configuration File

Use the following xmlFile.xml file where one host is monitored by two monitors:

<?xml version="1.0" encoding="UTF-8" ?>

<extSysGraph>

<generalData>

<properties />

</generalData>

<entities>

<entity type="monitor">

<name>Monitor 1</name>

<idProperties>

<property dataType="Long" key="monitor_id" value="123" />

<property dataType="Long" key="session_id" value="1" />

</idProperties>

<children />

<parents>

<idProperties>

<property dataType="String" key="host_key" value="mymachine" />

</idProperties>

</parents>

</entity>

<entity type="monitor">

<name>Monitor 2</name>

<idProperties>

<property dataType="Long" key="monitor_id" value="456" />

<property dataType="Long" key="session_id" value="1" />

</idProperties>

<children />

<parents>

<idProperties>

<property dataType="String" key="host_key" value="mymachine" />

</idProperties>

</parents>

</entity>

<entity type="machine">

<name>mymachine</name>

<idProperties>

<property dataType="String" key="host_key" value="mymachine" />

</idProperties>

<properties>

<property dataType="String" key="host_dnsname" value="mymachine.mydomain.com" />

<property dataType="String" key="host_hostname" value="mymachine" />

</properties>

<children>

<idProperties>

<property dataType="Long" key="monitor_id" value="123" />

<property dataType="Long" key="session_id" value="1" />

</idProperties>

<idProperties>

<property dataType="Long" key="monitor_id" value="456" />

<property dataType="Long" key="session_id" value="1" />

</idProperties>

</children>

<parents />

</entity>

</entities>

</extSysGraph>

The guidelines to create a configuration file are as follows:

Creating an XML File Source Adapter that Monitors Hosts and Monitors

To create an XML File source adapter that monitors hosts and monitors you must modify the default source adapter template, save the configuration file in the appropriate location, and you must create a view.

To create an XML File source adapter that monitors hosts and monitors:

  1. In the Source Manager tab, click the New Source button to open the New Source window and select the XML File source adapter in the Type box.
  2. Click Edit Template. The window expands to display the adapter template in the Template box.
  3. Note: Use the window scrollbar and the Template box scrollbar to display the areas of the template you want to modify or highlight the text in the Template box, copy it to a text editor, make the appropriate changes and copy the text back into the Template box.

  4. Copy the first part of the XML File template provided in the example above from <autoMappingEntities> to </autoMappingEntities> (tags included) and insert it in the XML File template between <autoMappingEntities bac-version="BAC 6.0"> and </autoMappingEntities> and erase the rest of the file.
  5. Copy the second part of the XML File template provided in the example above from <autoMappingLinks> to </autoMappingLinks> (tags included) and insert it in the XML File template after </autoMappingEntities> (included).
  6. Save the xmlFile.xml file (shown above) in a specific location; for example:
    <Mercury Business Availability Center server root directory>/
    CMDB/adapters/templates/xmlFile.xml
    and enter the path in the Path box in the source adapter definition.

  7. Create a pattern specific for the structure that is used in the xmlFile.xml file - for details, see Working with Pattern Views in View Manager Administration.



Copyright 2006 Mercury Interactive Corporation