InfoCenter Home >
6: Administer applications >
6.6: Tools and resources quick reference >
6.6.0: About user assistance >
6.6.0.2: Command line administration >
6.6.0.2.2: WebSphere Control Program (wscp) >
6.6.0.2.2.4: Example wscp commands, procedures, and scripts >
6.6.0.2.2.4.4: Displaying information about objects

6.6.0.2.2.4.4: Displaying information about objects

The following examples include wscp operations and custom Tcl procedures for displaying information about objects:


Listing objects

The wscp list operation lists all instances of an object type or, optionally, only those instances that meet the specified criteria. The syntax is as follows:

object_type list  [-constraint attr_list]  [-recursive]

The arguments are as follows:

  • -constraint attr_list. Specifies a Tcl list of attributes to use as a constraint. Only objects with the specified attribute-value pairs are listed.

  • -recursive. Lists all instances of any object type that belongs to the containment hierarchy of the specified type.

The following example command lists all instances of the ApplicationServer object type in the domain:

wscp> ApplicationServer list
{/Node:dev-pc/ApplicationServer:Default Server/} {/Node:dev-pc/ApplicationServer:AcctServer1/}
{/Node:dev-pc/ApplicationServer:AppServerGroup1/} {/Node:dev-pc/ApplicationServer:AppServerGroup2/}
{/Node:dev-pc/ApplicationServer:CustServer1/}

The -recursive option lists all instances of any object type that belongs to the containment hierarchy of the specified type. TFor instance, for a JDBCDriver object type, the -recursive option lists all instances of DataSource.

wscp> JDBCDriver list -recursive
/JDBCDriver:OracleDrv/ /JDBCDriver:OracleDrv/DataSource:OracleDB/
/JDBCDriver:OracleDrv/DataSource:AppDb1/ /JDBCDriver:DB2Drv/
/JDBCDriver:DB2Drv/DataSource:WAS/ /JDBCDriver:DB2Drv/DataSource:AppDb2/
/JDBCDriver:DB2Drv/DataSource:SampleDB/

The following example lists only those application servers whose PingInterval attribute has 60 as its value:

wscp> ApplicationServer list -constraint {{PingInterval 60}}
{/Node:dev-pc/ApplicationServer:AcctServer1/} {/Node:dev-pc/ApplicationServer:CustServer1/}
{/Node:dev-pc/ApplicationServer:AppServer2/}

Querying (displaying) attributes

The wscp show operation displays the values of all attributes or a specified subset of attributes for an object instance. The syntax is as follows:

object_type show object_name [-all] [-attribute attr_list]

The arguments are as follows:

  • object_type. Specifies the object type of the instance.

  • object_name. Specifies the object instance whose attributes are to be displayed.

  • -all. Displays the values of all attributes (those that are set as well as those that are not set). See Working with the default values of attributes for details on attributes.

  • -attribute attr_list. Specifies a Tcl list of attributes to display.

The following show operation displays all attributes of a node named ws2. (The variable $node is set to the fully qualified name of the node.)

wscp> Node show $node -all
{Name ws2} {FullName /Node:ws2/} {CurrentState Running}
{DesiredState Running} {StartTime 988812380570} {HostName
wssol2.transarc.ibm.com} {HostSystemType sparc} {ProcessId 10266}
{InstallRoot /opt/WebSphere/AppServer} {PathMap {WSCP0008I:
EditorNotDefinedForThisProperty}}

The following show operation displays the values of specific attributes (the Name and CurrentState attributes) of an application server:

wscp> ApplicationServer show /Node:dev-pc/ApplicationServer:myServer/ \
-attribute {Name CurrentState}
{Name myServer} {CurrentState running}

The wscp show operation is implemented somewhat differently for application servers because several attributes have very long values. By default, the ApplicationServer show operation displays all application server attributes except the JVMConfig, ORBConfig, and WebContainerConfig attributes, which have very long multipart values. However, wscp does provide two ways to display the values of these attributes:

  • By using the -attribute flag to explicitly display their values. For example, the following show operation displays the value of the JVMConfig attribute:
    wscp> ApplicationServer show /Node:node1/ApplicationServer:myServ/ -attribute {JVMConfig}
    {JVMConfig {{JvmPropertiesArray {}} {AdditionalCommandLineArgs {}}
    {BootClasspathAppend {}} {BootClasspathPrepend {}}
    {BootClasspathReplace {}} {Classpaths {}} {DebugMode false}
    {DebugString {}} {DisableJIT false} {HProfArgs {}} {InitialHeapSize
    0} {MaxHeapSize 0} {RunHProf false} {SystemProperties {}}
    {VerboseGC false} {VerboseJNI false} {GeneratedCommandLineArgs {}}}}
    

  • By using the ApplicationServer showall operation to display the values of all application server attributes, regardless of their length.

The show and showAttrs operations perform different functions. All object types have a show operation for displaying attributes. Server group objects have, in addition to the show operation, the showAttrs operation. For these objects, the show operation displays the attributes associated with the server group--for example, the IfStarted and StartTime attributes. The showAttrs operation displays the default attributes of clones associated with the server group. (These attributes match the properties for the application server resource.)

The following examples illustrate output for a show and showAttrs operation. The object ServGrp1 is a server group created for an application server:

# show command
wscp> ServerGroup show /ServerGroup:ServGrp1/
{Name ServGrp1} {FullName /ServerGroup:ServGrp1/} {StartTime 0}
{IfStarted False} {EJBServerAttributes {{Name AttributeNotSet}
{FullName AttributeNotSet} {CurrentState Stopped} {DesiredState
Stopped} {StartTime 0} {ProcessId 0} {Environment {}} {Executable
java} {ExecutableActive java} {CommandLineArgs {}}
{CommandLineArgsActive {}} {EnvironmentActive {}} {UserId {}}
{UserIdActive {}} {GroupId {}} {GroupIdActive {}} {WorkingDirectory
{}} {WorkingDirectoryActive {}} {Umask 18} {UmaskActive 18} {Stdin {}}
{StdinActive {}} {Stdout /tmp/Broker.stdout} {StdoutActive
/tmp/Broker.stdout} {Stderr /tmp/Broker.stderr} {StderrActive
/tmp/Broker.stderr} {MaxStartupAttempts 2} {ProcessPriority 20}
{ProcessPriorityActive 20} {PingInterval 60} {PingTimeout 200}
{PingInitialTimeout 300} {TraceSpec {}} {SystemProperties {}}
{ThreadPoolConfig {MinimumSize 10} {MaximumSize 50} {InactivityTimeout
10} {IsGrowable false}} {Transports {{{Protocol http} {Host *} {Port
9080} {SSLConfig {}} {MaxKeepAlive 25} {MaxReqKeepAlive 100}
{KeepAliveTimeout 5} {ConnectionTimeout 5} {BacklogConnections 50}
{HttpProperties {}} {SSLEnabled false}}}} {DynamicCacheConfig
{CacheSize 1000} {Enabled false} {CacheGroups {}}}}} {ModuleVisibility
3} {ModuleVisibilityActive 3} {UseDomainQualifiedUserNames False}
{UseDomainQualifiedUserNamesActive False} {DefaultDataSource {}}
#showAttrs command
wscp> ServerGroup showAttrs /ServerGroup:ServGrp1/
{CurrentState Stopped} {DesiredState Stopped} {StartTime 0} {ProcessId
0} {Environment {}} {Executable java} {ExecutableActive java}
{CommandLineArgs {}} {CommandLineArgsActive {}} {EnvironmentActive {}}
{UserId {}} {UserIdActive {}} {GroupId {}} {GroupIdActive {}}
{WorkingDirectory {}} {WorkingDirectoryActive {}} {Umask 18}
{UmaskActive 18} {Stdin {}} {StdinActive {}} {Stdout
/tmp/Broker.stdout} {StdoutActive /tmp/Broker.stdout} {Stderr
/tmp/Broker.stderr} {StderrActive /tmp/Broker.stderr}
{MaxStartupAttempts 2} {ProcessPriority 20} {ProcessPriorityActive 20}
{PingInterval 60} {PingTimeout 200} {PingInitialTimeout 300}
{TraceSpec {}} {SystemProperties {}} {ThreadPoolConfig {MinimumSize
10} {MaximumSize 50} {InactivityTimeout 10} {IsGrowable false}}
{Transports {{{Protocol http} {Host *} {Port 9080} {SSLConfig {}}
{MaxKeepAlive 25} {MaxReqKeepAlive 100} {KeepAliveTimeout 5}
{ConnectionTimeout 5} {BacklogConnections 50} {HttpProperties {}}
{SSLEnabled false}}}} {DynamicCacheConfig {CacheSize 1000} {Enabled
false} {CacheGroups {}}}}} {ModuleVisibility 3}
{ModuleVisibilityActive 3} {UseDomainQualifiedUserNames False}
{UseDomainQualifiedUserNamesActive False} {DefaultDataSource {}}

The following custom procedure, display, displays the output of the show operation in a readable format--one attribute per line. The procedure's arguments are an object type and the name of an object instance.

#
# display - a procedure for displaying attributes in a readable format.
#
# Arguments:
#
# type - the object type whose attributes are to be displayed.
#
# name - the fully-qualified name of the object instance whose attributes
# are to be displayed.
#

proc display {type name} {

set attrs [$type show $name]
foreach attr $attrs {
puts $attr
}
}
display

The following example demonstrates output from the display procedure. The procedure is used display the attributes of a JDBCDriver object named DB2_Drv:

wscp> display JDBCDriver /JDBCDriver:DB2_Drv/
Name DB2_Drv
FullName /JDBCDriver:DB2_Drv/
Description null
ImplClass COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource

This procedure is available in 6.6.0.2.2.5: Sample Tcl procedures and scripts.


Printing an object's attributes

The custom Tcl procedure printAttributes uses the attributes operation to print all or a subset of attributes for one or more object types.

  • If no arguments are specified, the procedure prints the names of all attributes for all object types.

  • If one or more options of the attributes operation are specified (for example, if the -required and -readOnly options are specified), the command prints only those groups of attributes.

  • If one or more object types are specified, the command prints the attributes for the specified object types.
#
# printAttributes - prints the attributes for any objects specified or
# for all objects if no objects are specified.
#
# Arguments:
#
# options - a list of options to control the types of attributes printed.
# Every option in the list of option names must be a valid option to the
# wscp attributes command (for example, -required or -cloneOnly)
# AND the option name must begin with a "-".
#
# objects - a list of objects whose attributes are to be printed.
#
# The file init.tcl must be loaded prior to using this procedure.
#

proc printAttributes {{options all} {objects all} args} {
global OBJECTS
if {[string first "-" $options] != 0} {
set objects $options
set options ""
}
if {[string compare $objects "all"] == 0} {set objects $OBJECTS}
if {$args != ""} {
foreach arg $args {
lappend objects $arg
}
}

foreach o $objects {
set cmd [concat $o attributes $options]
puts "# $cmd"
set result [eval $cmd]
puts $result

}
}
printAttributes

The following example commands demonstrate the use of the printAttributes procedure. The first example prints only the attributes associated with clones of ApplicationServer objects.

wscp> printAttributes -cloneOnly ApplicationServer
# ApplicationServer attributes -cloneOnly
Name FullName

The following command prints all required attributes for all object types:

wscp> printAttributes -required
# JDBCDriver attributes -required
Name ImplClass
# VirtualHost attributes -required
Name AliasList
# ApplicationServer attributes -required
Name
# DataSource attributes -required
Name
# EnterpriseApp attributes -required
Name OrigEarFile OrigNodeName
# GenericServer attributes -required
Name Executable
# J2CConnectionFactory attributes -required
Name
# J2CResourceAdapter attributes -required
Name ArchiveFile
# JMSConnectionFactory attributes -required
Name ConnectionType ExternalJNDIName
# JMSDestination attributes -required
Name ExternalJNDIName DestinationType
# JMSProvider attributes -required
Name ExternalInitialContextFactory ExternalProviderUR
# MailSession attributes -required
Name MailTransportHost
# Module attributes -required
Name ModuleType RelativeURI ModuleTypeActive
# Node attributes -required
Name
# ServerGroup attributes -required
Name
# URL attributes -required
Name Spec
# URLProvider attributes -required
Name Protocol StreamHandlerClassName

The following command prints, for ApplicationServer and EnterpriseApp objects, only those attributes that are required and that are specified at startup:

wscp> printAttributes {-required -startUp} {ApplicationServer EnterpriseApp}
# ApplicationServer attributes -required -startUp
Name Environment CommandLineArgs UserId GroupId WorkingDirectory Umask
Stdin Stdout Stderr MaxStartupAttempts ProcessPriority TraceSpec
SystemProperties TraceOutput LogFileSpec DebugEnabled SourcePath
OLTEnabled OLTServerHost OLTServerPort IsAClone SecurityEnabled
CacheConfig WebContainerConfig ModuleVisibility
UseDomainQualifiedUserNames DefaultDataSource
# EnterpriseApp attributes -required -startUp
Name OrigEarFile OrigNodeName Bindings

This procedure is available in 6.6.0.2.2.5: Sample Tcl procedures and scripts.


Viewing the containment hierarchy

The custom procedure printContainment can be used to display the containment hierarchy of a single object type or the entire object type hierarchy. The procedure takes zero or more arguments. Arguments are object types. If no arguments are supplied, the procedure prints the containment hierarchy for all object types. If one or more arguments are supplied, the procedure prints the containment hierarchy for the specified object types only. Prior to using the procedure, you must also load the init.tcl file.

#
# printContainment - a procedure that prints the containment hierarchy for
# one or more object types.
#
# The script init.tcl must be loaded prior to using this procedure.
#
# Arguments:
#
# objects - one or more object types whose containment hierarchies are to be printed.
#
# The init.tcl file must be loaded prior to using this procedure.
#

proc printContainment {{objects all} args} {
global OBJECTS
if {$objects == "all"} {set objects $OBJECTS}

if {"$args" != "" } {
foreach elem $args {
lappend objects $elem
}
}

foreach o $objects {
set cmd [concat $o containment]
puts "# $cmd"
set result [eval $cmd]
puts $result
}
}
printContainment

The following example command demonstrates the use of the printContainment procedure to display the containment hierarchy of ApplicationServer and JDBCDriver objects:

wscp> printContainment {ApplicationServer JDBCDriver}
# ApplicationServer containment
Node ApplicationServer
# JDBCDriver containment
JDBCDriver

To print the containment heirarchy of all objects, issue the printContainment command without any options.

The printContainment procedure is available in 6.6.0.2.2.5: Sample Tcl procedures and scripts.


Displaying select attributes

The following custom procedure, showServerStatus, displays the status (the value of the CurrentState attribute) of all application servers in a domain. The procedure can be customized to display additional attributes or attributes of other objects.

#
# showServerStatus - a procedure for displaying the value of the
# Name and CurrentState attribute of all application servers
# in a domain.
#

proc showServerStatus {} {

puts "\nStatus of servers in the domain:\n"

foreach ejbserver [ApplicationServer list] {
puts [ApplicationServer show $ejbserver -attribute {Name CurrentState}]
}
}
showServerStatus

The following example demonstrates output of the showServerStatus procedure:

wscp> showServerStatus
Status of servers in the domain:
{Name {Default Server}} {CurrentState {Initialization Failed}}
{Name {Appl Server1}} {CurrentState Running}
{Name {ServerGroup1}} {CurrentState Stopped}
{Name {ServerGroup2}} {CurrentState Stopped}
{Name {Appl Server2}} {CurrentState Running}
{Name {My Server}} {CurrentState Stopped}
{Name {Test Server}} {CurrentState Stopped}

The display procedure is available in 6.6.0.2.2.5: Sample Tcl procedures and scripts.

Go to previous article: 6.6.0.2.2.4.3: Starting and stopping live repository objects Go to next article: 6.6.0.2.2.4.5: Removing objects and applications

 

 
Go to previous article: 6.6.0.2.2.4.3: Starting and stopping live repository objects Go to next article: 6.6.0.2.2.4.5: Removing objects and applications