Sample Override Syncmapping pattern:  Conditional Impact relationships for BMC_SoftwareServer.

Version 2
    Share This:


    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:


    DISCLAIMER: Samples provided on the communities are only examples to be tested by the customer on a TEST system.  

    Adding additional data to the CMDB may adversely affect the AR Server and CMDB performance.      

    Swim at your own risk.



    See this community posting:  Creating an override in ADDM 11.2 for rel.dependency

    Description: Want to only have HasImpact attribute set on the relationship from BMC_ComputerSystem to BMC_SoftwareServer if the SoftwareServer contains a database or databases.


    Consideration: Relationships can not be modified or deleted by "extension" patterns.  Therefore, an override pattern must be used for this case.



         Compatible with Discovery 11.2 and 11.3.

         How to change for other versions:

             To be compatible with other versions, you would need to check if the SoftwareInstance_SoftwareServer.tpl had changed between versions.

             There was no change to the SoftwareInstance_SoftwareServer.tpl between version 11.2 and 11.3.  Therefore, this pattern is compatible for both 11.2 and 11.3.

             If there are changes, then you need to take the new "base" pattern, and fold in the necessary/desired changes one at a time.


    Base Pattern:


            module:  SoftwareInstance_SoftwareServer

            file:  SoftwareInstance_SoftwareServer.tpl


    Override Pattern:

            module:  SoftwareInstance_SoftwareServer_Override

            file:  SoftwareInstance_SoftwareServer_Override_impact.tpl


    Below is the new pattern, SoftwareInstance_SoftwareServer_Override.

    •    New lines are commented with OVERRIDE NEW
    •    Old, removed lines are commented with OVERRIDE OLD
    •    Uncommented lines are the original lines from the SoftwareInstance_SoftwareServer syncmapping pattern.



    =============================== SoftwareInstance_SoftwareServer_Override_impact.tpl ===========================


    //tpl 1.12 module CMDB.SoftwareInstance_SoftwareServer;          //OVERRIDE OLD

    tpl 1.12 module CMDB.SoftwareInstance_SoftwareServer_Override;    //OVERRIDE NEW



        origin := "TKU";

    //  tree_path := "BMC Discovery Operation", "CMDB Sync", "Host", "SoftwareInstance -> SoftwareServer";  //OVERRIDE OLD

        tree_path := "Custom", "CMDB Sync", "Host", "SoftwareInstance -> SoftwareServer Override";          //OVERRIDE NEW

    end metadata;



    from CMDB.Host_ComputerSystem        import Host_ComputerSystem        2.0;

    from CMDB.MFPart_ComputerSystem      import MFPart_ComputerSystem      2.0;

    from CMDB.Cluster                    import Cluster                    3.0;

    from CMDB.CloudService_CloudInstance import CloudService_CloudInstance 1.0;


    from CMDB.SoftwareInstance_SoftwareServer import SoftwareInstance_SoftwareServer 4.2;  //OVERRIDE NEW

    from CMDB.Database import Database 2.3;  //OVERRIDE NEW


    //syncmapping SoftwareInstance_SoftwareServer 4.2            //OVERRIDE OLD

    syncmapping SoftwareInstance_SoftwareServer_override 1.0    //OVERRIDE NEW


        First-order SoftwareInstance mapped to BMC_SoftwareServer.



            tags CMDB, Core_Mapping;

            datamodel 0, 1, 2, 3, 4, 5, 6;

            overrides SoftwareInstance_SoftwareServer;             //OVERRIDE NEW

        end overview;


        mapping from

                from MFPart_ComputerSystem.mfpart

                from Cluster.cluster

                from CloudService_CloudInstance.cloud_svc

            as hosting_node


            traverse Host:HostedSoftware:RunningSoftware:SoftwareInstance as softwareinstance

                traverse Element:Maintainer:Pattern:Pattern as si_pattern

                end traverse;


                traverse ElementWithDetail:Detail:Detail:Database as database_node  //OVERRIDE NEW

                end traverse;                                                      //OVERRIDE NEW


                softwareserver -> BMC_SoftwareServer;

            end traverse;

        end mapping;


            hosting_ci := Cluster.cluster_ci or

                          Host_ComputerSystem.computersystem or

                          CloudService_CloudInstance.cloud_svc_ci or



  "Process SoftwareInstances for");


            for each softwareinstance do

                // Publisher and product come from SI itself or from pattern

                software_server_type := 0;

                publisher            := softwareinstance.publisher;

                product_name        := softwareinstance.product;

                product_category    := "BMC Discovered";


                for each si_pattern do

                    if si_pattern.cdm_software_server_type then

                        software_server_type := si_pattern.cdm_software_server_type[0];

                    end if;

                    if not publisher and si_pattern.publishers then

                        publisher := si_pattern.publishers[0];

                    end if;

                    if not product_name and si_pattern.products then

                        product_name := si_pattern.products[0];

                    end if;

                    if si_pattern.categories then

                        product_category := si_pattern.categories[0];

                    end if;

                end for;


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

                short_name := softwareinstance.short_name or;


                softwareserver := sync.shared.BMC_SoftwareServer(

                    key                    := softwareinstance.key,

                    TokenId                := "ADDM:%hashed_key%",

                    Name                    :=,

                    ShortDescription        := short_name,

                    Description            :=,

                    BuildNumber            :=,

                    isCloud                :=,

                    ManufacturerName        := publisher,

                    MarketVersion          := softwareinstance.product_version,

                    Model                  := softwareinstance.type,

                    OtherSoftwareServerType := softwareinstance.type,

                    PatchNumber            := softwareinstance.patch,

                    ServicePack            := softwareinstance.service_pack,

                    SoftwareServerType      := software_server_type,

                    VersionNumber          := softwareinstance.version,

                    ComponentAliases        := softwareinstance.cdm_component_aliases,

                    Company                := hosting_ci.Company,

                    Category                := "Software",

                    Type                    := "Application",

                    Item                    := product_category



                //OVERRIDE NEW.  Are there related BMC_DataBase ci's in CMDB or database nodes in Discovery?

                contains_database := 0;                            //OVERRIDE NEW

                for each database_node do                          //OVERRIDE NEW

                    contains_database := 1;                        //OVERRIDE NEW

                    break;                                          //OVERRIDE NEW

                end for;                                            //OVERRIDE NEW

      "IMPACT OVERRIDE:  contains_database=%contains_database%.  software_server_ci=%softwareserver.Name%");        //OVERRIDE NEW


                if contains_database then                          //OVERRIDE NEW


                        Source          := hosting_ci,

                        Destination    := softwareserver,

                        Impacted        := softwareserver,

                        Name            := "APPLICATIONSYSTEMCOMPUTER"


                else                                                      //OVERRIDE NEW

                    sync.rel.BMC_Dependency(                              //OVERRIDE NEW

                        Source          := hosting_ci,                    //OVERRIDE NEW

                        Destination    := softwareserver,                //OVERRIDE NEW

                        //Impacted        := softwareserver,              //OVERRIDE NEW

                        Name            := "APPLICATIONSYSTEMCOMPUTER"    //OVERRIDE NEW


                end if;                                                  //OVERRIDE NEW


            end for;

        end body;

    end syncmapping;



    Examples of relationships with the new pattern uploaded:


    Here is a relationship from a BMC_ComputerSystem to Apache Webserver BMC_SoftwareServer.


    For the above relationship, HasImpact = No:



    Here is a relationship from a BMC_ComputerSystem to a Maria DB BMC_SoftwareServer:



    For the above relationship, HasImpact = Yes