Network Deployment (Distributed operating systems), v8.0 > Troubleshoot and support > Work with Diagnostic Providers
Use Diagnostic Providers from wsadmin scripts
Overview
In addition to enabling Diagnostic Providers (DP) from the administration console, you can also use them through scripts from the Wsadmin tool.
You might want to enable, disable, or configure Diagnostic Providers from the admin console, but in some cases it might be more efficient or useful to do so with scripts using the wsadmin tool.
Read wsadmin.sh 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.
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 we 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:
WebContainerDP
Now 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 easily consumable. Enter
set DS [lindex [$AdminControl queryNames name=DiagnosticService,*] 0]
- Run a configDump. We 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). .
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. We 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
Related
Start the wsadmin scripting client using wsadmin.sh
wsadmin scripting tool
Modify the State Collection Specification from wsadmin scripts