k_satish22
asked on
Jython Script for Recycle
Hello Team,
I am looking for a script which can do following actions
1. Stop all the JVM's running in a cell excluding DMGR.
2. Need to check if all the JVM's are down or not if some JVM are running script should kill the JVM's and do one more Check.
3. Start all the JVM's.
I am looking for a script which can do following actions
1. Stop all the JVM's running in a cell excluding DMGR.
2. Need to check if all the JVM's are down or not if some JVM are running script should kill the JVM's and do one more Check.
3. Start all the JVM's.
ASKER
Yes including the nodeagent also. If the JVM generates the javacores and the JVM is unresponsive it should kill the process too. If it is not possible using the jython script even shell script is okay for me.
What operating system(s)?
What version(s) of WebSphere?
- Execute: D:\IBM\WebSphere\AppServer \bin\versi onInfo
or: /opt/IBM/WebSphere/AppServ er/bin/ver sionInfo.s h
What is displayed in the "Installed Product" section?
What version(s) of WebSphere?
- Execute: D:\IBM\WebSphere\AppServer
or: /opt/IBM/WebSphere/AppServ
What is displayed in the "Installed Product" section?
ASKER
OS - AIX
Installed Product
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Name IBM WebSphere Application Server - ND
Version 7.0.0.13
Installed Product
--------------------------
Name IBM WebSphere Application Server - ND
Version 7.0.0.13
Here's a challenge, at least for a Jython script
- When a wsadmin script is executing, and the connection is to the Deployment
Manager, should a problem exist with a node agent (e.g., it is either stopped,
or not responding to requests), then every Application Server on that node
is incommunicado, and the script that is executing is unable to access every
AppServer under (associated with) that nodeagent.
Q: What would you think about a Python script that executes outside of
(totally separate from) wsadmin?
Request:
Please execute the following command to verify that python is installed, and
is available:
# python -V
The response should be something like:
Python w.x.y
where
w == Major version number (e.g., 2 or 3)
x == Minor version number
y == Release number
- When a wsadmin script is executing, and the connection is to the Deployment
Manager, should a problem exist with a node agent (e.g., it is either stopped,
or not responding to requests), then every Application Server on that node
is incommunicado, and the script that is executing is unable to access every
AppServer under (associated with) that nodeagent.
Q: What would you think about a Python script that executes outside of
(totally separate from) wsadmin?
Request:
Please execute the following command to verify that python is installed, and
is available:
# python -V
The response should be something like:
Python w.x.y
where
w == Major version number (e.g., 2 or 3)
x == Minor version number
y == Release number
ASKER
Hello HonorGod,
We don't have pyton on our servers. Is there any alternative like ksh script?
Thank You so much for your help
We don't have pyton on our servers. Is there any alternative like ksh script?
Thank You so much for your help
Q: Is there any alternative like ksh script?
A: Always... ;-)
It's simply a matter of finding out what tools are available...
Let me see what I can figure out...
A: Always... ;-)
It's simply a matter of finding out what tools are available...
Let me see what I can figure out...
You do realize that you're going to make me work, right? ;-)
This is a non-trivial task (which of course makes it more interesting).
Q: If a nodeagent, and/or server is inactive, should it be left as stopped, or started?
This is a non-trivial task (which of course makes it more interesting).
Q: If a nodeagent, and/or server is inactive, should it be left as stopped, or started?
ASKER
Yes. But I need this script :)
If the nodeagent or server is inactive or running as rouge process script need to kill the process and start it.
If the nodeagent or server is inactive or running as rouge process script need to kill the process and start it.
While I was working on it, I realized that we have a potential problem...
In order to start a nodeagent that is stopped, we need to execute the startNode command script on the nodeagent machine.
Do you only have one nodeagent, and is it on the same machine as your DM?
Does this make sense?
Option:
If a nodeagent is active, a wsadmin script can locate the nodeagent MBean identifier, and use it to invoke the MBean restart method.
Is it possible that the restart could fail, or hang?
Yes, but this isn't likely. How often have you had a stopNode or stopServer command script fail?
In order to start a nodeagent that is stopped, we need to execute the startNode command script on the nodeagent machine.
Do you only have one nodeagent, and is it on the same machine as your DM?
Does this make sense?
Option:
If a nodeagent is active, a wsadmin script can locate the nodeagent MBean identifier, and use it to invoke the MBean restart method.
Is it possible that the restart could fail, or hang?
Yes, but this isn't likely. How often have you had a stopNode or stopServer command script fail?
ASKER
In few environments we have DMGR and Node agent on the same servers and in few environments DMGR and Node agents on separate servers.
Our Architecture is One ND and multiple Nodes.
ok, so you do realize that from the DM machine, the "startNode.sh" can not be run to start a node agent on a remote machine.... right?!?
Unless, of course, you have some kind of mechanism for this kind of "remote execution" (hopefully using a secure connection between the machines).
Unless, of course, you have some kind of mechanism for this kind of "remote execution" (hopefully using a secure connection between the machines).
ASKER
We have a ssh setup from one of our server to all the servers in the network. I am want run this script from that servers. It is also having WAS running on it.
Let's take a look at what this requires for a remote AppServer (including a nodeagent)
- Assuming that the specified AppServer (and it's nodeagent) are active, then the
Jython script we're talking about using will execute while connected to the DM.
- The recycle script will need to locate and identify each AppServer [doable]
- obtain it's process id (pid) [doable]
- tell the AppServer to stop [doable]
> Once this "stop" request completes, then the script will need to use some kind of
command to verify that the pid has, in fact, stopped
e.g., something like http://bashcurescancer.com/run_remote_commands_with_ssh.html
> If that results in a "false" (i.e., process still exists), we'll need to use this
> technique to send a "kill -9" for that process.
> Once the "stop" is complete, then the command to be issued (i.e., either
> startNode.sh or startServer.sh with the proper parameters (e.g., profileName)
> needs to be executed, and the results need to be verified / logged (i.e.,
> either success or failure.
Does this sound like what you want?
- Assuming that the specified AppServer (and it's nodeagent) are active, then the
Jython script we're talking about using will execute while connected to the DM.
- The recycle script will need to locate and identify each AppServer [doable]
- obtain it's process id (pid) [doable]
- tell the AppServer to stop [doable]
> Once this "stop" request completes, then the script will need to use some kind of
command to verify that the pid has, in fact, stopped
e.g., something like http://bashcurescancer.com/run_remote_commands_with_ssh.html
> If that results in a "false" (i.e., process still exists), we'll need to use this
> technique to send a "kill -9" for that process.
> Once the "stop" is complete, then the command to be issued (i.e., either
> startNode.sh or startServer.sh with the proper parameters (e.g., profileName)
> needs to be executed, and the results need to be verified / logged (i.e.,
> either success or failure.
Does this sound like what you want?
ASKER
Yes exactly that is my requirement.
ok, how do you want to do this?
We could have some kind of shell script that takes parameters, and uses them to execute the specified command (e.g., startNode or startServer) on the specified remote machine.
Another possibility would be to have the required commands in something like a properties file which the jython could load as part of it's initialization process.
One challenge:
- How do you want to secure the necessary information (i.e., any userid & password)?
We could have some kind of shell script that takes parameters, and uses them to execute the specified command (e.g., startNode or startServer) on the specified remote machine.
Another possibility would be to have the required commands in something like a properties file which the jython could load as part of it's initialization process.
One challenge:
- How do you want to secure the necessary information (i.e., any userid & password)?
ASKER
I would like to go with first option. As of now my team only will have access to the directory where we place the script with may contain clear text user ID and password. We will think about the security issue later.
ok, in order to "verify" that a remote server has stopped, we'll have to be able to do something like execute a command something like this, and pass the results back for verification...
The number is the process id of a WebSphere AppServer process.
Does this make sense?
Can you:
- Use this command to list all of the WebSphere java processes:
ps -ef | grep [j]ava
- pick one of the processes ids, and see if you can use an ssh command to issue the command shown below for that process id.
The number is the process id of a WebSphere AppServer process.
Does this make sense?
Can you:
- Use this command to list all of the WebSphere java processes:
ps -ef | grep [j]ava
- pick one of the processes ids, and see if you can use an ssh command to issue the command shown below for that process id.
ps -ef | grep "28106 .*[j]ava"
ASKER
wasadmin@bforge02:wasadmin $ ssh wasadmin@dmgr1.e57.acsente rprise.com 'ps -ef | grep "1802688 .*[j]ava"'
wasadmin 1802688 1 0 Sep 18 - 8:48 /opt/app/IBM/WebSphere/App Dmgr70/jav a/bin/java -Declipse.security -Dwas.status.socket=53881 -Dosgi.install.area=/opt/a pp/IBM/Web Sphere/App Dmgr70 -Dosgi.configuration.area= /opt/app/I BM/WebSphe re/AppDmgr 70/profile s/AppDmgr0 1/configur ation -Djava.awt.headless=true -Dosgi.framework.extension s=com.ibm. cds,com.ib m.ws.eclip se.adaptor s -Xshareclasses:name=websph erev70_%g, groupAcces s,nonFatal -Xscmx50M -Xbootclasspath/p:/opt/app /IBM/WebSp here/AppDm gr70/java/ jre/lib/ex t/ibmorb.j ar:/opt/ap p/IBM/WebS phere/AppD mgr70/java /jre/lib/e xt/ibmext. jar -classpath /opt/app/IBM/WebSphere/App Dmgr70/pro files/AppD mgr01/prop erties:/op t/app/IBM/ WebSphere/ AppDmgr70/ properties :/opt/app/ IBM/WebSph ere/AppDmg r70/lib/st artup.jar: /opt/app/I BM/WebSphe re/AppDmgr 70/lib/boo tstrap.jar :/opt/app/ IBM/WebSph ere/AppDmg r70/lib/js f-nls.jar: /opt/app/I BM/WebSphe re/AppDmgr 70/lib/lmp roxy.jar:/ opt/app/IB M/WebSpher e/AppDmgr7 0/lib/urlp rotocols.j ar:/opt/ap p/IBM/WebS phere/AppD mgr70/depl oytool/itp /batchboot .jar:/opt/ app/IBM/We bSphere/Ap pDmgr70/de ploytool/i tp/batch2. jar:/opt/a pp/IBM/Web Sphere/App Dmgr70/jav a/lib/tool s.jar -Dibm.websphere.internalCl assAccessM ode=allow -Xms50m -Xmx256m -Dws.ext.dirs=/opt/app/IBM /WebSphere /AppDmgr70 /java/lib: /opt/app/I BM/WebSphe re/AppDmgr 70/profile s/AppDmgr0 1/classes: /opt/app/I BM/WebSphe re/AppDmgr 70/classes :/opt/app/ IBM/WebSph ere/AppDmg r70/lib:/o pt/app/IBM /WebSphere /AppDmgr70 /installed Channels:/ opt/app/IB M/WebSpher e/AppDmgr7 0/lib/ext: /opt/app/I BM/WebSphe re/AppDmgr 70/web/hel p:/opt/app /IBM/WebSp here/AppDm gr70/deplo ytool/itp/ plugins/co m.ibm.etoo ls.ejbdepl oy/runtime -Dderby.system.home=/opt/a pp/IBM/Web Sphere/App Dmgr70/der by -Dcom.ibm.itp.location=/op t/app/IBM/ WebSphere/ AppDmgr70/ bin -Djava.util.logging.config ureByServe r=true -Duser.install.root=/opt/a pp/IBM/Web Sphere/App Dmgr70/pro files/AppD mgr01 -Djavax.management.builder .initial=c om.ibm.ws. management .PlatformM BeanServer Builder -Dwas.install.root=/opt/ap p/IBM/WebS phere/AppD mgr70 -Dpython.cachedir=/opt/app /IBM/WebSp here/AppDm gr70/profi les/AppDmg r01/temp/c achedir -Djava.util.logging.manage r=com.ibm. ws.bootstr ap.WsLogMa nager -Dserver.root=/opt/app/IBM /WebSphere /AppDmgr70 /profiles/ AppDmgr01 -Dcom.ibm.security.jgss.de bug=off -Dcom.ibm.security.krb5.Kr b5Debug=of f -Djava.security.auth.login .config=/o pt/app/IBM /WebSphere /AppDmgr70 /profiles/ AppDmgr01/ properties /wsjaas.co nf -Djava.security.policy=/op t/app/IBM/ WebSphere/ AppDmgr70/ profiles/A ppDmgr01/p roperties/ server.pol icy com.ibm.wsspi.bootstrap.WS PreLaunche r -nosplash -application com.ibm.ws.bootstrap.WSLau ncher com.ibm.ws.runtime.WsServe r /opt/app/IBM/WebSphere/App Dmgr70/pro files/AppD mgr01/conf ig APPCell01 dmgr1Node01 dmgr
wasadmin 1802688 1 0 Sep 18 - 8:48 /opt/app/IBM/WebSphere/App
That is superb.
So, we can use this technique to verify that:
- A process of the specified process id is active (or not), and
- if it is active, that it is a WebSphere AppServer process!
One moment please... ;-) ok, it's going to take me more than "a moment", but let's see what we can do to make this happen...
So, we can use this technique to verify that:
- A process of the specified process id is active (or not), and
- if it is active, that it is a WebSphere AppServer process!
One moment please... ;-) ok, it's going to take me more than "a moment", but let's see what we can do to make this happen...
Q: What do you want displayed if a nodeagent is found to be inactive or unreachable?
ASKER
We need to check if any rough process running as node agent. If the process exists we need to kill it and start the node agent.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you really want to stop, and restart the cell, is there a particular reason for "waiting" until each AppServer is actually stopped?
This would really delay (and complicate) the process.
There is a much easier, and fast technique, which would be to:
- Identify, and locate each Application Server
- Invoke the "restart" method on the AppServer MBean
Please let me know what you need.
Thanks!