Syncmapping to sync the OSDetail EOL data to BMC_OperatingSystem

Version 3
    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:  https://goo.gl/8KUS3S

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

    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.

     

    Attached is a syncmapping to move the OSDetail End-of-Life data from Discovery Host nodes to the BMC_OperatingSystem CI in the CMDB.

     

     

    The syncmapping requires 3 custom attributes be added to the BMC_OperatingSystem class as follows:

                 Name                                        Type

               EOLRetirementDate                           DateTime

               EOSDate                                     DateTime

               EOESDate                                    DateTime

        

    STEPS FOR TESTING:

    1) Add the required attributes to the BMC_OperatingSystem class in the CMDB

    2) Restart the Discovery services

    3) Upload the attached pattern

    4) Scan or Sync some Hosts

    5) Check the data in the CMDB to see if the new attributes are populated on the BMC_OperatingSystem

     

    ======================== Pattern ===============================

    //Community sample syncmapping. 2020.

    //Compatible and tested with 11.3

     

    tpl 1.12 module CMDB.Extension.Sync_OS_EOL_data;

     

    from CMDB.Host_OperatingSystem import Host_OperatingSystem 2.1;

     

    syncmapping Sync_OS_EOL_data 1.0

        """

        Add EOL Support Details to OS class in CMDB.

        """

        overview

          tags CMDB, Extension;

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

        end overview;

     

        mapping from Host_OperatingSystem.host as host

            traverse ElementWithDetail:SupportDetail:OSDetail:SupportDetail as os_detail

            end traverse;

        end mapping;

     

        body

            opsys := Host_OperatingSystem.opsys;

     

            // NOTE:

            //   These attributes must be added to the BMC_OperatingSystem form in the CMDB, as a DateTime

            //      EOLRetirementDate

            //      EOSDate

            //      EOESDate

            //

            // After they are added, the Discovery services must be restarted so that Discovery will read the new CMDB definitions

     

            for each os_detail do

                if os_detail.retirement_date then

                    opsys.EOLRetirementDate := os_detail.retirement_date;

                end if;

                if os_detail.end_support_date then

                    opsys.EOSDate := os_detail.end_support_date;

                end if;

                if os_detail.end_ext_support_date then

                    opsys.EOESDate := os_detail.end_ext_support_date;

                end if;

            end for;

        end body;

    end syncmapping;

    ============================ end pattern =====================