Use Diagnostic Providers from wsadmin scripts
In addition to enabling Diagnostic Providers (DP) from the administration console, you can also use them through scripts from the Wsadmin tool.
Overview
You might want to enable, disable, or configure Diagnostic Providers from the console, but in some cases it might be more efficient or useful to do so with scripts using the wsadmin tool.Read the topic on the Wsadmin tool for more information about using the tool with scripts.
Procedure
- List the MBeans that implement the Diagnostic Provider (DP) interface. Enter
$AdminControl queryNames diagnosticProvider=true,*And you will see an output that displays all of the Diagnostic Providers in a format like this:"WebSphere:name=Default Datasource,process=server1,platform=dynamicproxy,node= camelhair,JDBCProvider=Derby JDBC Provider, diagnosticProvider=true,j2eeType=JDBCDataSource,J2EEServer=server1,Server=server1, version=6.1.0.0,type=DataSource, mbeanIdentifier=cells/camelhairCell/nodes/camelhair/servers/server1/resources.xml# DataSource_1131113688564, JDBCResource=Derby JDBC Provider,cell=camelhairCell" "WebSphere:name=DefaultEJBTimerDataSource,process=server1,platform=dynamicproxy, node=camelhair, JDBCProvider=Derby JDBC Provider (XA),diagnosticProvider=true,j2eeType= JDBCDataSource,J2EEServer=server1,Server=server1,version=6.1.0.0,type=DataSource, mbeanIdentifier=cells/camelhairCell/nodes/camelhair/servers/server1/ resources.xml#DataSource_1000001, JDBCResource=Derby JDBC Provider (XA),cell=camelhairCell" WebSphere:name=WebcontainerDiagnosticProvider,process=server1,platform= dynamicproxy,node=camelhair,diagnosticProvider=true, version=6.1.0.0,type=WebcontainerEventProvider,mbeanIdentifier=null, cell=camelhairCell
- Capture the ObjectName of your Diagnostic Provider in a variable. This enables you to reference your Diagnostic Provider more easily, especially in a script. For example, instead of typing all of those lines, if you want to work with the WebContainer Diagnostic Provider, for example, you can do the following:
- set DP [lindex [$AdminControl queryNames name=WebcontainerDiagnosticProvider,diagnosticProvider=true,*] 0]
This ObjectName stored in the DP variable can be used on the methods, or you can use the Diagnostic Provider name as text or a variable.
- Now that you have the ObjectName in a variable, you can get the Diagnostic Provider name in a variable with the command:
set DPNm [$AdminControl invoke $DS getDiagnosticProviderNameById $DP]This provides the result:WebContainerDPNow the DiagnosticProvider (WebContainer) is addressable by its objectname in variable DP, or by its DiagnosticProvider name in variable DPNm. If you would prefer, you can hard-code the DPName WebContainerDP as it is short enough.
- Save the ObjectName of the DiagnosticService MBean to a variable. For wsadmin, WAS provides this MBean so that the output of the Diagnostic Provider is more consumable. Enter
set DS [lindex [$AdminControl queryNames name=DiagnosticService,*] 0]
- Run a configDump. You can run a configDump and capture all attributes with the command:
$AdminControl invoke $DS configDumpFormattedById [list $DP .* true null]This lists the values that the Diagnostic Provider used at start up (and possible current values). An excerpt of the configDump output follows.
Item Concatenated Name Value customProperties = Null defaultVirtualHostName = default_host jvmProps = Null localeProps = Null servletCachingEnabled = false aliases = *:9080;*:80;*:9443;
- Filter the output of your configDump. You can use configDumpFormatted (leaving off the ById) and switch $DP for $DPNm or the string WebContainerDP. This example uses $DPNm on this slightly modified version whereby it only picks up attributes dealing with automation:
$AdminControl invoke $DS configDumpFormatted [list $DPNm .*auto.* true null]This results in just those attributes that contain auto in them. Full (but strict) regular expression syntax is allowed:
Item Concatenated Name Value autoLoadFiltersEnabled = false autoRequestEncoding = false autoResponseEncoding = false autoLoadFiltersEnabled = false autoRequestEncoding = false autoResponseEncoding = false The syntax is the same for stateDumps and selfDiagnostics
Start the wsadmin scripting client
Related Reference
Wsadmin tool
Related information
Modifying the State Collection Specification from wsadmin scripts