Share This:

Disclaimer:

Any patterns provided in the communities, provided by Users and by BMC employees are not part of the product, and are not necessarily thoroughly tested.

Use at your own risk.

NOTE: Please test all new patterns in a TEST environment!

============================================================================================================================

How to get Started creating CMDB Syncmapping Extension patterns:  Getting Started creating a CMDB Syncmapping Extension pattern

Info about custom patterns and syncmappings, how to test, etc:  Helix Support: Discovery custom patterns discussion

Sample syncmapping 'stubs' / starting points :  Helix Support: Discovery: Sharing my library of syncmapping extension stubs

Sample patterns and syncmappings posted by Lisa:  https://goo.gl/8KUS3S

============================================================================================================================

 

 

I have a small library of syncmapping stubs / starting-points which I have written or kept over the years.

The syncmappings are mostly just some "stubs" to insert actual logic into.

I have decided to share them with everyone in a zip file, attached.

 

See also this link for custom patterns (with useful logic included), and other blogs which I have shared on the Communities:  Lisa Keeler

 

To use the attached syncmapping stubs:

The first step would be to download the zip file and unzip it.  Take a look!

 

And, see this link: Getting Started creating a CMDB Syncmapping Extension pattern

 

As stated in the "Getting Started" link, you must first create a plan and specify the "Source" and "Target" of the data.

The "Source" is the data you want to get from Discovery.  The "Target" is the place where you want to put the data in the CMDB.

 

For example, say I want to get some data from a NetworkDevice node in Discovery, and put it into the BMC_ComputerSystem class in the CMDB.

So, the "source" is NetworkDevice.  The "target" is BMC_ComputerSystem.

 

My plan needs to also include the specific attributes or data I am interested in from the Source, and the specific attributes I want to populate in the Target.

So, let's say I have noticed that when the data source is a NetworkDevice, the TokenId in the CMDB on the BMC_ComputerSystem is not populated.

(It is true, OOTB, the TokenId is not populated for a NetworkDevice).

But, my company requires a TokenId to always be present on the BMC_ComputerSystem CI's in the CMDB.

 

So my plan is like this:

                Source:                                            Target:

                NetworkDevice                                      BMC_ComputerSystem

Attributes:        the hashed key of the NetworkDevice                  TokenId

 

 

I should look in the listing of the zip file for filenames that contain the phrase "NetworkDevice" because that is the Source of the data.

And, I find 3 such samples in the listing of the zip file:

     CMDB.NetworkDevice_ComputerSystem_augment.tpl

     CMDB.NetworkDevice_setTokenId.tpl

     CMDB.NetworkDeviceDetail_ComputerSystem_augment.tpl

 

For my example, the name of this syncmapping looks particularly interesting: 

   CMDB.NetworkDevice_setTokenId.tpl

 

Maybe I'm home-free!  Let us look at the text of that syncmapping.

Below, the standard parts of the syncmapping are regular font, and the most interesting lines (the two lines which create and set the TokenId) are in bold.

====================================================================

tpl 1.13 module CMDB.Extension.NetworkDevice_setTokenId;

 

metadata

    origin := "Customer";

    tree_path := "Custom", "CMDB Sync", "NetworkDevice_ComputerSystem_setTokenId";

end metadata;

 

from CMDB.NetworkDevice_ComputerSystem import NetworkDevice_ComputerSystem 2.0;

 

syncmapping NetworkDevice_setTokenId 1.0

    """

    Change values for NetworkDevice to BMC_ComputerSystem syncmapping

    """

    overview

        tags CMDB, Extension;

    end overview;

 

    mapping from NetworkDevice_ComputerSystem.device as device

    end mapping;

 

    body

        computersystem := NetworkDevice_ComputerSystem.device_cs;

 

        hashed_key := text.hash(device.key);

        computersystem.TokenId := "ADDM:%hashed_key%";

 

    end body;

end syncmapping;

=========================================================================

 

So, my TokenId in the CMDB will look something like this:  "ADDM:<some hex number>"

If that's what I want, then I just Upload that pattern from the Manage->Knowledge page in the UI and test it on a testing system.

 

If I want the TokenId to look like this instead:  "ACME CORP:<some hex number>",

I can change this line of code:

 

OLD:          computersystem.TokenId := "ADDM:%hashed_key%";

NEW:          computersystem.TokenId := "ACME CORP:%hashed_key%";

 

After revising the pattern, I Upload it as described above, fix any compile errors, and test it.

 

Again, these syncmapping extensions are just some 'stubs' that are a 'start' on some logic.

The syncmapping stubs generally do not do anything interesting or sensible.

 

 

 

DIRECTORY LISTING OF THE ZIP FILE.  The ones for NetworkDevice are in bold:

$ ls -la

total 2112

drwxr-xr-x 1 LKEELER Domain Users    0 Mar 18 16:58 .

drwxr-xr-x 1 LKEELER Domain Users    0 Mar 18 16:58 ..

-rw-r--r-- 1 LKEELER Domain Users 1895 Apr 15 15:42 CMDB.BAI_Application_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  667 Apr 15 14:43 CMDB.Cluster_Cluster_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  649 Apr 15 16:18 CMDB.Cluster_Cluster_augment2.tpl

-rw-r--r-- 1 LKEELER Domain Users  668 Apr 15 16:17 CMDB.Cluster_IPEndpoint_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  682 Apr 15 14:43 CMDB.Cluster_SystemResource_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  692 Apr 15 14:44 CMDB.ClusterService_SystemResource_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  787 Apr 15 16:29 CMDB.Database_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users 1416 Apr 15 14:46 CMDB.Group_StaticApplication_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  643 Apr 15 14:46 CMDB.Host_ComputerSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  836 Apr 15 15:34 CMDB.Host_ComputerSystem_augment_virtual.tpl

-rw-r--r-- 1 LKEELER Domain Users  665 Apr 15 14:48 CMDB.Host_OperatingSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  874 Jun 16 07:29 CMDB.HostContainer_ComputerSystem_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  959 Apr 15 15:23 CMDB.HostDetail_ComputerSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  992 Apr 15 15:23 CMDB.HostDetail_OperatingSystem.tpl

-rw-r--r-- 1 LKEELER Domain Users 1348 Apr 15 16:30 CMDB.NetworkDevice_ComputerSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  755 Apr 15 16:30 CMDB.NetworkDevice_setTokenId.tpl

-rw-r--r-- 1 LKEELER Domain Users 1035 Apr 15 16:31 CMDB.NetworkDeviceDetail_ComputerSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  756 Apr 15 16:19 CMDB.RuntimeEnvironment_Product_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  875 Apr 15 16:31 CMDB.SNMPManagedDevice_ComputerSystem_augment_CTI.tpl

-rw-r--r-- 1 LKEELER Domain Users  819 Apr 15 14:53 CMDB.SoftwareCluster_Cluster_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users 1113 Apr 15 15:39 CMDB.SoftwareComponent_ApplicationService_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  857 Apr 15 15:26 CMDB.SoftwareComponent_ApplicationService_augment_CTI.tpl

-rw-r--r-- 1 LKEELER Domain Users 1172 Apr 15 14:56 CMDB.SoftwareInstance_ApplicationSystem_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users 1180 Apr 15 15:29 CMDB.SoftwareInstance_ApplicationSystem_augment_CTI_2.tpl

-rw-r--r-- 1 LKEELER Domain Users 1023 Apr 15 14:57 CMDB.SoftwareInstance_Detail_EOL.tpl

-rw-r--r-- 1 LKEELER Domain Users  752 Apr 15 16:19 CMDB.SoftwareInstance_Product_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users 5637 Apr 15 16:19 CMDB.SoftwareInstance_Product_override.tpl

-rw-r--r-- 1 LKEELER Domain Users  761 Apr 15 15:00 CMDB.SoftwareInstance_SoftwareServer_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users 1018 Apr 15 15:37 CMDB.SoftwareInstanceDetail_SoftwareServer_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  921 Apr 15 19:19 CMDB.StorageDevice_changes.tpl

-rw-r--r-- 1 LKEELER Domain Users  911 Apr 15 15:04 CMDB.StorageDevice_Cluster_augment.tpl

-rw-r--r-- 1 LKEELER Domain Users  713 Apr 15 16:32 CMDB.StorageDevice_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  926 Apr 15 16:38 CMDB.StorageSystem_ComputerSystem_extend.tpl

-rw-r--r-- 1 LKEELER Domain Users  484 Apr 15 14:39 CMDB.Tags_extend.tpl

$

 

 

Here is a screenshot showing those same patterns in my Manage->Knowledge page after I uploaded the entire zip file:

 

Of course, you should not upload the entire zip file.  I uploaded the zip file to make sure that all the stubs compile OK in 11.3.

Next, I will be deleting all the syncmapping stubs I had uploaded so that they don't affect my testing system.

 

I hope these syncmapping stubs are helpful to you!

 

RELATED POSTINGS:

Helix Support: Discovery custom patterns discussion

Getting Started creating a CMDB Syncmapping Extension pattern

Lisa Keeler