JACL Script : Get server status & OS details before deployment
This script is designed to get complete server status details and OS details just before deployemnt. Its designed to help in debugging and simulating the same environment.
Note:No arguments required for this script to run
I have added JACL script output first, scroll down to see the actual script.
[was61@Machine1 ~]$ /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -user sagar -password 1234 -f getdetails.jacl
WASX7209I: Connected to process “dmgr” on node Machine1_Manager using SOAP connector; The type of process is : DeploymentManager
****************************************************************
— GET ALL DEBUG DETAILS —
****************************************************************
server details on Jul. 14, 2010 03:24:10 PM
Starting getDetails script …
———————————————————————-
Number of running servers on node Machine1_Manager: 1
Server dmgr processtype: DeploymentManager
Server dmgr state STARTED
Server dmgr JVM details WebSphere:name=JVM,process=dmgr,platform=proxy,node=Machine1_Manager,j2eeType=JVM,J2E EServer=dmgr,version=6.1.0.21,type=JVM,mbeanIdentifier=JVM,cell=Machine1_Cell,spec=1.0
———————————————————————————
Websphere Application Server dmgr Java Env. Details:
———————————————————————————
Java Specification Name: Java Platform API Specification
Java Specification vendor Name: Sun Microsystems Inc.
Java Specification Version: 1.5
java.util.logging.manager : com.ibm.ws.bootstrap.WsLogManager
java.util.logging.configureByServer : true
java.util.prefs.PreferencesFactory : com.ibm.ws.util.prefs.HashPreferencesFactory
java.vendor : IBM Corporation
java.vendor.url : http://www.ibm.com/
java.version : 1.5.0
Java virtual machine info: J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423ifx-20080811 (JIT enabled)
J9VM – 20080809_21892_LHdSMr
JIT – 20080620_1845_r8
GC – 200806_19
—————————————————————————
dmgr (DeploymentManager) has pid 2231; state: STARTED; on Linux
Number of applications running on dmgr: 3
ManagementEJB
—————————————————————-filetransfer
—————————————————————-isclite
—————————————————————-Number of running servers on node Machine1_Node01: 3
Server server_member1 processtype: ManagedProcess
Server server_member1 state STARTED
Server server_member1 JVM details WebSphere:name=JVM,process=server_member1,platform=proxy,node=Server1 ,j2eeType=JVM,J2EEServer=server_member1,version=6.1.0.21,type=JVM,mbeanIdentifier=JVM,cell=Server1_Cell,spec=1.0
———————————————————————————
Websphere Application Server server_member1 Java Env. Details:
———————————————————————————
Java Specification Name: Java Platform API Specification
Java Specification vendor Name: Sun Microsystems Inc.
Java Specification Version: 1.5
java.util.logging.manager : com.ibm.ws.bootstrap.WsLogManager
java.util.logging.configureByServer : true
java.util.prefs.PreferencesFactory : java.util.prefs.FileSystemPreferencesFactory
java.vendor : IBM Corporation
java.vendor.url : http://www.ibm.com/
java.version : 1.5.0
Java virtual machine info: J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423ifx-20080811 (JIT enabled)
J9VM – 20080809_21892_LHdSMr
JIT – 20080620_1845_r8
GC – 200806_19
—————————————————————————
server_member1 (ManagedProcess) has pid 2507; state: STARTED; on Linux
Number of applications running on server_member1: 1
perfServletApp
—————————————————————-Server server_member2 processtype: ManagedProcess
Server server_member2 state STARTED
Server server_member2 JVM details WebSphere:name=JVM,process=server_member2,platform=proxy,node=server1 _Node01,j2eeType=JVM,J2EEServer=server_member2,version=6.1.0.21,type=JVM,mbeanIdentifier=JVM,cell=server1_Cell,spec=1.0
———————————————————————————
Websphere Application Server server_member2 Java Env. Details:
———————————————————————————
Java Specification Name: Java Platform API Specification
Java Specification vendor Name: Sun Microsystems Inc.
Java Specification Version: 1.5
java.util.logging.manager : com.ibm.ws.bootstrap.WsLogManager
java.util.logging.configureByServer : true
java.util.prefs.PreferencesFactory : java.util.prefs.FileSystemPreferencesFactory
java.vendor : IBM Corporation
java.vendor.url : http://www.ibm.com/
java.version : 1.5.0
Java virtual machine info: J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423ifx-20080811 (JIT enabled)
J9VM – 20080809_21892_LHdSMr
JIT – 20080620_1845_r8
GC – 200806_19
—————————————————————————
server_member2 (ManagedProcess) has pid 2705; state: STARTED; on Linux
Number of applications running on server_member2: 1
perfServletApp
—————————————————————-Server nodeagent processtype: NodeAgent
Server nodeagent state STARTED
Server nodeagent JVM details WebSphere:name=JVM,process=nodeagent,platform=proxy,node=Machine1_Node01,j2eeTyp e=JVM,J2EEServer=nodeagent,version=6.1.0.21,type=JVM,mbeanIdentifier=JVM,cell=Machine1_Cell,spec=1.0
———————————————————————————
Websphere Application Server nodeagent Java Env. Details:
———————————————————————————
Java Specification Name: Java Platform API Specification
Java Specification vendor Name: Sun Microsystems Inc.
Java Specification Version: 1.5
java.util.logging.manager : com.ibm.ws.bootstrap.WsLogManager
java.util.logging.configureByServer : true
java.util.prefs.PreferencesFactory : java.util.prefs.FileSystemPreferencesFactory
java.vendor : IBM Corporation
java.vendor.url : http://www.ibm.com/
java.version : 1.5.0
Java virtual machine info: J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423ifx-20080811 (JIT enabled)
J9VM – 20080809_21892_LHdSMr
JIT – 20080620_1845_r8
GC – 200806_19
—————————————————————————
nodeagent (NodeAgent) has pid 2368; state: STARTED; on Linux
Number of applications running on nodeagent: 0
getdetails: — Done.
—————————————————————————————————
Actual JACL Script is as below
###############################################################################
# #
# getdetails.jacl #
# ——————————— #
# Purpose: #
# This script is designed to get complete server status/ #
# details and OS details #
# just before deployemnt. Its designed to help in debugging #
# and simulating the same environment. #
# Note:No arguments required for this script to run #
# #
###############################################################################
#
#—————————————————
# Setting the User Script Location
#————————————————–
set ScriptLocation [java::call java.lang.System getProperty “script.dir”]
if { $ScriptLocation==”” } then {
set ScriptLocation [java::call java.lang.System getProperty “user.dir”]
}
set ScriptLocation “$ScriptLocation/”puts “****************************************************************”
puts “– GET ALL DEBUG DETAILS –”
puts “****************************************************************”
set datetime [clock format [clock seconds] -format {%b. %d, %Y %I:%M:%S %p}]
puts “server details on $datetime”
puts “Starting getDetails script …”
puts “———————————————————————-”
#—————————————————————-
# lines 4 and 5 find all the cell and process them one at a time
#—————————————————————-
set cells [$AdminConfig list Cell]
#puts “Echo : $cells”foreach cell $cells {
#———————————————————————–
# lines 10 and 11 find all the nodes belonging to the cell and
# process them at a time
#———————————————————————–
#puts ” $cell”
set nodes [$AdminConfig list Node $cell]
#puts “echo $nodes”
foreach node $nodes {#————————————————————–
# lines 16-20 find all the running servers belonging to the cell
# and node, and process them one at a time
#————————————————————–
set cname [$AdminConfig showAttribute $cell name]
#puts “cname : $cname”
set nname [$AdminConfig showAttribute $node name]
#puts “nname : $nname”
set servs [$AdminControl queryNames type=Server,cell=$cname,node=$nname,*]
#puts “servs = $servs”
puts “Number of running servers on node $nname: [llength $servs]”
foreach server $servs {
#———————————————————
# lines 25-31 get some attributes from the server to display;
# invoke an operation on the server JVM to display a property.
#———————————————————
set sname [$AdminControl getAttribute $server name]
set ptype [$AdminControl getAttribute $server processType]
puts “Server $sname processtype: $ptype ”
set pid [$AdminControl getAttribute $server pid]
set state [$AdminControl getAttribute $server state]
puts “Server $sname state $state”
set jvm [$AdminControl queryNames type=JVM,cell=$cname,node=$nname,process=$sname,*]
puts “Server $sname JVM details $jvm”
puts “———————————————————————————”
puts “Websphere Application Server $sname Java Env. Details: ”
puts “———————————————————————————”
set javaspecname [$AdminControl invoke $jvm getProperty java.specification.name]
puts ” Java Specification Name: $javaspecname ”
set javaspecvendorname [$AdminControl invoke $jvm getProperty java.specification.vendor]
puts “Java Specification vendor Name: $javaspecvendorname ”
set javaver [$AdminControl invoke $jvm getProperty java.specification.version]
puts “Java Specification Version: $javaver”
set javalogmanager [$AdminControl invoke $jvm getProperty java.util.logging.manager]
puts “java.util.logging.manager : $javalogmanager”
set javalogconfig [$AdminControl invoke $jvm getProperty java.util.logging.configureByServer]
puts ” java.util.logging.configureByServer : $javalogconfig”
set javautilpre [$AdminControl invoke $jvm getProperty java.util.prefs.PreferencesFactory]
puts “java.util.prefs.PreferencesFactory : $javautilpre”
set javavendor [$AdminControl invoke $jvm getProperty java.vendor]
puts “java.vendor : $javavendor”
set javavendorurl [$AdminControl invoke $jvm getProperty java.vendor.url]
puts “java.vendor.url : $javavendorurl ”
set javaversion [$AdminControl invoke $jvm getProperty java.version]
puts “java.version : $javaversion ”
set javavminfo [$AdminControl invoke $jvm getProperty java.vm.info]
puts “Java virtual machine info: $javavminfo”
set osname [$AdminControl invoke $jvm getProperty os.name]
#puts “Operating System found for $sname: $osname”
puts “—————————————————————————”
puts ” $sname ($ptype) has pid $pid; state: $state; on $osname”
#———————————————————
# line 37-42 find the applications running on this server and
# display the application name.
#———————————————————
set apps [$AdminControl queryNames type=Application,cell=$cname,node=$nname,process=$sname,*]
#puts “apps= $apps ”
puts ” Number of applications running on $sname: [llength $apps]”
foreach app $apps {
set aname [$AdminControl getAttribute $app name]
puts ” $aname”
puts “—————————————————————-”
puts “”
}
}
}
}
puts “getdetails: — Done.”
puts “—————————————————————————————————“
Leave a Reply
You must be logged in to post a comment.