4 Replies Latest reply on Aug 29, 2019 2:56 PM by Alex Gravel

    Sync Mapping Computer System with running SI

    Alex Gravel
      Share This:

      Hi,

       

      I am trying to sync only certain host to a new CI (BMC_BusinessService).

      I have a "where" clause that contains traverse

      Although I don't need the CI in the traversal section

       

      Basicly, I want to Sync host that contains SI that manages Storage System ex : Isilon OneFS

       

      Heres my mapping

       

      tpl 1.5 module CMDB.Extension.Stockage.System;

       

      metadata

       

      tree_path := 'CMDB', 'Service Infra', 'Host','Stockage';

      end metadata;

       

      from CMDB.Host_ComputerSystem import Host_ComputerSystem 2.0;

       

      syncmapping Vid_Service_Stockage_Host 1.0

          """

          Populate BMC_BusinessServiceand relate to BMC_ComputerSystem.

          """

          overview

              tags  CMDB, Extension, Service;

          end overview;

       

      constants

      SB_Name  := "Infra TI - Stockage - PROD";

      end constants;

       

       

          mapping from Host_ComputerSystem.host

                     where nodecount(traverse Host:HostedSoftware:RunningSoftware:SoftwareInstance                              // <- doesnt compile here

                          where nodecount(traverse Manager:Management:ManagedElement:StorageSystem) > 0) as host

       

                     SB_service -> BMC_BusinessService;

       

          end mapping;

       

       

          body

      computersystem := Host_ComputerSystem.computersystem;

      key := text.hash(SB_Name);

      SB_service := sync.shared.BMC_BusinessService(

      key              := key,

      Name             := SB_Name,

      ServiceType := 20

      );

                

                  // Relate the BMC_ComputerSystem to the new BMC_BusinessService

                  sync.rel.BMC_Component(

                      Source      := computersystem,

                      Destination := SB_service,

                      Name        := "COMPONENT"

                  );

                

            

       

       

          end body;

       

       

      end syncmapping;

        • 1. Re: Sync Mapping Computer System with running SI
          Brice-Emmanuel Loiseaux

          The where clause on mapping section should be simple, read Syncmapping block - Documentation for BMC Discovery 11.3 - BMC Documentation   and Triggers - Documentation for BMC Discovery 11.3 - BMC Documentation.

           

          I would create a mapping with your two traversals in sequence and then in body use two for loops to check if there is at least one StorageSystem. If yes, you can create your BMC_BusinessService.

          1 of 1 people found this helpful
          • 2. Re: Sync Mapping Computer System with running SI
            Alex Gravel

            Hi Brice, Thanks for the reply.

            I reversed the order and made something like this :

             

                mapping from StorageSystem_ComputerSystem.storagesystem as system

                      SB_service -> BMC_BusinessService;

                                traverse ManagedElement:Management:Manager:SoftwareInstance as manager_si

                                     traverse RunningSoftware:HostedSoftware:Host:Host as host

                                     end traverse;

                                end traverse;

                end mapping;

             

            Alhtough, when i loop through the traversal. i want to relate my SB_service with the host.

            Would it be this way :

             

            for each manager_si do

                      for each host do

            sync.rel.BMC_Component(

                                     Source      := host,

                                     Destination := SB_service,

                                     Name        := "COMPONENT"

                           );

                      end for;

                 end for;

             

            ---------------------------------------

             

            Else, I saw in the documentation the sync.external.BMC_ComputerSystem

             

            To make it work. should it be something like :

            mapping from StorageSystem_ComputerSystem.storagesystem as system

                                traverse ManagedElement:Management:Manager:SoftwareInstance as manager_si

                                     traverse RunningSoftware:HostedSoftware:Host:Host as host

                                               containing_cs -> BMC_ComputerSystem

                                     end traverse;

                                end traverse;

                end mapping;

             

            then in the body :

             

             

                 for each manager_si do

                      for each host do

                           containing_cs := sync.external.BMC_ComputerSystem(key := host.key);

                

                           sync.rel.BMC_Component(

                                     Source      := containing_cs,

                                     Destination := SB_service,

                                     Name        := "COMPONENT"

                           );

                      end for;

                 end for;

             

            --------------------

             

            Thanks !

            • 3. Re: Sync Mapping Computer System with running SI
              Brice-Emmanuel Loiseaux

              What I had in mind was closer to what you initially did:

               

                  mapping from Host_ComputerSystem.host as host

                        traverse Host:HostedSoftware:RunningSoftware:SoftwareInstance as si

                             traverse Manager:Management:ManagedElement:StorageSystem as ss

                             end traverse;

                        end traverse;

                        SB_service -> BMC_BusinessService;

                  end mapping;

               

                  body

                       computersystem := Host_ComputerSystem.computersystem;

               

                       for each si  do

                            for each ss do

                                 // there is at least one StorageSystem so we can create the CI

                                 key := text.hash(SB_Name);

                                 SB_service := sync.shared.BMC_BusinessService(

                                        key              := key,

                                        Name             := SB_Name,

                                        ServiceType := 20

                                 );

                        

                                 // Relate the BMC_ComputerSystem to the new BMC_BusinessService

                                 sync.rel.BMC_Component(

                                      Source      := computersystem,

                                      Destination := SB_service,

                                      Name        := "COMPONENT"

                                 );

                                 // break loop

                                 break;

                           end for;

                           // break loop

                           break;

                      end for;

                  end body;

              • 4. Re: Sync Mapping Computer System with running SI
                Alex Gravel

                Thank you very much for you help !

                 

                It worked out well