Discovering content from databases
You can discover content from databases by using data sources. You write patterns that specify the target database, including a driver, and provide queries to extract the information required. You can use data sources to query an asset database to find the location of Hosts as they are discovered.
The following database data sources are provided. Additional database data sources may be added in subsequent TKUs:
- IBM Db2
Ingres
Microsoft SQL Server
- MySQL
Oracle
PostgreSQL
Sybase
Other Database
To discover content from databases
The basic method for discovering content from databases is the same for each database data source type:
- Configure the database data source, including:
- The database driver.
- The database to query.
- Write a pattern which specifies:
- The data source by name.
- A query to access the required information.
- Upload and activate the pattern.
- Scan the endpoint.
Queries
The query is an SQL query for the database, specified by using the discovery.sqlQuery
TPL function.
To retrieve data from a database by using an SQL query
This procedure shows how to perform an SQL query by using a database data source. The method is the same for all databases, though the parameters used to configure the data source differ for each database type.
- To create a database data source, from the main menu, click Manage > Data Sources.
Click Add and select a database from the menu.
In this example, IBM Db2 is selected from the menu.- For details on how to add a data source, see Adding data sources.
The following are example parameters:- Name—the name of the data source. For example, "
Db2 tideway DS
". This is how patterns refer to and use the data source. - Endpoint—the address (IPv4 or IPv6) of the host, or a resolvable hostname.
- Description—a free text description that is displayed on the Data Sources page.
- Username—the user name with which to access the host.
- Password—the corresponding password.
Driver
Port
Database Name
Timeout
Credential Group
Additional Properties
- Name—the name of the data source. For example, "
- Write a pattern that uses the data source you created and a query:
Specify the data source:
ds_base := discovery.dataSource("Db2 tideway DS");
Specify the query:
\\ returns the result of the specified SQL query result := discovery.sqlQuery(ds_base, raw "select hostname, address, location, owner from HOSTS where hostname = %hostname%", hostname := host.name);
Upload and activate the pattern.
- Scan the host.
To view the information discovered
You can see the data source accesses for each discovery run that uses data sources. To do this:
- From the Discovery Access section in the Host page, click the latest Discovery Access.
- From the top row of the Endpoint section, select the Discovery Run.
- From the Status section, select n Data Source Accesses Related.
The Data Source Access List page is displayed. If there is only one, the Data Source Access page is displayed. - Select the Data Source Access you want to view.
Comments
Log in or register to comment.