14 Replies Latest reply on Dec 19, 2017 10:24 AM by Roland Pocek

    CMDB Sync - Product Categorization CPU

    Roland Pocek

      hi,

       

      customer asked me how ti would be possible using a pattern to change the OOTB product contegorization for all instances of CPU of a server in CMDB Sync here in Discovery. i remember that this was not easy doing a while ago, did this change or can anyone provide help on how such a syncpattern part would look?

       

      thank you

      rop

        • 1. Re: CMDB Sync - Product Categorization CPU
          Brice-Emmanuel Loiseaux

          I believe it would depend on the complexity of your changes. It's hard to tell without more details.

          • 2. Re: CMDB Sync - Product Categorization CPU
            Roland Pocek

            hi Brice-Emmanuel Loiseaux

             

            in the OOTB sync pattern there is a hardcoded categorization, i need to change that to a custom one without editing the OOTB pattern, for all instances of CPU (BMC_Processor) for each host

             

            cpu.PNG

             

            cheers

            rop

            • 3. Re: CMDB Sync - Product Categorization CPU
              Duncan Grisby

              The processor mapping is slightly special compared to most mappings, in that it loops over the number of processors on a host, rather than just looping over nodes in the Discovery model. You therefore can't extend it with "mapping from" like you do with most mappings. Instead, you should make a copy of the original module, give it a different name, then use an "overrides" delcaration in the overview block of your edited syncmapping.

               

              tpl 1.12 module CMDB.Host_Processor_Custom;

               

              ...

               

              from Host_Processor import Host_Processor 2.3;

               

              ...

               

              syncmapping Host_Processor_Custom 1.0

                  """

                  Host mapped to BMC_Processor.

                  """

                  overview

                      tags CMDB, Core_Mapping;

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

                     overrides Host_Processor;

                  end overview;

               

              ...

              3 of 3 people found this helpful
              • 4. Re: CMDB Sync - Product Categorization CPU
                Jan-Philipp Henkel

                Thanks but do you've an example for our values:

                485   NumberOfCores := num_cores,

                486   NumberOfLogicalProcessors := num_logical,

                 

                How we can sync them in a short way?

                • 5. Re: CMDB Sync - Product Categorization CPU
                  Jan-Philipp Henkel

                  Hello Duncan

                   

                  I got it working, that I got all my reqired values but now the:

                  "for index in number.range(proc_count) do" does not work

                   

                  and if I disable the for loop the mappings will not work:

                  processor.NumberOfCores             := proc_count;
                  processor.NumberOfLogicalProcessors := num_logical;

                   

                  The sync said:"processor not set" but how is it possible to set it?

                   

                  Please take a look at the TPL and show us the solution, we need your help very much.

                  Thank a lot!!!

                  • 6. Re: CMDB Sync - Product Categorization CPU
                    Duncan Grisby

                    The sync said:"processor not set" but how is it possible to set it?

                    As I say in the other thread, you need to copy all the content of the base Host_Processor mapping, then modify it as required. Here you have cut it all out. You have removed the code that assigns processor := sync.shared.BMC_Processor(...), so of course it is telling you that "processor is not set".

                     

                    Literally copy the entire Host_Processor module. Change its name, add an import of Host_Processor and add the overrides declaration. Now you have a complete copy of the logic that it is safe to edit. From that starting point, you can modify it as you require.

                    2 of 2 people found this helpful
                    • 7. Re: CMDB Sync - Product Categorization CPU
                      Jan-Philipp Henkel

                      Hello Duncan

                       

                      I modified now the original TPL but now the writing in theses two fields is not possible but writing in general is possible in the two fields OwnerContact and OwnerName:

                      Is there any special for the two fields:

                      NumberOfCores and NumberOfLogicalProcessors?

                       

                      TPL Testings:

                      num_cores := text.toNumber(num_cores);

                      num_logical := text.toNumber(num_logical);

                      it will not work with or without the toNumber function.

                      and then:

                      NumberOfCores               := num_cores,
                      NumberOfLogicalProcessors   := num_logical, 

                       

                      Please let us know.

                      • 8. Re: CMDB Sync - Product Categorization CPU
                        Jan-Philipp Henkel

                        If we change the fields in the CMDB to character or string fields the writing will still not be possible.

                        What can we do?

                        • 9. Re: CMDB Sync - Product Categorization CPU
                          Brice-Emmanuel Loiseaux

                          Given the TKU syncmapping pattern is able to set these values, and given you now override this pattern, this has something to do with your modifications. Could you check these or explain what you did?

                          • 10. Re: CMDB Sync - Product Categorization CPU
                            Jan-Philipp Henkel

                            We using the attached TPL.

                             

                            We've added the CMDB debug logging but without result:

                             

                             

                            Logging Output as string values:

                            W117-140177771554560: 2017-12-13 16:06:02,372: syncmapping.wwi_CMDB_AIX_BMC_Processor_mapping.wwi_CMDB_AIX_BMC_Processor_mapping: INFO: WWI_XXX_CPU: 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                            W117-140177771554560: 2017-12-13 16:06:02,372: cmdb_sync.interpreter: DEBUG: Create SHARED CI BMC_Processor(KVPDict({'Category': 'Hardware', 'MaxClockSpeed': 3525, 'WWI_NumberOfCores': '8', 'Type': 'Component', 'Description': 'PowerPC POWER8 3525MHz number 0 on easv0038', 'Company': None, 'NameFormat': 'ProcessorName', 'ProcessorType': 2, 'ProcessorFamily': 118, 'WWI_NumberOfLogicalProcessors': '1', 'ShortDescription': 'PowerPC POWER8 3525MHz', 'Name': 'CPU0', 'isVirtual': None, 'NumberOfCores': '8', 'Item': 'CPU', 'OtherProcessorFamilyDescription': None, 'key': 'CPU:0:FuDnCW520O/6e/1aFmkpLQ==', 'Model': 'PowerPC POWER8 3525MHz', 'ProcessorStatus': 1, 'NumberOfLogicalProcessors': '1', 'UpgradeMethod': 1, 'ProcessorArchitecture': 3, 'ManufacturerName': 'IBM Corporation'}))

                            W117-140177771554560: 2017-12-13 16:06:02,373: syncmapping.wwi_CMDB_AIX_BMC_Processor_mapping.wwi_CMDB_AIX_BMC_Processor_mapping: INFO: WWI_XXX_CPU: 2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                             

                             

                            TPL Part:

                            log.info("WWI_XXX_CPU: 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

                                            processor := sync.shared.BMC_Processor(

                                                key                             := "CPU:%cpu_index%:%host.key%",

                                                Name                            := "CPU%cpu_index%",

                                                NameFormat                      := "ProcessorName",

                                                ShortDescription                := processor_type or "Unknown CPU",

                                                Description                     := "%processor_type% number %cpu_index% on %host.name%",

                                                isVirtual                       := is_virtual,

                                                ManufacturerName                := manufacturer,

                                                MaxClockSpeed                   := processor_speed,

                                                Model                           := processor_type,

                                                NumberOfCores                   := "%num_cores%",

                                                NumberOfLogicalProcessors       := "%num_logical%",                

                                                OtherProcessorFamilyDescription := other_processor_family_description,

                                                ProcessorArchitecture           := processor_arch,

                                                ProcessorFamily                 := processor_family,

                                                ProcessorStatus                 := 1, // CPU enabled

                                                ProcessorType                   := 2, // Central processor

                                                UpgradeMethod                   := 1, // Unknown

                                                Company                         := computersystem.Company,

                                                Category                        := "Hardware",

                                                Type                            := "Component",

                                                Item                            := "CPU"

                                            );

                            log.info("WWI_XXX_CPU: 2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

                             

                            But as well with integer values by using:

                               num_cores := text.toNumber(num_cores);
                                        num_logical := text.toNumber(num_logical);

                             

                             

                            and

                                            NumberOfCores               := num_cores,
                                            NumberOfLogicalProcessors   := num_logical,

                             

                             

                            There is no valued shown in the CMDB.

                            But why?

                            • 11. Re: CMDB Sync - Product Categorization CPU
                              Jan-Philipp Henkel

                              The CMDB CPU property GUI shows other edited values like the two Owner fields but the required NumberOf fields are empty or not filled:

                              • 12. Re: CMDB Sync - Product Categorization CPU
                                Roland Pocek

                                hi Duncan Grisby

                                 

                                just to get it right, the OOTB pattern does not inlcude the line

                                 

                                from Host_Processor import Host_Processor 2.3;

                                 

                                do i have to add this to the pattern? and in adition to the override clause, is there anything else to change in the OOTB pattern?

                                thanks

                                cheers

                                rop

                                • 13. Re: CMDB Sync - Product Categorization CPU
                                  Brice-Emmanuel Loiseaux

                                  As it is documented in Syncmapping block - BMC Discovery 11.2 - BMC Documentation, "The mapping referred to by the overrides keyword must be imported. All definitions from the original mapping section such as node kinds, traversals and names must be preserved. It is possible to add additional traversals and names in the overriding mapping".

                                  2 of 2 people found this helpful
                                  • 14. Re: CMDB Sync - Product Categorization CPU
                                    Roland Pocek

                                    only thing i missed was that the import line needs to be "from CMDB.Host_Processor import Host_Processor 2.3;"