DiscoFileFinderParseRules.cfg configuration file
The DiscoFileFinderParseRules.cfg file can be used to specify the files to be parsed for a list of IP addresses of devices that exist on the network.
Database tables used
This configuration file can be used to configure inserts into the following database tables:
- fileFinder.parseRules
- fileFinder.configuration
Note that there is another configuration file associated with the fileFinder database, the DiscoFileFinderSchema.cfg file, but you should not need to alter this file.
Sample: configuring the File finder to use five threads
The following example insert configures the File finder to use five threads.
insert into fileFinder.configuration
( m_NumThreads )
values
( 5 );Example: configuring the File finder to parse /var/tmp/logged_hosts
The following example configuration instructs the File finder to parse an example text file, logged_hosts, that has been saved in the /var/tmp directory. The contents of the example file are shown below.
vi /var/tmp/logged_hosts
172.16.1.21 dharma 04:02:08
172.16.1.201 phoenix 19:07:08
172.16.1.25 lnd-sun-tivoli 15:10:00
172.16.2.33 ranger 19:07:07
~
"/var/tmp/logged_hosts" [Read only] 4 lines, 190 charactersThe three columns in this example file respectively contain an IP address, the device name, and a time value. The columns are separated by white space, which can be multiple tabs, spaces, or a combination of both. You could configure the File finder to parse this example text file using an insert similar to the example.
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
}
]
);The above insert specifies that:
- The full path and name of the file is /var/tmp/logged_hosts.
- The source-file delimiter is white space. The column delimiter is indicated in the insert using a simple regular expression, [ tab space ]+ . You must press the tab and space keys rather than typing \t to represent the tab character.
- The first column contains IP addresses and must be mapped to the m_UniqueAddress column of the finders.returns table.
- The second column contains host names and must be mapped to the m_Name column of the finders.returns table.
Because the third column in the example text file is not relevant, it has not been mapped to a column of finders.returns and is ignored by the File finder during the discovery.
Example: configuring the File finder to parse the /etc/hosts file
The following insert instructs the File finder to:
- Parse /etc/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
insert into fileFinder.parseRules
(
m_FileName,
m_Delimiter,
m_ColDefs
)
values
(
"/etc/hosts",
"[ ]",
[
{
m_VarName="m_UniqueAddress",
m_ColNum=1
},
{
m_VarName="m_Name",
m_ColNum=2
}
]
);Sample: configuring the File finder to parse /etc/defaultrouter
The following insert instructs the File finder to:
- Parse /etc/defaultrouter.
- Treat one or more occurrences of white space as the data separator.
- Use m_UniqueAddress as the column definition.
insert into fileFinder.parseRules
(
m_FileName,
m_Delimiter,
m_ColDefs
)
values
(
"/etc/defaultrouter",
"[ ]+",
[
{
m_VarName="m_UniqueAddress",
m_ColNum=1
}
]
);