Adding name-value pairs to entities using the File finder

If you enable the File finder to seed your discovery, then you can add name-value pairs to entities by adding extra columns to the seed file read by the File finder.

About this task

The example procedure below assumes that you are adding the following extra columns to your File finder seed file:
  • customer
  • location
The following example text file fragment shows what the seed file might look like:
vi /var/tmp/logged_hosts                 

172.16.1.21       lnd-dharma-acme       acme        london
172.16.1.201      lnd-phoenix-acme      acme        london
172.16.1.25       prs-sun-acme          acme        paris
172.16.2.33       ranger1               telecorp    newyork
172.16.2.34       ranger2               telecorp    newyork
~
"/var/tmp/logged_hosts" [Read only] 4 lines, 190 characters
In this example text file fragment, the third column holds customer information, and the fourth column holds location information.

Procedure

  1. Edit the DiscoFileFinderParseRules.cfg configuration file.
  2. In this configuration file, configure the File finder to parse the seed file using an insert similar to the example. Ensure that you configure the m_ColDefs field to match the new custom tag columns.
    insert into fileFinder.parseRules
    (
                m_FileName,
                m_Delimiter,
                m_ColDefs
    )
    values
    (
                "/var/tmp/logged_hosts",
                "[     ]",
                [
                    {
                        m_VarName="m_UniqueAddress",
                        m_ColNum=1
                    },
                    {
                        m_VarName="m_Name",
                        m_ColNum=2
                    },
                    {
                        m_VarName="m_CustomTags->customer",
                        m_ColNum=3
                    },
                    {
                        m_VarName="m_CustomTags->location",
                        m_ColNum=4
                    }            
                ]
    );
    This insert instructs the File finder to do the following:
    • Parse /var/tmp/logged_hosts.
    • Treat white space as the data separator.
    • Use the following column definitions:
      • m_UniqueAddress for the first column
      • m_Name for the second column
      • m_CustomTags->customer for the third column
      • m_CustomTags->location for the fourth column
  3. Edit the DbEntityDetails.cfg file and configure an insert similar to the following:
    insert into dbModel.entityDetails
    (
        EntityType,
        EntityDetails
    )
    values
    (
        1,  -- chassis
        {
            Customer = "eval(text, '&m_ExtraInfo->m_CustomTags->customer')",
            Location = "eval(text, '&m_ExtraInfo->m_CustomTags->location')"
        } 
    );  
    insert into dbModel.entityDetails
    (
         EntityType,
         EntityDetails
    )
    values
    (
         2,  -- port/interface
         {
             Customer = "eval(text, '&m_ExtraInfo->m_CustomTags->customer')",
             Location = "eval(text, '&m_ExtraInfo->m_CustomTags->location')"
         }
    );
  4. Restart Network Manager to propagate the configuration file changes:
    itnm_start ncp -domain domain
  5. Run a full discovery using the File finder to discover your network with the name-value pairs added.

What to do next

Ensure that the new data is propagated between discoveries.