Enriching the topology using the GetCustomTag stitcher

You can use the GetCustomTag stitcher to add data to topology entities. You might choose to use this method if you have complex customization needs.

Before you begin

If you want to apply a fixed tag to matched entities, you can use the m_CustomTags field, and you do not need to use the GetCustomTag stitcher.

About this task

If you want to add more complex data, then customize the GetCustomTag.stch stitcher. The tag configured in the m_StitcherTagName field is used as the field name, and the value returned by the GetCustomTag stitcher is used as the field value.

Note: Editing stitchers is an advanced task, which requires knowledge of the Stitcher Language and the discovery data flow.

To customize the GetCustomTag.stch stitcher, complete the following steps:

Procedure

  1. Add data to the disco.filterCustomTags or disco.ipCustomTags table to specify which entities to apply custom tags to.
  2. Edit the DiscoConfig.cfg configuration file to configure the GetCustomTag stitcher.
  3. In this configuration file, add the following insert:
    insert into disco.filterCustomTags
                (
                            m_Filter,
                            m_StitcherTagName,
                 )
                values
                (
                            "m_UniqueAddress LIKE '172.20.3.'",
                            'customer'
                );

    This insert configures the system to use the GetCustomTag.stch stitcher to look up the value of the customer field for each entity in the subnet 172.20.3.0/24. The GetCustomTag.stch stitcher must be modified to provide this information, otherwise the name/value pair is not added to the entity.

  4. Save the DiscoConfig.cfg configuration file.
  5. Modify the GetCustomTag.stch stitcher to support the custom tag.
    The GetCustomTag.stch stitcher receives the tag and entity name as stitcher arguments 1 and 2 respectively and returns a text value. Customize the GetCustomTag.stch stitcher to determine the appropriate return values, depending on what you want to use the data for. In the following example, the stitcher is customized to check for the string lon in the supplied entity name. If the entity name contains the string, the value A-Z Inc., London is returned as the value for customer. If the entity name does not contain the string, none is returned.             
                    UserDefinedStitcher
                    {
                        StitcherTrigger
                        {
                            // Called from another stitcher when tag criteria is met
                        }
                    
                        StitcherRules
                        {
                            text tagName = eval(text,'$ARG_1');
                            text entityName = eval(text,'$ARG_2');
                    
                            text value = NULL;
                    
                            if(tagName == "customer")
                            {
                                // insert logic to retrieve custom tag
                                //
                                // As an example, here we use pattern matching to 
                                // assign all entities with 'lon' in their name
                                // to the A-Z Inc. customer.
                                //
                                int count = MatchPattern(entityName, '(lon)');
                                if (count == 1)
                                {
                                    value = "A-Z Inc., London";
                                }
                                else
                                {
                                    // Not an A-Z Inc. device.
                                    // If we leave value as NULL then no 
                                    // 'customer' custom tag will be 
                                    // created, however in this example we 
                                    // want such entities tagged with 
                                    // 'none'..
                                    value = "none";
                                }
                            }
                    
                            SetReturnValue(value);
                        }
                    }
    
    Note: Only entities that pass the criteria configured in the disco.filterCustomTags or disco.ipCustomTags table are passed to the GetCustomTag.stch stitcher.

Results

The following custom name-value pair tag is added to all IP addresses in the subnet 172.20.3.0/24:

Table 1. Data added to entities
IP Address Name Value
172.20.3.0/24 Customer A-Z Inc., London

What to do next

You must now configure the DbEntityDetails.cfg configuration file to ensure that, following discovery, the NCIM topology database entityDetails table is updated with the custom tags.