IBM InfoSphere Streams Version 4.1.1

streamtool capturestate

The streamtool capturestate command captures the current state of the instance, including the state of objects in the system and the metrics available on those objects.

Usage

Read syntax diagramSkip visual syntax diagram
capturestate

>>-+-----------------------+--+------------------------+-------->
   '-+- -d----------+--did-'  '-+- -f-----+--file-name-'   
     '- --domain-id-'           '- --file-'                

>--+-------------+--+-------------------------+----------------->
   '-+- -h-----+-'  '-+- -i------------+--iid-'   
     '- --help-'      '- --instance-id-'          

>--+------------------------+--+---------------------------+---->
   |              .-,-----. |  |              .-,--------. |   
   |              V       | |  |              V          | |   
   '-+- -j-----+----jobid-+-'  '- --jobnames----job-name-+-'   
     '- --jobs-'                                               

>--+------------------------------+----------------------------->
   |               .-,----------. |   
   |               V            | |   
   '- --resources----resourceID-+-'   

>-- --select--object-type-+-------------+----------------------->
                          |   .-,-----. |   
                          |   V       | |   
                          '-=---level-+-'   

>--+-----------------+--+-------------------+------------------->
   '- --trace--level-'  '-+- -U-----+--user-'   
                          '- --User-'           

>--+------------------------+--+-----------------------+-------->
   |               .-,----. |  '-+- -v--------+--level-'   
   |               V      | |    '- --verbose-'            
   '-+- -u------+----user-+-'                              
     '- --users-'                                          

>--| Non-interactive tool options |----------------------------><

Non-interactive tool options

    (1)                                    
|--------+-----------------------------+------------------------|
         +- --embeddedzk---------------+   
         |               .-,---------. |   
         |               V           | |   
         '- --zkconnect----host:port-+-'   

Notes:
  1. The non-interactive tool options are not supported in the interactive streamtool interface.

Authority

To capture information about resources, you must have search authority for the instance object. By default, the InstanceUser, DomainAdministrator, and InstanceAdministrator roles have this authority.

To capture information about jobs, you must have search authority for the instance object and the jobs instance object. You must also have read authority for the appropriate jobgroup_name instance object. By default, the DomainAdministrator, and InstanceAdministrator roles have this authority. If the user who submits the job has the InstanceUser role, they also have this authority.

For more information about access control lists, see the streamtool getacl and streamtool lsjobpermission commands.

Description

The return output is XML. The schema for the returned XML is available in the installation directory under schema/streamsInstanceState.xsd.

You must select a single object type (hosts or jobs) to indicate the type of information to capture. You can apply filters on the set of objects returned. The available filters depend on the object type that you selected. You can filter resources by specifying resource IDs. You can filter jobs by specifying job IDs, the users that submitted the jobs, or the application names that are associated with the jobs.

Options and arguments

-d, --domain-id did
Specifies the domain identifier.

If you do not specify this option, InfoSphere® Streams uses the domain name that is set in the STREAMS_DOMAIN_ID environment variable. By default, that domain name is StreamsDomain. If you are using the interactive streamtool interface, it uses the name of the active domain for the current streamtool session or else it prompts you for the domain name.

The active domain for the current streamtool session is set every time that you successfully run a streamtool command with a -d or --domain-id option. Alternatively, you can run the streamtool domain command in the interactive interface.

--embeddedzk

Specifies to use the embedded copy of ZooKeeper. This option is not supported within the interactive streamtool interface.

If you are not using the interactive streamtool interface and you do not specify either this option or the --zkconnect option, InfoSphere Streams uses the ZooKeeper connection that is associated with the active domain or the domain that is specified in the --domain-id option. InfoSphere Streams determines which connection maps to the domain by using cached information about the domains. In this scenario, if the domain identifier is not unique in the InfoSphere Streams configuration cache, the command fails.

-f, --file file-name
Specifies the file path where the command outputs the XML information.
-h, --help
Specifies to show the command syntax.
-i, --instance-id iid
Specifies the instance identifier.

If you do not specify this option, InfoSphere Streams uses the instance identifier that is set in the STREAMS_INSTANCE_ID environment variable. By default, that instance identifier is StreamsInstance. If you are using the interactive streamtool interface, it tries to use an instance ID that you specified in a previous command. If no such value is found, the command uses the STREAMS_INSTANCE_ID environment variable. Alternatively, you can run the streamtool instance command in the interactive interface.

-j, --jobs job-id
Specifies a list of job IDs, which are delimited by commas.
--jobnames job-name
Specifies a list of job names, which are delimited by commas.
--resources resourceID
Specifies a list of resource identifiers, which vary depending on the resource manager. For example, they might be host names or IP addresses. The resource identifiers are delimited by commas.
--select object-type=level
Specifies the type of objects that you want in the result. The object-type can be either hosts or jobs. Optionally, you can also specify the level of information that you want. The following values are supported:
  • all: Return all information available for the selected object type.
  • state: Return the state information about the selected object type.
  • metrics: Return the metric information available for the selected object type.
This default value is state. Multiple values can be specified by using a comma-separated list (except for all). For example:
--select hosts=state,metrics
--trace level
Specifies the trace setting. The following valid levels are listed in order of increasing verbosity, which is to say that the first level in the list generates the least amount of information:
  • off
  • error
  • warn
  • info
  • debug
  • trace
The default value is off.
-U, --User userid
Specifies an InfoSphere Streams user ID that has authority to run the command.
-u, --users user
Specifies to select from this list of user IDs, which are delimited by commas.
-v,--verbose level
Specifies to provide more detailed command output. The vebosity level can be from 0 to 3 where each increment provides more detailed output.
--zkconnect host:port

The name of one or more host and port pairs that specify the configured ZooKeeper servers. This option is not supported within the interactive streamtool interface.

If you are not using the interactive streamtool interface and you do not specify this option, InfoSphere Streams tries to use:
  1. The --embeddedzk option
  2. The value from the STREAMS_ZKCONNECT environment variable
  3. A ZooKeeper connection string that is derived from cached information about the current domain.

Examples

Example 1: Capturing job status and performance information
To capture the status of the jobs that are running in an InfoSphere Streams instance, enter the following command:
[streamtool <?@StreamsDomain.StreamsInstance>] capturestate --select jobs
The following example demonstrates the command output while the Commodity Purchasing sample application is running:
<?xml version="1.0" encoding="UTF-8"?>
<instance xmlns="http://www.ibm.com/xmlns/prod/streams/api/state" 
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/streams/api/state streamsInstanceState.xsd" 
id="StreamsInstance" requestTime="1421360025" 
xmlns:streams="http://www.ibm.com/xmlns/prod/streams/api/state" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <job id="0" name="sample.CommodityPurchasing::AutomatedBuyer_0" 
  applicationName="sample.CommodityPurchasing::AutomatedBuyer" 
  submitTime="1421372978" user="bsmith" state="running" healthSummary="healthy">
    <pe id="0" host="host1.ibm.com" processId="23718" 
    state="running" reasonCode="none" requiredConnections="connected" 
    optionalConnections="connected" healthSummary="healthy">
      <operator name="TopSupplierAndCurrentSupply" logicalName="TopSupplierAndCurrentSupply">
        <inputPort index="0" name="L"/>
        <inputPort index="1" name="R"/>
        <outputPort index="0" name="TopSupplierAndCurrentSupply" streamName="TopSupplierAndCurrentSupply"/>
      </operator>
      ...
    </pe>
  </job>
  ...
</instance>
To capture metrics information for the jobs, enter the following command:
[streamtool <?@StreamsDomain.StreamsInstance>] capturestate --select jobs=metrics
To capture both status and metrics information for jobs, enter the following command:
[streamtool <?@StreamsDomain.StreamsInstance>] capturestate --select jobs=all

When you request metrics information, the command output includes more information about processing elements, operators, and ports.

Example 2: Capturing resource metrics
To capture performance metrics and state information for a resource in the instance, enter the following command:
[streamtool <?@StreamsDomain.StreamsInstance>] capturestate --select hosts=all --resources host1.ibm.com
The command returns the following example output:
<?xml version="1.0" encoding="UTF-8"?>
<instance xmlns="http://www.ibm.com/xmlns/prod/streams/api/state" 
xmlns:streams="http://www.ibm.com/xmlns/prod/streams/api/state" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/streams/api/state streamsInstanceState.xsd" 
id="StreamsInstance" requestTime="1421362673" state="running">
  <host id="host1.ibm.com" state="running" schedulableState="schedulable" isMetricsStale="false">
    <metric name="nProcessors" lastChangeObserved="1421362673" userDefined="false">
      <metricValue xsi:type="streams:longType" value="2"/>
    </metric>
    <metric name="cpuSpeed" lastChangeObserved="1421362673" userDefined="false">
      <metricValue xsi:type="streams:longType" value="7676"/>
    </metric>
    <metric name="loadAverage" lastChangeObserved="1421362673" userDefined="false">
      <metricValue xsi:type="streams:longType" value="46"/>
    </metric>
    <service name="view" state="running"/>
    <service name="sam" state="running"/>
    <service name="hc" state="running"/>
    <service name="app" state="running"/>
    <service name="srm" state="running"/>
    <service name="sch" state="running"/>
  </host>
</instance>