Discovering content from hosts
To discover content from hosts
The basic method to discover content from hosts is:
- Configure the host data source.
- Write a pattern that specifies:
- The data source by name.
- A query to access the required information.
- Upload and activate the pattern.
- Scan the endpoint.
Queries
The query can be any one of the host discovery functions that retrieve information, or files. For example:
- discovery-fileInfo
- discovery-fileGet
- discovery-listDirectory
- discovery-runCommand
- discovery.registryKey—Windows hosts
- discovery.listRegistry—Windows hosts
- discovery.wmiQuery—Windows hosts
- discovery.vSphereFindObjects—vSphere/vCenter
To retrieve a file from a UNIX or Linux (SSH) host
This procedure shows how to retrieve a file from a UNIX or Linux host by using an SSH data source. The principles for other host data sources are identical, though you need to make minor modifications, for example, for paths on Windows hosts running an SSH server.
- To create an SSH data source, from the main menu, select Manage > Data Sources.
- Click Add and select SSH from the menu.
To add a data source, see Adding-data-sources.
The following are example parameters:- Name—the name of the data source. For example, "SSH 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 username with which to access the host.
- Password—the corresponding password.
You might also need to add any parameters specific to the data source type. In this example, you might choose to use an SSH key, or specify an additional user with elevated privileges (SU User).
- Write a pattern that uses the data source you created and a query:
Specify the data source:
ds_host := discovery.dataSource("SSH tideway DS");Specify the query:
\\ returns the file from the specified file on the host
file := discovery.fileGet(ds_host, "/home/tideway/Tests/filetest.txt");
\\ returns the file information from the specified file on the host
fileinfo := discovery.fileInfo(ds_host, "/home/tideway/Tests/filetest.txt");
\\ returns a directory listing from the host
dirlist := discovery.listDirectory(ds_host, "/home/tideway/Tests");
- Upload and activate the pattern.
- Scan the host.
To retrieve a registry key from a Windows host
This procedure shows how to retrieve a registry key from a Windows host by using a Windows data source.
- To create a Windows data source, from the main menu, select Manage > Data Sources.
- Click Add and select Windows 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, "Windows 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.
- Write a pattern that uses the data source you created and a query:
Specify the data source:
ds_host03 := discovery.dataSource("WINDOWS tideway DS");Specify the query:
\\ returns the specified registry key
\\ Note the escaping of \0 -> \\0 in the key specification
result05 := discovery.registryKey(ds_host03, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\\0\Identifier");
\\ list the specified registry
result06 := discovery.listRegistry(ds_host03, "HKEY_LOCAL_MACHINE\SOFTWARE");
- Upload and activate the pattern.
- Scan the host.
To retrieve information on a vSphere object from a vCenter managed host or vSphere API
This procedure shows how to retrieve attributes for a selected ManagedObjectReference (MOR). The principles for other host data sources are identical, though you need to make minor modifications, for example, for paths on Windows hosts running an SSH server.
- To create a vCenter or vSphere data source, from the main menu, select Manage > Data Sources.
- Click Add and select vCenter or vSphere 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, "VSPHERE tideway DS" or "VCENTER 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.
- Write a pattern that uses the data source you created and a query:
Specify the data source:
ds_VShost := discovery.dataSource("VSPHERE tideway DS");Specify the query:
\\ returns the name and summary.config.port from the HostSystem MOR:
result10 := discovery.vSphereFindObjects(ds_VShost , "HostSystem", ["name", "summary.config.port"]);
- 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.