This topic explains how to configure the mappings required for importing assets from XML files through an integration task. These mappings must be entered in the Mapping Configurations field when creating the task. For details on creating the task itself, see Chapter 17: Administration -> Integrations -> Integration Tasks -> Creating a Task to Import Assets from an XML File.
Listed below are all the fields that must be mapped to register an asset from an XML file. All custom asset attributes, except for Relationship, Attachment and Formula attributes, can be mapped through an integration task.
Variable |
Description |
Required? |
Limit/Format |
source |
Identifies where the assets were imported from. |
Yes |
100 characters |
id |
Unique identifier for the asset. |
Yes |
N characters |
name |
Asset name. |
Yes |
400 characters |
type |
Asset type. |
Yes |
Technology, Person, Environment, Process, or name of custom asset type |
description |
Asset description. |
No |
N characters |
hostaddress |
Host address of the asset, which may be a DNS name, a NetBIOS name, or an IP address. |
No |
100 characters |
relevance |
Asset relevance, by default set to 3. |
No |
1 - 5 |
analysisFrequency |
Frequency which the asset should be analyzed in terms of the number of days. |
No |
0 - 1000 |
responsible |
Person responsible for the asset, by default defined in the mapping. |
No |
Name of a person registered in the system. |
criticality |
Criticality of the asset. |
No |
0 - 100 |
location/latitude |
Latitude of where the asset is located. |
No |
-90 to +90 |
location/longitude |
Longitude of where the asset is located. |
No |
-180 to +180 |
location/description |
Description of where the asset is located. |
No |
1,000 characters |
Note that if the field to define the person responsible for the asset is left blank or if there is more than one person under the name provided, the person selected in the Responsible for Imported Objects field when creating the task will be assigned as responsible for the asset. To ensure a person is uniquely identified, the combination of their names and e-mail addresses can be used.
Example 1:
XML file: <responsible email="joe.smith@domain.com">Joe Smith</responsible>
Mapping: <responsible field="responsible" email="responsible/@email"/> |
Example 2:
XML file: <responsible >Joe Smith</responsible> <email>joe.smith@domain.com</email>
Mapping: <responsible field="responsible" email="email"/> |
To write these mappings, you must inform the node in which the details of each asset is located. This configuration is made through the basePath by writing the absolute Xpath for the respective path in the XML file. From this point on, the fields must be mapped through the Xpath related to this basePath. The basePath can be grouped by asset type, allowing distinct behavior for different asset types in a single integration task. If there are more complex conditions not met by separating asset types, separate integration tasks can be created to categorize this information.
The following features are also available:
• Conversion/mapping of values to match the values accepted by the system. For example:
<relevance field="level">
<mappings>
<add from="Ignore" to="1" />
<add from="Low Relevance" to="2" />
<add from="Normal" to="3" />
<add from="Important" to="4" />
<add from="Critical" to="5" />
</mappings>
</relevance>
• Converting content into a hash md5. Note that some softwares do not provide a unique identifier for each asset, in which case it must be generated. In the example, this resource is generated based on the custom attribute named “uniqueid”.
<id hashed="true" field="description" object="CustomAttribute/uniqueid" />
• Defining default values for fields not included in the report, or which must always be imported with a default value.
<relevance default="3"/>
• Limit the size of a certain field to respect the system limits. If the limit is left undefined, an error will occur every time a file with content exceeding the allowed limit is imported. If the "truncate" parameter is not used, it will be considered "false".
<description field="description" truncate="true" />
• Define mappings for custom and default types of assets.
<type field="type">
<mappings>
<add from="tech" to="Technology" />
<add from="staff" to="Person" />
<add from="site" to="Environment" />
<add from="department" to="Process" />
<add from="supplier" to="Vendor" />
</mappings>
</type>
• Define mappings for custom attributes, where the following custom attribute types are supported: Date/Time (Date, Date/Time, and Time), E-mail, Link, List of Options (Single Selection and Multiple Selection), Number (respecting the maximum/minimum values and number of decimal places), Paragraph, Text (respecting the maximum/minimum values and regular expression mask), and Outline (bulleted and numbered lists).
• Note that the values from the file must be compatible with the values accepted by the attribute. Otherwise, the asset will be imported and an error message will be displayed in the history of the integration task. Thus, maximum and minimum values, the number of decimal places, and any regular expression masks created for attributes must be respected. The variable name of the attribute should be used when creating the mappings.
<customAttributes>
<attribute field="department" object="area"/>
</customAttributes>
• Define formatting of numbers and dates, according to the format defined for a language. This feature is used through the "culture" parameter and is available for Date/Time (Date, Date/Time, and Time) and Number attributes. For example:
Double: 83.29 with a period. Found in the "en" culture.
Double: 83,29 with a comma. Found in the "pt" culture.
<config version="1" source="XML File" type="xml_asset_import" culture="en">
For more information on the culture, see http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx.
• Define mappings of properties through the Xpath.
XML file:
<HostProperties>
<tag name="netbios-name">MODSIC-SERVER</tag>
</HostProperties>
Mapping:
<name field="HostProperties/tag[@name='netbios-name']" />