Solved

WebSphere Jython script to list node status

Posted on 2010-08-24
13
2,830 Views
Last Modified: 2013-12-11
I am trying to put together a jython script that will stop the nodes on the server, and then list the status of the server to verify it stopped.
Ideally, the script would attempt to stop, check the status, then IF they are stopped, continue, if they are not stopped, try and terminiate.

This is a small piece of a larger script which will do the following with all of the correct checks in place to ensure everything is being deployed correctly.
Stop nodes
Uninstall application
Save
Install application
Save
Wait for files to be built
Restart Node Agent
Ripple-Start the cluster
0
Comment
Question by:rwskas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
13 Comments
 
LVL 41

Accepted Solution

by:
HonorGod earned 250 total points
ID: 33516614
There are a couple of different ways to stop an AppServer:

- AdminControl.stopServer( serverName, nodeName );  # A couple of variations exists

- Get the MBean of the specific server, then;

  AdminControl.invoke( mbean, 'stop' );

The former "waits" for the AppServer to stop, but the latter doesn't.

However, the former writes message to the display (i.e., stdout), but the latter doesn't.

Which do you prefer?
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33517180
This book

Title: WebSphere Application Server Administration using Jython
 Pub: http://www.ibmpressbooks.com/bookstore/product.asp?isbn=0137009526

Includes some sample programs
- From the publisher website
  Click on the "Download" links
  Right click on the "Sample scripts" and "save as"

- Unzip the file, and locate "StopCell.py" in the Chapter 10

It uses technique #1 above.
If you want to see code for technique #2, let me know...
0
 
LVL 11

Assisted Solution

by:Radek Baranowski
Radek Baranowski earned 250 total points
ID: 33519138
what do you mean exactly ? you  say you want to stop 'nodes' when in reality you should stop servers on nodes (as HonorGod wrote) then do the app change, sync nodes and then bring servers up. in my opinion you should not try to restart nodeagents, as then you may compromise environment consistency. anyway, when working on DMgr side, you install apps to master config repository, and you need then send the thing out to nodes via nodeagents with appropriate wsadmin commands like:

nodeID = AdminConfig.getid('/Cell:xfinwas1Cell01/Node:XCRYPTO1PRENode01/')
print "Synchronizing node: " + nodeID
Sync1 = AdminControl.completeObjectName('type=NodeSync,node=XCRYPTO1Node01,*')
AdminControl.invoke(Sync1, 'sync')
0
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 
LVL 6

Author Comment

by:rwskas
ID: 33520863
Hmmm... I Suppose that would be why my script is not deploying correctly... I haven't had much time to test, but basically the files I would be expected to be built never show up.

So.. What is the CORRECT process to uninstall/reinstall an application?

@HonorGod
Thanks for the refrence! I have downloaded and will review the StopCell.py script in Chapter 9
0
 
LVL 11

Expert Comment

by:Radek Baranowski
ID: 33521062
in general - the process is simple and you do it as you try to (I suppose). the diference may come from environment you try to do it on.
on standalone server you install/uninstall (deploy) into servers config repository,and the server is the one you actually run application on.
in network deployment/cluster you install (deploy) application into master config repository on deployment manager, and through synchronization you deliver this runtime config change to the servers, that are actually running this application.
usually, dMgr is not used to run any business applications, just for management

as far as I know, all necessary files are either built during deployment, or - at latest - during server startup (in cluster)
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33521277
To add to what baranello stated.

We have 3 different scenarios:

1. A simple/single stand-alone AppServer
    Use the AdminApp.install() method
    http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.nd.doc/info/ae/ae/rxml_adminapp.html#rxml_adminapp__cmd7

2. A Federated (unclustered) AppServer = 1 AppServer managed & administered by/with a deployment manager
    Use the AdminApp.install() method

3. A Cluster - 1 or more AppServers managed & administered by/with a deployment manager
    Use the AdminApp.install() method
    Synchronize:
    http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/txml_sync.html
0
 
LVL 6

Author Comment

by:rwskas
ID: 33521395
So we have a few different clusters, across 4 different physical servers. Each cluster however, has its own 'version' of the build, as each cluster performs different/specfic actions.

Rigth now, we manually (through the websphere gui console) uninstall / install the application on each of the 4 physical servers. Each cluster is a single node, some have only one application server, while some have 4.

At what point do I need to use the sync commands?
0
 
LVL 11

Expert Comment

by:Radek Baranowski
ID: 33521472
after using AdminApp.install() in wsadmin on DMgr.
0
 
LVL 6

Author Comment

by:rwskas
ID: 33521496
before or after the Admin...save() ?
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33522164
The AdminConfig.save() will save the configuration information (i.e., the xml files).
That should be done first.
0
 
LVL 6

Author Comment

by:rwskas
ID: 33558634
Just to make sure I have this..
If I want to stop the application servers, and have the script WAIT for the server to actually stop, I would use
AdminControl.stopServer( serverName, nodeName )

Then I would uninstall the application
AdminApp.uninstall('myapp')

Then save
AdminConfig.save()

Then deploy the new app
AdminApp.install(....)

Then save
AdminConfig.save()

Then syncronize
AdminControl.invoke(Sync1, 'sync')

Does that sound correct to affectively reinstall an application?
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33563657
The save after uninstall is not required unless you aren't going to install something.

Other than that, yes.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33577553
Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Certificat to iSeries KeyStore 1 30
ejb example issues 3 88
Java basic valueOf question 1 50
Python sort list of tuples, skipping column 2 63
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question