Below script add destination to bus "ServiceBus"
=================================================================
import sys
for dest in ["ActionServiceBusQueue", "AuditServiceBusQueue", "EngineErrorServiceQueue", "DaemonErrorServiceBusQueue", "ActionErrorServiceBusQueue", "AuditErrorServiceBusQueue", "LGBusQueue"]:
print dest
AdminTask.createSIBDestination('[-bus ServiceBus -name ' + dest + ' -type Queue -reliability ASSURED_PERSISTENT -description ' + dest + ' -node LTSLUAT2AppNode1 -server LTSLUAT2AppServer1 ]')
AdminConfig.save()
# End for
Jython 2-D Array
=================================================================
from java.lang.reflect import Arrayimport javarows = 3cols = 3str2d = java.lang.reflect.Array.newInstance(java.lang.String,[rows, cols])str2d[0][0] = "python"str2d[1][0] = "jython"str2d[2][0] = "java"str2d[0][1] = "syntax "str2d[1][1] = "strength"str2d[2][1] = "libraries"str2d[0][2] = "unclutter"str2d[1][2] = "combine"str2d[2][2] = "graphics"print str2dprint "printing multidimensional array"for i in range(len(str2d)): for j in range(len(str2d[i])): print str2d[i][j]+"\t", printprint
Source -> Destination
==================================================================
import sys
for dest in ["DaemonQueue DaemonServiceBusQueue", "ActionQueue ActionServiceBusQueue", "AuditQueue AuditServiceBusQueue", "EngineErrorQueue EngineErrorServiceQueue", "DaemonErrorQueue DaemonErrorServiceBusQueue", "AuditErrorQueue AuditErrorServiceBusQueue", "ActionErrorQueue ActionErrorServiceBusQueue", "LG_Queue1 LGBusQueue"]:
print dest
entry=dest.split(' ')
s=entry[0]
d=entry[1]
print "========"
print s; print "->"; print d
Check Server Status
====================================================================
Usage: /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -profile serverStatus.py -c "serverStatus()"
serverStatus.py
import re;
def serverStatus() :
pat = re.compile(r'^(w+)(cells/(w+)/nodes/(w+)/servers/1.*)$');
info = [];
maxLen = [ 0 ] * 3;
servers = AdminConfig.list('Server').splitlines();
#print servers;
for server in servers :
#print server;
oName = AdminConfig.getObjectName(server);
#print oName;
if oName != '' :
status = 'running';
else :
status = 'stopped';
#print status
mObj = pat.match(server);
if mObj :
(sName, cName, nName) = mObj.groups();
info.append((sName, cName, nName, status));
for i in range(3) :
L = len(mObj.group(i + 1));
if L > maxLen[ i ] : maxLen[ i ] = L;
print '%(sName)s | %(cName)s | %(nName)s | %(status)s' % locals();
else:
print "no Matching."
print dest
entry=dest.split(' ')
s=entry[0]
d=entry[1]
print "========"
print s; print "->"; print d
Check Server Status
====================================================================
Usage: /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -profile serverStatus.py -c "serverStatus()"
serverStatus.py
import re;
def serverStatus() :
pat = re.compile(r'^(w+)(cells/(w+)/nodes/(w+)/servers/1.*)$');
info = [];
maxLen = [ 0 ] * 3;
servers = AdminConfig.list('Server').splitlines();
#print servers;
for server in servers :
#print server;
oName = AdminConfig.getObjectName(server);
#print oName;
if oName != '' :
status = 'running';
else :
status = 'stopped';
#print status
mObj = pat.match(server);
if mObj :
(sName, cName, nName) = mObj.groups();
info.append((sName, cName, nName, status));
for i in range(3) :
L = len(mObj.group(i + 1));
if L > maxLen[ i ] : maxLen[ i ] = L;
print '%(sName)s | %(cName)s | %(nName)s | %(status)s' % locals();
else:
print "no Matching."
No comments:
Post a Comment