Disclaimer: The explanations below are based on my newbie understandings.
Templates are found at Manage > Knowledge > Creating Patterns.
This example was template_cmdb_location (for Hosts) and I made changes for our requirements.
The pattern for Storage Devices will only work if you have the Storage System TKU.
We don't have this TKU at the moment, so the pattern is untested.
Caution: BMC Discovery is case-sensitive.
// This pattern is in the public domain.
A. This is the name of the module.
If a new pattern with the same name is uploaded, then the existing one is automatically disabled.
tpl 1.5 module CMDB.Extension.Host_Location;
B. Not sure how helpful “origin” is, but I like the Tree Path navigation.
(See screenshot below.)
origin := "COMPANY";
tree_path := "COMPANY", "CMDB Sync", "Location", "Host";
C. This import statement takes advantage of existing patterns and/or taxonomy.
There is a module called CMDB.Host_ComputerSystem which contains
a syncmapping section called Host_ComputerSystem.
from CMDB.Host_ComputerSystem import Host_ComputerSystem 2.0;
D. Give a name and version to the syncmapping section.
syncmapping Host_Location 1.0
Populate BMC_PhysicalLocation and relate to BMC_ComputerSystem.
D.b These tags are good for searching.
tags CMDB, Extension, Location;
D.c Creating an alias/nickname for “host” using the import from section C above.
The module we imported contains “mapping on Host as host” in the syncmapping section.
It seems that we use Host_ComputerSystem.host (with little-h) from the imported
module to create a nickname of host (also with little-h) that is used once in this module.
It seems to be the origin for the traversal and is not used afterward.
mapping from Host_ComputerSystem.host as host
D.c.a Go to your Taxonomy page. Administration > Model > View Taxonomy.
Search for “ElementInLocation” and you will find 32 hits.
The location (with little-l) is a nickname/alias for this traversal.
Location (with big-l) has 8 attributes. (3 unique and 5 inherited from Category.)
Some of these attributes will be called in section D.f.
traverse ElementInLocation:Location:Location:Location as location
D.c.b The alias “phys_loc” is used in sections D.f and D.g.
phys_loc -> BMC_PhysicalLocation;
D.e.a Another nickname/alias from the module imported in section C.
ci_computersystem := Host_ComputerSystem.computersystem;
D.e.b It’s a loop. It’s in the template and it works.
for each location do
if location.key then
key := location.key;
key := location.name;
D.f Do you remember sections D.c.a and D.c.b above?
Which location attributes do you want to send to Remedy CMDB? (from section D.c.a)
phys_loc was aliased in section D.c.b.
We wanted different Category, Type and Item values.
We also wanted something in Model.
You can change the attributes and which Remedy fields are populated.
phys_loc := sync.shared.BMC_PhysicalLocation(
key := key,
Name := location.name,
ShortDescription := location.abbreviation,
Description := location.description,
Address := location.address,
Category := "Location",
Type := "Site",
Item := "Device Discovery",
Model := "Site Location"
D.g Section D.f above is for the location attributes that are related to the host.
This section adds information to the Relationship database table in Remedy CMDB.
It uses aliases from sections D.c.b and D.e.a.
Source := ci_computersystem,
Destination := phys_loc,
Name := "ELEMENTLOCATION"
D.h Finished with everything.