5 Replies Latest reply on Dec 18, 2018 9:51 AM by Andrew Waters

    Integration Point

    Pranali Mohite

      Hi Communities Members,


      I am trying to fetch data for Host Owner, Company and Location of a host from CMDB database

      and I want to see that data on Host node in BMC Discovery.

      for that, I had written the TPL.

      But I am not getting the expected result.


      Please suggest what is missing?


      tpl 1.5 module AssetInfoFromSQLTemplate;

      definitions AssetDatabaseDetails 1.0

        """Queries to obtain information from asset database"""


        type := sql_integration;


        // The name of the Integration Point

        name := "integration_point_name"; 


        define getLocationOfHost


        // The list of parameters required by the SQL query   

          parameters := hostname;


           query :="Select Name,Company, Region, OwnerName From [ARSystem].[dbo].[BMC_CORE_BMC_ComputerSystem] where Name=%hostname%";


        end define;


      end definitions;

      pattern HostLocation 1.0


        When a Host is discovered, query the asset database for information on its



        // Required overview section. Some tags must be defined.


          tags integration;

        end overview;



          on host := Host created, confirmed where hostname exists;

        end triggers;



          location_rows := AssetDatabaseDetails.getLocationOfHost(

            hostname := host.hostname,

            connection := "CMDBDB"


          if location_rows = none then


            // The query failed (the value none is returned).

            log.warn('Could not retrieve location for host %host.hostname%');



          elif not location_rows then


            log.debug('No location in database for host %host.hostname%');



          end if;


          location_row := location_rows[0];   

          log.debug('Setting location of %host.hostname% as %location_row.region%');


          location_node := model.Location(

            key  := text.hash("%location_row.name% %location_row.address%"),

            name := location_row.name,

            company := location_row.company,

            region := location_row.region,

            ownername := location_row.ownername



          host_in_location_rel := model.uniquerel.Location(

            ElementInLocation := host,

            Location := location_node




            inferred := host_in_location_rel,

            evidence := location_row



        end body;

      end pattern;