How to use websphere application server wsadmin scripting tool
Test Environment
Fedora 32
What is wsadmin
Its a scripting solution provided by Websphere application server to administer the websphere environment.
wsadmin tasks could be divided into two types i.e Operational tasks and Configurational task.
Operational tasks deal with Live objects in the Websphere environment (MBeans).
Configurational tasks deal with configuration of the Websphere environment (XML files).
In this article we will look at some basic examples dealing with AdminControl object that we can use for the Operational tasks
Here are the general steps to manage a MBean
- Find the MBean Object name
- Invoke the Operation on the Running MBean Object
- Get or Set attributes for that running object
Procedure
Step1: Checking the state of dmgr
Connect to the wsadmin tool from the command line and execute the below commands
# Assign the dmgr variable with the dmgr MBean object
wsadmin>dmgr = AdminControl.completeObjectName('name=dmgr,type=Server,*')
# Check the value of the dmgr to confirm
wsadmin>print dmgr WebSphere:name=dmgr,process=dmgr,platform=proxy,node=XXXXXCellManager01,j 2eeType=J2EEServer,version=8.5.5.0,type=Server,mbeanIdentifier=cells/XXXXXCell01/nodes/XXXXXCellManager01/servers/dmgr/server.xml#Server_1, cell=XXXXXCell01,spec=1.0,processType=DeploymentManager
# Get the state of the dmgr Bean
wsadmin>print AdminControl.getAttribute(dmgr, 'state') STARTED
Step2: Checking the Node Sync state
Verify the nodesync status using the wsadmin
# Assign the nodesync variable with the NodeSync type MBean object
wsadmin>nodesync = AdminControl.completeObjectName('type=NodeSync,*')
# Check the value of the nodesync
wsadmin>print nodesync 'WebSphere:name=nodeSync,process=nodeagent,platform=common,node=XXXXXNode 02,diagnosticProvider=true,version=8.5.5.0,type=NodeSync,mbeanIdentifier=nodeSyn c,cell=XXXXXCell01,spec=1.0'
# Get the synchronization status
wsadmin>AdminControl.invoke(nodesync, 'isNodeSynchronized') 'true'
Note – completeObjectName only returns the first object name matching the pattern specified.
Hope you enjoyed reading this article. Thank you.
Leave a Reply
You must be logged in to post a comment.