Unsupported content

 

This version of the product is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

tw_query

The tw_query utility enables you to extract data using a query. The information can be output in CSV or XML format using one of the available arguments.

To use the utility, type the following command at the $TIDEWAY/bin/ directory:

tw_query [options] "query"

where:

  • query is the data you want to extract from the Search service.
  • options are any of the options described in the following table and the common command line options described in Using command line utilities.

Command Line Option

Description

--csv

The output of the query is saved in .CSV format

--delimiter=CHAR

Specifies the delimiter character used in .CSV files

--destroyMarks all of the nodes returned by the query as deleted.

--file=FILE

Specifies the name of the .CSV output file

--filedump

Dump to files specified in first column

--no-headings

Do not output column headings

--search=NAME

Specifies the name of the search service

--time

Reports the time taken to perform the query

--xml

Specifies that the output of the query will be saved in .XML format

To consider when using --destroy

The tw_query utility provides the capability of marking the results of a query as destroyed. This does not delete the nodes returned, it simply marks them as deleted. Where nodes must be completely removed, such as to comply with a request for personal information to be deleted, this is possible in BMC Discovery 11.3 patch 1 and later. For details of removing personal information, see Addressing data privacy requests.

If you are using --destroy on a large number of nodes (>500), please note that BMC Discovery handles your request in batches of 100 nodes at a time and that for some nodes, each one triggers many changes to other related nodes. If these changes are happening alongside scanning, it can create a lot of load on BMC Discovery and will take time to complete.

User examples

The following user examples show basic usage, marking a named host as destroyed, and results written to a CSV file. The commands are entered on a single line, but broken here to help readability.

Basic usage

[tideway@appliance01 ~]$ tw_query 
		"SEARCH Host WHERE os_type = 'CentOS Linux' ORDER BY name SHOW name, os_version"
Password for BMC Discovery UI user system:
Host
====

name os_version
---- ----------

ais-netlogdr-01 6.8
bacon.internal.calbnet.com 6.8
clm-ais-002331 6.4
clm-ais-002332 6.4
clm-pun-sr7he8 7.4.1708
clm-pun-sr7hep 7.4.1708
clm-pun-sr7hfp 7.4.1708
clm-pun-sr7hgq 7.4.1708
mcr-netlogpr-01.calbro.com 6.7
mcr-tubedpr-01.calbro.com 7.3.1611
[tideway@appliance01 ~]$ 

Marking a named host node as destroyed

[tideway@appliance01 ~]$ tw_query --destroy 
			"SEARCH Host WHERE name = 'bacon.internal.calbnet.com'"                  
Password for BMC Discovery UI user system:

WARNING: Use of this tool can lead to data instability and unexpected
system behavior. If you are at all unsure about the consequences of this
action, you should contact customer support in advance.

1 node will be marked as destroyed in the data store.

Are you sure? (y/n) n

Nothing destroyed.
[tideway@appliance01 ~]$ tw_query --destroy 
			"SEARCH Host WHERE name = 'bacon.internal.calbnet.com'"
Password for BMC Discovery UI user system:

WARNING: Use of this tool can lead to data instability and unexpected
system behavior. If you are at all unsure about the consequences of this
action, you should contact customer support in advance.

1 node will be marked as destroyed in the data store.

Are you sure? (y/n) y

Destroying 1 Host node...
Destroyed 1 Host node.
[tideway@appliance01 ~]$ 

Results output to CSV file

[tideway@appliance01 ~]$ tw_query --csv --file=/usr/tideway/tmp/centoshosts.csv 
			"SEARCH Host WHERE os_type = 'CentOS Linux' ORDER BY name SHOW name, os_version"
Password for BMC Discovery UI user system:
[tideway@appliance01 ~]$ more /usr/tideway/tmp/centoshosts.csv
name,os_version
ais-netlogdr-01,6.8
clm-ais-002331,6.4
clm-ais-002332,6.4
clm-pun-sr7he8,7.4.1708
clm-pun-sr7hep,7.4.1708
clm-pun-sr7hfp,7.4.1708
clm-pun-sr7hgq,7.4.1708
mcr-netlogpr-01.calbro.com,6.7
mcr-tubedpr-01.calbro.com,7.3.1611
[tideway@appliance01 ~]$



Was this page helpful? Yes No Submitting... Thank you

Comments