sweety_745
asked on
wsadmin script
Hi all,
Could any body help me in the below request
1)	We are trying to Automate the Adapter Polling failure, For this we need to get a script to run the doing the following task’s using wsadmin.
Script 1
Run the wsadmin.sh
1)	AdminControl.queryNa mes("*:typ e=J2CMessa geEndpoint ,*")
Send the result of the above to a text file in readable format.
script 2
2)	Need to read Variable from text file
objectName = AdminControl.queryNames("* $NEEDToRea dFromInPut Text$,*")
AdminControl.invoke(object Name, 'getStatus')
If Status Result is 1 , go to next Value in the InputText
If the status Result is 2, run the below cmd:
AdminControl.invoke(object Name, 'resume')
AdminControl.invoke(object Name, 'getStatus')
If Status Result is 2 for second time, run the Script3
And continue to next value in the text file.
After Completion of all the values in the text, It will publish the result for each value in the input text file to a new outputText file with current System time in the name of the text file.
Script3
Where Script 3 will be recycling that app.
I can work on this script
InputTextFile
Values in the Text File will be as below might contain 50 values:
*:name=BPEContainer_qnode_ server1#bp econtainer .jar#Proce ssContaine rMDB_J2CMe ssageEndpo int*
*: name=HTM_PredefinedTasks_V 700_qnode_ server1App #HTM_Prede finedTasks _V700_qnod e_server1*
Thanks in advance
Could any body help me in the below request
1)	We are trying to Automate the Adapter Polling failure, For this we need to get a script to run the doing the following task’s using wsadmin.
Script 1
Run the wsadmin.sh
1)	AdminControl.queryNa
Send the result of the above to a text file in readable format.
script 2
2)	Need to read Variable from text file
objectName = AdminControl.queryNames("*
AdminControl.invoke(object
If Status Result is 1 , go to next Value in the InputText
If the status Result is 2, run the below cmd:
AdminControl.invoke(object
AdminControl.invoke(object
If Status Result is 2 for second time, run the Script3
And continue to next value in the text file.
After Completion of all the values in the text, It will publish the result for each value in the input text file to a new outputText file with current System time in the name of the text file.
Script3
Where Script 3 will be recycling that app.
I can work on this script
InputTextFile
Values in the Text File will be as below might contain 50 values:
*:name=BPEContainer_qnode_
*: name=HTM_PredefinedTasks_V
Thanks in advance
ASKER
1) We have more than 50 Services deployed and we are trying to get the "J2CMessageEndpoint" of all those applications. We are not using the whole MBean value returned by query names. we are using only the part which will be always constant. which is similar to below. This part of the name will always same even after recycle.
("*:name=FFAdapterTest3App #FFAdapter Test3FFAda pterExport #FFAdapter Test3_J2CM essageEndp oint,*")
2) When we run the cmd AdminControl.queryNames("* :type=J2CM essageEndp oint,*") it is giving the output. we want that output to be captured to a text file by separating them where we have "\r\n " in the result to new line, so that it will be easy to read those values
3) We want pass the values from a text file. So, the script will be running only to specific applications, not for all the services which are deployed. By reading from the text file, we can pre define what are the services; we need to run the script against.
Note: We are not use the text file from the script1 as it is. We capture the Script1 out put text file and edit it and give that text file as input to script 2.
4) We have around 50 applications which are using flat file adapter and intermittently it will stop pooling for some reason. SO we are trying to monitor those. Not the WPS ME's MBean. I just sent those as example earlier.
("*:name=FFAdapterTest3App
2) When we run the cmd AdminControl.queryNames("*
3) We want pass the values from a text file. So, the script will be running only to specific applications, not for all the services which are deployed. By reading from the text file, we can pre define what are the services; we need to run the script against.
Note: We are not use the text file from the script1 as it is. We capture the Script1 out put text file and edit it and give that text file as input to script 2.
4) We have around 50 applications which are using flat file adapter and intermittently it will stop pooling for some reason. SO we are trying to monitor those. Not the WPS ME's MBean. I just sent those as example earlier.
What is the output of the following script:
I'm interested in what kind of configuration type corresponds to the MessageEndpoint bean.
Thanks
wsadmin -lang jython -c "print AdminControl.getConfigId( AdminControl.queryNames('*:type=J2CMessageEndpoint,*').splitlines()[ 0 ] )"
I'm interested in what kind of configuration type corresponds to the MessageEndpoint bean.
Thanks
ASKER
When I run the exact script you mentioned, it is not returning me any value. But I captured the output of the below cmd’s and attaching it to thread
AdminControl.queryNames("* :type=J2CM essageEndp oint,*")
Check the “dev-J2CMessageEndpoint-Ou tPut.txt”
Print AdminApp.list()
Check the “dev-AdminAppList.txt”
dev-J2CMessageEndpoint-OutPut.txt
dev-AdminAppList.txt
AdminControl.queryNames("*
Check the “dev-J2CMessageEndpoint-Ou
Print AdminApp.list()
Check the “dev-AdminAppList.txt”
dev-J2CMessageEndpoint-OutPut.txt
dev-AdminAppList.txt
Each of the MBeans appear to have the following attribute names. I've included the values from the first MBean in the output.
Which of these values do you want saved in the file?
name = AutoProcessModApp#AutoProcessMod#AutoProcessMod_J2CMessageEndpoint
process = WPSDEV2.AppTarget.dev12-DEV02-Node01.0
ActivationSpec = sca/AutoProcessMod/ActivationSpec
platform = dynamicproxy
node = dev12-DEV02-Node01
J2EEApplication = AutoProcessModApp
j2eeType = JCAMessageEndpoint
J2EEServer = WPSDEV2.AppTarget.dev12-DEV02-Node01.0
Server = WPSDEV2.AppTarget.dev12-DEV02-Node01.0
version = 7.0.0.19
J2CResourceAdapter = Platform Messaging Component SPI Resource Adapter
type = J2CMessageEndpoint
mbeanIdentifier = cells/dev10-DEV02-cell01/clusters/WPSDEV2.AppTarget/resources.xml#J2CResourceAdapter_1271775552245#AutoProcessModApp#AutoProcessMod#AutoProcessMod_J2CMessageEndpoint
cell = dev10-DEV02-cell01
MessageDrivenBean = AutoProcessModApp#AutoProcessMod#AutoProcessMod
spec = 1.0
Which of these values do you want saved in the file?
ASKER
I would like to save below values.
name = AutoProcessModApp#AutoProc essMod#Aut oProcessMo d_J2CMessa geEndpoint
J2EEApplication = AutoProcessModApp
For Script2 I can use the value of “name” and for Script 3 I can use the value of “J2EEApplication” for recycling the App if Script 2 didn’t able to solve the stale
name = AutoProcessModApp#AutoProc
J2EEApplication = AutoProcessModApp
For Script2 I can use the value of “name” and for Script 3 I can use the value of “J2EEApplication” for recycling the App if Script 2 didn’t able to solve the stale
What command line parameters do you want / need to specify on script #1?
Option #1 - no parameters - simply redirect output of the script to a file:
Option #2 - no parameters - hard coded output file within script:
A simple example if which might be:
meBeans.py
Option #3 - required command line parameter = output filename:
Option #4 - required command line parameter = input config/property file identifying output filename:
Option #1 - no parameters - simply redirect output of the script to a file:
wsadmin -lang jython -f myBeans.py >myOutputFile.txt
Option #2 - no parameters - hard coded output file within script:
wsadmin -lang jython -f myBeans.py
A simple example if which might be:
meBeans.py
fileName = 'meBeans.txt'
attributes = 'name,J2EEApplication'.split( ',' )
if __name__ in [ '__main__', 'main' ] :
fh = open( fileName, 'w' )
for me in AdminControl.queryNames("*:type=J2CMessageEndpoint,*").splitlines() :
bean = {}
for attr in attributes :
bean[ attr ] = AdminControl.getAttribute( me, attr )
fh.write( `bean` )
fh.close()
else :
print '\nError: script must be executed, not imported.\n'
print 'Usage: wsadmin -f %s' % __name__
Option #3 - required command line parameter = output filename:
wsadmin -lang jython -f myBeans.py myOutputFile.txt
Option #4 - required command line parameter = input config/property file identifying output filename:
wsadmin -lang jython -f myBeans.py myInputFile.ini
ASKER
I tried the below:
./wsadmin.sh -lang jython -f myBeans.py >myOutputFile.txt
But this is what I see in the outputfile
WASX7209I: Connected to process "dmgr" on node dev10-DEV02-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7017E: Exception received while running file "myBeans.py"; exception information: javax.management.Attribute NotFoundEx ception: getAttribute failed: ModelMBeanAttributeInfo not found for name
./wsadmin.sh -lang jython -f myBeans.py >myOutputFile.txt
But this is what I see in the outputfile
WASX7209I: Connected to process "dmgr" on node dev10-DEV02-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7017E: Exception received while running file "myBeans.py"; exception information: javax.management.Attribute
The script I provided had the output file hard coded.
That's why it was under the part labelled "Option #2 - no parameters - hard coded output file within script"
AttributeNotFoundException - interesting.
If you use an interactive wsadmin session, i.e.,
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
wsadmin -lang jython
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
bean = AdminControl.queryNames("* :type=J2CM essageEndp oint,*").s plitlines( )[ 0 ]
print 'name:', AdminControl.getAttribute( bean, 'name' )
print 'J2EE:', AdminControl.getAttribute( bean, 'J2EEApplication' )
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Do you get the same Exception on the second print statement?
That's why it was under the part labelled "Option #2 - no parameters - hard coded output file within script"
AttributeNotFoundException
If you use an interactive wsadmin session, i.e.,
--------------------------
wsadmin -lang jython
--------------------------
bean = AdminControl.queryNames("*
print 'name:', AdminControl.getAttribute(
print 'J2EE:', AdminControl.getAttribute(
--------------------------
Do you get the same Exception on the second print statement?
ASKER
This is what i got:
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7031I: For help, enter: "print Help.help()"
wsadmin>bean = AdminControl.queryNames("* :type=J2CM essageEndp oint,*").s plitlines( )[ 0 ]
wsadmin>bean
'WebSphere:name=ARINT6_BbS ap_PrMedAp p#ARINT6_B bSap_PrMed #ARINT6_Bb Sap_PrMed_ J2CMessage Endpoint,p rocess=DEV 0_GOLD.App Target.dev 11-Node01. 0,Activati onSpec=sca /ARINT6_Bb Sap_PrMed/ Activation Spec,platf orm=dynami cproxy,nod e=dev11-No de01,J2EEA pplication =ARINT6_Bb Sap_PrMedA pp,j2eeTyp e=JCAMessa geEndpoint ,J2EEServe r=DEV0_GOL D.AppTarge t.dev11-No de01.0,Ser ver=DEV0_G OLD.AppTar get.dev11- Node01.0,v ersion=7.0 .0.19,J2CR esourceAda pter=Platf orm Messaging Component SPI Resource Adapter,type=J2CMessageEnd point,mbea nIdentifie r=cells/de v10-DEV-ce ll01/clust ers/DEV0_G OLD.AppTar get/resour ces.xml#J2 CResourceA dapter_129 6743291683 #ARINT6_Bb Sap_PrMedA pp#ARINT6_ BbSap_PrMe d#ARINT6_B bSap_PrMed _J2CMessag eEndpoint, cell=dev10 -DEV-cell0 1,MessageD rivenBean= ARINT6_BbS ap_PrMedAp p#ARINT6_B bSap_PrMed #ARINT6_Bb Sap_PrMed, spec=1.0'
wsadmin>print 'name:', AdminControl.getAttribute( bean, 'name' )
name:WASX7015E: Exception running command: "'name:', AdminControl.getAttribute( bean, 'name' )"; exception information:
javax.management.Attribute NotFoundEx ception: getAttribute failed: ModelMBeanAttributeInfo not found for name
wsadmin>print 'J2EE:', AdminControl.getAttribute( bean, 'J2EEApplication' )
J2EE:WASX7015E: Exception running command: "'J2EE:', AdminControl.getAttribute( bean, 'J2EEApplication' )"; exception information:
javax.management.Attribute NotFoundEx ception: getAttribute failed: ModelMBeanAttributeInfo not found for J2EEApplication
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7031I: For help, enter: "print Help.help()"
wsadmin>bean = AdminControl.queryNames("*
wsadmin>bean
'WebSphere:name=ARINT6_BbS
wsadmin>print 'name:', AdminControl.getAttribute(
name:WASX7015E: Exception running command: "'name:', AdminControl.getAttribute(
javax.management.Attribute
wsadmin>print 'J2EE:', AdminControl.getAttribute(
J2EE:WASX7015E: Exception running command: "'J2EE:', AdminControl.getAttribute(
javax.management.Attribute
ASKER
i think this it the correct error we are getting:
wsadmin>objectName = AdminControl.queryNames("* :type=J2CM essageEndp oint,*").s plitlines( )
wsadmin>print 'name:', AdminControl.getAttribute( objectName, 'name' )
name:WASX7015E: Exception running command: "'name:', AdminControl.getAttribute( objectName, 'name' )"; exception information:
com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<input>", line 1, in ?
TypeError: getAttribute(): 1st arg can't be coerced to String
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>print 'name:', AdminControl.getAttribute(
name:WASX7015E: Exception running command: "'name:', AdminControl.getAttribute(
com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<input>", line 1, in ?
TypeError: getAttribute(): 1st arg can't be coerced to String
The second is wrong because AdminControl.queryNames("* :type=J2CM essageEndp oint,*").s plitlines( ) returns a list of strings.
That's why the 1st has [ 0 ] at the end, to obtain the 1st list element.
Let me work on this and get back to you.
That's why the 1st has [ 0 ] at the end, to obtain the 1st list element.
Let me work on this and get back to you.
ASKER
Hi HonorGod,
Did you got chance to look into the script i need help with ?
Did you got chance to look into the script i need help with ?
Try this:
fileName = 'meBeans.txt'
attributes = 'name,J2EEApplication'
#-------------------------------------------------------------------------------
# Name: MBnameAsDict
# Role: Return a dictionary of name/value portions of an MBean name
# Note: Exception handler requires sys module
#-------------------------------------------------------------------------------
def MBnameAsDict( beanName ) :
'MBnameAsDict( beanName ) - Return a dictionary of the beans name/value parts.'
funName = 'MBnameAsDict' # Name of this function
domain = 'WebSphere:' # MBean name prefix
result = {} # Result is a dictionary
#---------------------------------------------------------------------------
# Error message for unexpected exceptions
#---------------------------------------------------------------------------
ERRMSG = '%(funName)s: Unexpected exception.\n'
ERRMSG += ' Exception type: %(Type)s\n'
ERRMSG += ' Exception value: %(value)s'
#---------------------------------------------------------------------------
# Warning message for "bad" MBean names
#---------------------------------------------------------------------------
WARNING = '%(funName)s:\n'
WARNING += "Warning: Specified MBean name doesn't start with "
WARNING += '"%(domain)s" and is ignored.\n MBean name: "%(beanName)s"'
try :
#-----------------------------------------------------------------------
# Verify that we are working with a WebSphere MBean
#-----------------------------------------------------------------------
if beanName.startswith( domain ) :
#-------------------------------------------------------------------
# The rest of MBean name only has comma separated name=value pairs
#-------------------------------------------------------------------
for field in beanName[ len( domain ): ].split( ',' ) :
name, value = field.split( '=', 1 )
result[ name ] = value
else :
print WARNING % locals()
except :
Type, value = sys.exc_info()[ :2 ]
print ERRMSG % locals()
return result
#-------------------------------------------------------------------------------
# Name: anonymous
# Role: This where script execution appears to begin
#-------------------------------------------------------------------------------
if __name__ in [ '__main__', 'main' ] :
attr = [ a.strip() for a in attributes.split( ',' ) ]
fh = open( fileName, 'w' )
for me in AdminControl.queryNames("*:type=J2CMessageEndpoint,*").splitlines() :
ok, result, d = 1, {}, MBnameAsDict( me )
for a in attr :
if d.has_key( a ) :
result[ a ] = d[ a ]
else :
ok = 0
print 'Required attribute "%s" missing from bean: %s' % ( a, me )
if ok :
fh.write( `result` )
fh.close()
else :
print '\nError: script must be executed, not imported.\n'
print 'Usage: wsadmin -f %s' % __name__
ASKER
Hi HonorGod,
Wow... Script1 looks good, getting the expected result.
PFA of meBean.txt
is it possible for getting it more user-friendly ?
For the Script 2 and Script3
PFA for the input file.
for Script 2, we will get the name from the input file.
try for 3 times to updating the status.
if it fails for 3 times,
Script 3 will restart that particular app and send and email or save the result to the file for verifying the list of the app's it restarted for the week, using the script.
Thanks
meBeans.txt
Script2-Input.txt
Wow... Script1 looks good, getting the expected result.
PFA of meBean.txt
is it possible for getting it more user-friendly ?
For the Script 2 and Script3
PFA for the input file.
for Script 2, we will get the name from the input file.
try for 3 times to updating the status.
if it fails for 3 times,
Script 3 will restart that particular app and send and email or save the result to the file for verifying the list of the app's it restarted for the week, using the script.
Thanks
meBeans.txt
Script2-Input.txt
What does PFA mean?
The output format for the file is whatever you want it to be.
What would you prefer?
The output format for the file is whatever you want it to be.
What would you prefer?
ASKER
Sorry, I mean Please Find Attachment (PFA).
Can you help me with Script 2 and Script 3.
I would prefer output of script 1 needs to be easy for reading and which we can directly use it for input of script 2 and script 3,
just by manually removing the WPS system services from the output text of the Script1 and pass it to other scripts
Can you help me with Script 2 and Script 3.
I would prefer output of script 1 needs to be easy for reading and which we can directly use it for input of script 2 and script 3,
just by manually removing the WPS system services from the output text of the Script1 and pass it to other scripts
Ah, now I understand. Thanks for the clarification. PFA was not an acronym with which I was familiar.
One reason that the file is hard to read is that there is supposed to be a newline between the }{ characters, so each line should have looked something like this:
{'name': 'BPCECollector_qnode_serve r1#collect or.jar#Eve ntConsumer _J2CMessag eEndpoint' , 'J2EEApplication': 'BPCECollector_qnode_serve r1'}
Is that better, or would you prefer each line to look this this?
name=BPCECollector_qnode_s erver1#col lector.jar #EventCons umer_J2CMe ssageEndpo int,J2EEAp plication= BPCECollec tor_qnode_ server1
Next question:
- using that 2nd format, what do you get if you look for the MBean using this code?
bName = 'name=BPCECollector_qnode_ server1#co llector.ja r#EventCon sumer_J2CM essageEndp oint,J2EEA pplication =BPCEColle ctor_qnode _server1'
bean = AdminControl.queryNames( bName + ',*' )
Does the "bean" variable contain an MBean object name, or is it an empty string?
The reason I'm asking is that I'm not 100% certain that the queryNames() call will actually find the bean in question given those values (i.e., name and J2EEApplication).
Does that make sense?
One reason that the file is hard to read is that there is supposed to be a newline between the }{ characters, so each line should have looked something like this:
{'name': 'BPCECollector_qnode_serve
Is that better, or would you prefer each line to look this this?
name=BPCECollector_qnode_s
Next question:
- using that 2nd format, what do you get if you look for the MBean using this code?
bName = 'name=BPCECollector_qnode_
bean = AdminControl.queryNames( bName + ',*' )
Does the "bean" variable contain an MBean object name, or is it an empty string?
The reason I'm asking is that I'm not 100% certain that the queryNames() call will actually find the bean in question given those values (i.e., name and J2EEApplication).
Does that make sense?
ASKER
Please check the below and let me know, if didn't answer your question:
wsadmin>AdminControl.query Names('*:t ype=J2CMes sageEndpoi nt,*').spl itlines()[ 0 ]
'WebSphere:name=BPCECollec tor_qnode_ server1#co llector.ja r#EventCon sumer_J2CM essageEndp oint,proce ss=server1 ,Activatio nSpec=eis/ BPCCEICons umerActiva tion
Spec,platform=dynamicproxy ,node=qnod e,J2EEAppl ication=BP CECollecto r_qnode_se rver1,j2ee Type=JCAMe ssageEndpo int,J2EESe rver=serve r1,Server= server1,ve rsio
n=7.0.0.21,J2CResourceAdap ter=SIB JMS Resource Adapter,type=J2CMessageEnd point,mbea nIdentifie r=cells/qc ell/nodes/ qnode/serv ers/server 1/resource s.xml#J
2CResourceAdapter_12660476 68543#BPCE Collector_ qnode_serv er1#collec tor.jar#Ev entConsume r_J2CMessa geEndpoint ,cell=qcel l,MessageD rivenBean= BPCECollec tor_
qnode_server1#collector.ja r#EventCon sumer,spec =1.0'
wsadmin>objectName=AdminCo ntrol.quer yNames("*: name=BPCEC ollector_q node_serve r1#collect or.jar#Eve ntConsumer _J2CMessag eEndpoint, *")
wsadmin>print objectName
WebSphere:name=BPCECollect or_qnode_s erver1#col lector.jar #EventCons umer_J2CMe ssageEndpo int,proces s=server1, Activation Spec=eis/B PCCEIConsu merActivat ionS
pec,platform=dynamicproxy, node=qnode ,J2EEAppli cation=BPC ECollector _qnode_ser ver1,j2eeT ype=JCAMes sageEndpoi nt,J2EESer ver=server 1,Server=s erver1,ver sion
=7.0.0.21,J2CResourceAdapt er=SIB JMS Resource Adapter,type=J2CMessageEnd point,mbea nIdentifie r=cells/qc ell/nodes/ qnode/serv ers/server 1/resource s.xml#J2
CResourceAdapter_126604766 8543#BPCEC ollector_q node_serve r1#collect or.jar#Eve ntConsumer _J2CMessag eEndpoint, cell=qcell ,MessageDr ivenBean=B PCECollect or_q
node_server1#collector.jar #EventCons umer,spec= 1.0
When the object was working as expected, it will give the below result
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>AdminControl.invok e(objectNa me, 'pause')
''
When the oject was not working as expected it will give the result as below
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'2'
If the result is 2, we need to run the below cmd:
wsadmin>AdminControl.invok e(objectNa me, 'resume')
''
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>
wsadmin>AdminControl.query
'WebSphere:name=BPCECollec
Spec,platform=dynamicproxy
n=7.0.0.21,J2CResourceAdap
2CResourceAdapter_12660476
qnode_server1#collector.ja
wsadmin>objectName=AdminCo
wsadmin>print objectName
WebSphere:name=BPCECollect
pec,platform=dynamicproxy,
=7.0.0.21,J2CResourceAdapt
CResourceAdapter_126604766
node_server1#collector.jar
When the object was working as expected, it will give the below result
wsadmin>AdminControl.invok
'1'
wsadmin>AdminControl.invok
''
When the oject was not working as expected it will give the result as below
wsadmin>AdminControl.invok
'2'
If the result is 2, we need to run the below cmd:
wsadmin>AdminControl.invok
''
wsadmin>AdminControl.invok
'1'
wsadmin>
That helps.
Your sample shows that if we have the output of script 1 be of the form:
name=<something>,J2EEAppli cation=<so mething>
or even
name=<something>,J2EEAppli cation=<so mething>,*
then script #2 could read this file, and use it to determine if the specified object instances exist.
If this would be acceptable for you, then try this as a possible solution for scrpt #1
And let me know if it suits your needs
Your sample shows that if we have the output of script 1 be of the form:
name=<something>,J2EEAppli
or even
name=<something>,J2EEAppli
then script #2 could read this file, and use it to determine if the specified object instances exist.
If this would be acceptable for you, then try this as a possible solution for scrpt #1
fileName = 'meBeans.txt'
attributes = 'name,J2EEApplication'
#-------------------------------------------------------------------------------
# Name: MBnameAsDict
# Role: Return a dictionary of name/value portions of an MBean name
# Note: Exception handler requires sys module
#-------------------------------------------------------------------------------
def MBnameAsDict( beanName ) :
'MBnameAsDict( beanName ) - Return a dictionary of the beans name/value parts.'
funName = 'MBnameAsDict' # Name of this function
domain = 'WebSphere:' # MBean name prefix
result = {} # Result is a dictionary
#---------------------------------------------------------------------------
# Error message for unexpected exceptions
#---------------------------------------------------------------------------
ERRMSG = '%(funName)s: Unexpected exception.\n'
ERRMSG += ' Exception type: %(Type)s\n'
ERRMSG += ' Exception value: %(value)s'
#---------------------------------------------------------------------------
# Warning message for "bad" MBean names
#---------------------------------------------------------------------------
WARNING = '%(funName)s:\n'
WARNING += "Warning: Specified MBean name doesn't start with "
WARNING += '"%(domain)s" and is ignored.\n MBean name: "%(beanName)s"'
try :
#-----------------------------------------------------------------------
# Verify that we are working with a WebSphere MBean
#-----------------------------------------------------------------------
if beanName.startswith( domain ) :
#-------------------------------------------------------------------
# The rest of MBean name only has comma separated name=value pairs
#-------------------------------------------------------------------
for field in beanName[ len( domain ): ].split( ',' ) :
name, value = field.split( '=', 1 )
result[ name ] = value
else :
print WARNING % locals()
except :
Type, value = sys.exc_info()[ :2 ]
print ERRMSG % locals()
return result
#-------------------------------------------------------------------------------
# Name: anonymous
# Role: This where script execution appears to begin
#-------------------------------------------------------------------------------
if __name__ in [ '__main__', 'main' ] :
attr = [ a.strip() for a in attributes.split( ',' ) ]
fh = open( fileName, 'w' )
for me in AdminControl.queryNames("*:type=J2CMessageEndpoint,*").splitlines() :
ok, result, d = 1, {}, MBnameAsDict( me )
for a in attr :
if d.has_key( a ) :
result[ a ] = d[ a ]
else :
ok = 0
print 'Required attribute "%s" missing from bean: %s' % ( a, me )
if ok :
fh.write( 'name=%(name)s,J2EEApplication=%(J2EEApplication)s,*\n' % result )
fh.close()
else :
print '\nError: script must be executed, not imported.\n'
print 'Usage: wsadmin -f %s' % __name__
And let me know if it suits your needs
ASKER
Yes..this the one what i am looking for as script1 Output. please find the attachment of the output I got. Can we use this as input for script 2 and 3 or we can club both Script 2 and 3 into same script.
OutPut2.txt
OutPut2.txt
Q: Can we use this as input to script # 2 (and if needed #3)?
A: Sure.
Based upon the J2CMessageEndpoint MBean documentation, these are the possible responses to the getStatus() method call:
1 = Active
2 = Inactive
3 = Stopped
So, your next question is:
Q: Can we use this MBean information to determine if the MBean exists,
if it does invoke getStatus(), and if the result is 2 (i.e., Inactive), invoke the "resume" method call to try and restart it.
A: Sure... working on this now.
The problem with your description of script #3 is that no information exists that be used to "recycle the app".
Q: What do you want done if the status == 3 (i.e., stopped)?
A: Sure.
Based upon the J2CMessageEndpoint MBean documentation, these are the possible responses to the getStatus() method call:
1 = Active
2 = Inactive
3 = Stopped
So, your next question is:
Q: Can we use this MBean information to determine if the MBean exists,
if it does invoke getStatus(), and if the result is 2 (i.e., Inactive), invoke the "resume" method call to try and restart it.
A: Sure... working on this now.
The problem with your description of script #3 is that no information exists that be used to "recycle the app".
Q: What do you want done if the status == 3 (i.e., stopped)?
Try this for script #2
meResume.py
meResume.py
ASKER
Hi HonorGod,
Amazing....! Looks like script is working as expected after changing the below value:
if argc != 1 :
to
if argc < 2 :
I need to do some more testing and i will get back to you tomorrow.
here are the steps i did for testing:
D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\pr ofiles\qwp s\bin>wsad min.bat -lang jython -f meResume.py OutPut2.txt
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[OutPut
2.txt]"
Processing: OutPut2.txt
Resource active: name=BPCECollector_qnode_s erver1#col lector.jar #EventCons umer_J2CMe ssageEndpo int,J2EEAp plication= BPCECollec tor_qnode_ server1,*
Resource active: name=BPCECollector_qnode_s erver1#col lector.jar #EventTran sformer_J2 CMessageEn dpoint,J2E EApplicati on=BPCECol lector_qno de_server1 ,*
Resource active: name=BPEContainer_qnode_se rver1#b.ja r#ServiceS IBusMessag eBean_J2CM essageEndp oint,J2EEA pplication =BPEContai ner_qnode_ server1,*
Resource active: name=BPEContainer_qnode_se rver1#b.ja r#_export. com.ibm.bp e.api.sca. BFMJMSJMS_ J2CMessage Endpoint,J 2EEApplica tion=BPECo ntainer_qn ode_ser
ver1,*
Resource active: name=BPEContainer_qnode_se rver1#bpec ontainer.j ar#Process ContainerM DB_J2CMess ageEndpoin t,J2EEAppl ication=BP EContainer _qnode_ser ver1,*
Resource active: name=EventService#EventSer verMdb.jar #EventBusM dbBean_J2C MessageEnd point,J2EE Applicatio n=EventSer vice,*
Resource active: name=TaskContainer_qnode_s erver1#tas kejb.jar#H TMSchedule r_J2CMessa geEndpoint ,J2EEAppli cation=Tas kContainer _qnode_ser ver1,*
Resource active: name=wpsFEMgr_7.0.0#wpsFEM grEJB.jar# RecoveryMe ssageDrive nBean_J2CM essageEndp oint,J2EEA pplication =wpsFEMgr_ 7.0.0,*
D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\pr ofiles\qwp s\bin>wsad min -lang jython
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
wsadmin>objectName = AdminControl.queryNames("* :name=Even tService#E ventServer Mdb.jar#Ev entBusMdbB ean_J2CMes sageEndpoi nt,*")
wsadmin>AdminControl.invok e(objectNa me, 'pause')
''
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'2'
wsadmin>exit
D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\pr ofiles\qwp s\bin>wsad min.bat -lang jython -f meResume.py OutPut2.txt
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7487E: Failed to import script libraries modules: D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\sc riptLibrar ies\perfTu ning\V70\a pplyPerfTu ningTempl
ate.py; Examine the wsadmin log file to determine the problem.
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[OutPut
2.txt]"
Processing: OutPut2.txt
Resource active: name=BPCECollector_qnode_s erver1#col lector.jar #EventCons umer_J2CMe ssageEndpo int,J2EEAp plication= BPCECollec tor_qnode_ server1,*
Resource active: name=BPCECollector_qnode_s erver1#col lector.jar #EventTran sformer_J2 CMessageEn dpoint,J2E EApplicati on=BPCECol lector_qno de_server1 ,*
Resource active: name=BPEContainer_qnode_se rver1#b.ja r#ServiceS IBusMessag eBean_J2CM essageEndp oint,J2EEA pplication =BPEContai ner_qnode_ server1,*
Resource active: name=BPEContainer_qnode_se rver1#b.ja r#_export. com.ibm.bp e.api.sca. BFMJMSJMS_ J2CMessage Endpoint,J 2EEApplica tion=BPECo ntainer_qn ode_ser
ver1,*
Resource active: name=BPEContainer_qnode_se rver1#bpec ontainer.j ar#Process ContainerM DB_J2CMess ageEndpoin t,J2EEAppl ication=BP EContainer _qnode_ser ver1,*
Resource restarted successfully: name=EventService#EventSer verMdb.jar #EventBusM dbBean_J2C MessageEnd point,J2EE Applicatio n=EventSer vice,*
Resource active: name=TaskContainer_qnode_s erver1#h.j ar#Service SIBusMessa geBean_J2C MessageEnd point,J2EE Applicatio n=TaskCont ainer_qnod e_server1, *
Resource active: name=TaskContainer_qnode_s erver1#tas kejb.jar#H TMSchedule r_J2CMessa geEndpoint ,J2EEAppli cation=Tas kContainer _qnode_ser ver1,*
Resource active: name=wpsFEMgr_7.0.0#wpsFEM grEJB.jar# RecoveryMe ssageDrive nBean_J2CM essageEndp oint,J2EEA pplication =wpsFEMgr_ 7.0.0,*
D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\pr ofiles\qwp s\bin>wsad min -lang jython
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7487E: Failed to import script libraries modules: D:\Program Files\IBM\WID7_WTE\runtime s\bi_v7\sc riptLibrar ies\perfTu ning\V70\a pplyPerfTu ningTempl
ate.py; Examine the wsadmin log file to determine the problem.
WASX7411W: Ignoring the following provided option: [?lang, jython]
WASX7031I: For help, enter: "print Help.help()"
wsadmin>objectName = AdminControl.queryNames("* :name=Even tService#E ventServer Mdb.jar#Ev entBusMdbB ean_J2CMes sageEndpoi nt,*")
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>
Amazing....! Looks like script is working as expected after changing the below value:
if argc != 1 :
to
if argc < 2 :
I need to do some more testing and i will get back to you tomorrow.
here are the steps i did for testing:
D:\Program Files\IBM\WID7_WTE\runtime
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[OutPut
2.txt]"
Processing: OutPut2.txt
Resource active: name=BPCECollector_qnode_s
Resource active: name=BPCECollector_qnode_s
Resource active: name=BPEContainer_qnode_se
Resource active: name=BPEContainer_qnode_se
ver1,*
Resource active: name=BPEContainer_qnode_se
Resource active: name=EventService#EventSer
Resource active: name=TaskContainer_qnode_s
Resource active: name=wpsFEMgr_7.0.0#wpsFEM
D:\Program Files\IBM\WID7_WTE\runtime
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
''
wsadmin>AdminControl.invok
'2'
wsadmin>exit
D:\Program Files\IBM\WID7_WTE\runtime
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7487E: Failed to import script libraries modules: D:\Program Files\IBM\WID7_WTE\runtime
ate.py; Examine the wsadmin log file to determine the problem.
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[OutPut
2.txt]"
Processing: OutPut2.txt
Resource active: name=BPCECollector_qnode_s
Resource active: name=BPCECollector_qnode_s
Resource active: name=BPEContainer_qnode_se
Resource active: name=BPEContainer_qnode_se
ver1,*
Resource active: name=BPEContainer_qnode_se
Resource restarted successfully: name=EventService#EventSer
Resource active: name=TaskContainer_qnode_s
Resource active: name=TaskContainer_qnode_s
Resource active: name=wpsFEMgr_7.0.0#wpsFEM
D:\Program Files\IBM\WID7_WTE\runtime
WASX7209I: Connected to process "server1" on node qnode using SOAP connector; The type of process is: UnManagedProcess
WASX7487E: Failed to import script libraries modules: D:\Program Files\IBM\WID7_WTE\runtime
ate.py; Examine the wsadmin log file to determine the problem.
WASX7411W: Ignoring the following provided option: [?lang, jython]
WASX7031I: For help, enter: "print Help.help()"
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
'1'
wsadmin>
sounds good... Let me know how it goes. Thanks for your understanding.
ASKER
Behavior is different for stand Alone and Clustered environment.
We need to use more variables to be captured in the Script1 Output and pass it to Script 2.
Attached is the output of the Script1 on the cluster environment. : OutPut-MBeans.txt
Since the Service is running on 2 cluster member Environment, We need to capture the “J2EEServer” value and pass that one to the Script2
And for the Script2, At any point in the cluster environment. Status of the polling is active only on 1 Cluster member. Which gives the result as 1 and for the rest of the Cluster member’s it will be 2 or 3. So the condition we need to check will be, Are we getting the status as 1 on any of the cluster members. If it is not, We need to activate that on only 1 cluster member and should not change the status on the other cluster members.
Here are the output of few cmd’s ran against the Clustered environment.
wsadmin>objectName = AdminControl.queryNames("* :name=ASDINT89_SapPs_OrdMed App#SDINT8 9_SapPs_Or dMedcom/bf usa/wps/ot c/sca/Flat FileExport #SDINT89_S apPs_OrdMe d_J2CMessa geEndpoint ,*")
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
WASX7015E: Exception running command: "AdminControl.invoke(objec tName, 'getStatus')"; exception information:
com.ibm.ws.scripting.Scrip tingExcept ion: WASX7025E: Error found in String
wsadmin>objectName = AdminControl.queryNames("* :name=ASDI NT89_SapPs _OrdMedApp #SDINT89_S apPs_OrdMe dcom/bfusa /wps/otc/s ca/FlatFil eExport#SD INT89_SapP s_OrdMed_J 2CMessageE n dpoint,J2EEApplication=ASD INT89_SapP s_OrdMedAp p,J2EEServer=DEV0_GOLD.AppTa rget.dev11 -Node01.0,*")
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'2'
wsadmin>objectName = AdminControl.queryNames("* :name=ASDI NT89_SapPs _OrdMedApp #SDINT89_S apPs_OrdMe dcom/bfusa /wps/otc/s ca/FlatFil eExport#SD INT89_SapP s_OrdMed_J 2CMessageE n dpoint,J2EEApplication=ASD INT89_SapP s_OrdMedAp p,J2EEServer=DEV0_GOLD.AppTa rget.dev12 -Node01.0,*")
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
OutPut-MBeans-Dev0.txt
We need to use more variables to be captured in the Script1 Output and pass it to Script 2.
Attached is the output of the Script1 on the cluster environment. : OutPut-MBeans.txt
Since the Service is running on 2 cluster member Environment, We need to capture the “J2EEServer” value and pass that one to the Script2
And for the Script2, At any point in the cluster environment. Status of the polling is active only on 1 Cluster member. Which gives the result as 1 and for the rest of the Cluster member’s it will be 2 or 3. So the condition we need to check will be, Are we getting the status as 1 on any of the cluster members. If it is not, We need to activate that on only 1 cluster member and should not change the status on the other cluster members.
Here are the output of few cmd’s ran against the Clustered environment.
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
WASX7015E: Exception running command: "AdminControl.invoke(objec
com.ibm.ws.scripting.Scrip
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
'2'
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
'1'
OutPut-MBeans-Dev0.txt
> Behavior is different for stand Alone and Clustered environment.
That's not terribly surprising. ;-)
> We need to capture the “J2EEServer” value and pass that one to the Script2
See if meBeans.py matches your needs & expectations
meBeans.py
> Because script #2 (i.e., meResumepy) uses the output of meBeans.py directly, no change is required to use the revised output (except for the correction you noted above).
> At any point in the cluster environment. Status of the polling is active only on 1 Cluster member.
Won't adding the J2EEServer qualifier resolve this?
That's not terribly surprising. ;-)
> We need to capture the “J2EEServer” value and pass that one to the Script2
See if meBeans.py matches your needs & expectations
meBeans.py
> Because script #2 (i.e., meResumepy) uses the output of meBeans.py directly, no change is required to use the revised output (except for the correction you noted above).
> At any point in the cluster environment. Status of the polling is active only on 1 Cluster member.
Won't adding the J2EEServer qualifier resolve this?
ASKER
Hi,
Script 1 output is just the way wanted on Cluster environment. Attachment “OutPutOf-meBeans.txt”
For the Script2, if we pass the same output, Our Current script will try to enable the polling of the Application’s on all the Cluster Members, which is not correct. At any point of time, Polling should be enabled only on 1 cluster member.
So the script needs to check the status on all the ClusterMember and if we don’t have the result as 1 on any of those cluster member, then the script need to run the ‘resume’ on any one of the Cluster Member.
HonorGod, that is my plan of approach in the script. You are more than welcome, if you have some suggestions as, I am not able to think of any other approach.
-Ramesh
OutPutOf-meBeans.txt
Script 1 output is just the way wanted on Cluster environment. Attachment “OutPutOf-meBeans.txt”
For the Script2, if we pass the same output, Our Current script will try to enable the polling of the Application’s on all the Cluster Members, which is not correct. At any point of time, Polling should be enabled only on 1 cluster member.
So the script needs to check the status on all the ClusterMember and if we don’t have the result as 1 on any of those cluster member, then the script need to run the ‘resume’ on any one of the Cluster Member.
HonorGod, that is my plan of approach in the script. You are more than welcome, if you have some suggestions as, I am not able to think of any other approach.
-Ramesh
OutPutOf-meBeans.txt
> Our Current script will try to enable the polling of the Application’s on all the Cluster Members, which is not correct.
Ah, it was not clear, from your previous update, if you were using the High Availability configuration or the scalable one.
> So the script needs to check the status on all the ClusterMember and if we don’t have the result as 1 on any of those cluster member, then the script need to run the ‘resume’ on any one of the Cluster Member.
ok, I'm going to have to try to figure out how to do this.
Can you find out if the ME names for the servers in a cluster include the cluster name?
Thanks
Ah, it was not clear, from your previous update, if you were using the High Availability configuration or the scalable one.
> So the script needs to check the status on all the ClusterMember and if we don’t have the result as 1 on any of those cluster member, then the script need to run the ‘resume’ on any one of the Cluster Member.
ok, I'm going to have to try to figure out how to do this.
Can you find out if the ME names for the servers in a cluster include the cluster name?
Thanks
ASKER
This is how our Naming for one envi, but it changes for each environment
-> Ah, it was not clear, from your previous update, if you were using the High Availability configuration or the scalable one.
While our input is something similar as below, Dont the script try to enable the polling on both the servers ?
name=AutoProcessModApp#Aut oProcessMo d#AutoProc essMod_J2C MessageEnd point,J2EE Applicatio n=AutoProc essModApp, J2EEServer =DEV0_GOLD .AppTarget .dev11-Nod e01.0*
name=AutoProcessModApp#Aut oProcessMo d#AutoProc essMod_J2C MessageEnd point,J2EE Applicatio n=AutoProc essModApp, J2EEServer =DEV0_GOLD .AppTarget .dev12-Nod e01.0*
as I said earlier, you are more than welcome to suggest your views about how to approach for the script 2.
Thanks
ServeName Node Cluster Name
rmrs.AppTarget.WPS1Node.0 WPS1Node rmrs.AppTarget
rmrs.AppTarget.WPS2Node.0 WPS2Node rmrs.AppTarget
rmrs.Messaging.WAS1Node.0 WAS1Node rmrs.Messaging
rmrs.Messaging.WAS2Node.0 WAS2Node rmrs.Messaging
rmrs.Support.WPS1Node.0 WPS1Node rmrs.Support
rmrs.Support.WPS2Node.0 WPS2Node rmrs.Support
-> Ah, it was not clear, from your previous update, if you were using the High Availability configuration or the scalable one.
While our input is something similar as below, Dont the script try to enable the polling on both the servers ?
name=AutoProcessModApp#Aut
name=AutoProcessModApp#Aut
as I said earlier, you are more than welcome to suggest your views about how to approach for the script 2.
Thanks
I'm trying to figure out how best to determine with which cluster a particular Message Engine an MBean is associated.
From the MBean example you provided earlier, it appears that script 2 will have to do a bit of lookup in order to determine with which cluster an ME Mbean is associated.
Given the "query" string from the input file,
Look for an active MBean
- If one is found, extract the cell, node & server name attributes from this MBean
- Use this information to determine the cluster.
How does that sound?
From the MBean example you provided earlier, it appears that script 2 will have to do a bit of lookup in order to determine with which cluster an ME Mbean is associated.
Given the "query" string from the input file,
Look for an active MBean
- If one is found, extract the cell, node & server name attributes from this MBean
- Use this information to determine the cluster.
How does that sound?
ASKER
Hi,
I just want to be clear, there are some time’s when the polling will go inactive on all the cluster member’s. At that time, it won’t read the flat files. This script should help us, when those case’s arrive. So that it will activate the polling on any one Cluster member and start reading the flat files. And previously, for the first two days, my output files and responses are from stand alone. But please refer to the output from the OutPut-MBeans-Dev0.txt
If you fell like your approach be able to address this issue please go ahead. And let me know, what to do.
I just want to be clear, there are some time’s when the polling will go inactive on all the cluster member’s. At that time, it won’t read the flat files. This script should help us, when those case’s arrive. So that it will activate the polling on any one Cluster member and start reading the flat files. And previously, for the first two days, my output files and responses are from stand alone. But please refer to the output from the OutPut-MBeans-Dev0.txt
If you fell like your approach be able to address this issue please go ahead. And let me know, what to do.
> I just want to be clear, there are some time’s when the polling will go inactive on all the cluster member’s.
I'm sorry, but I don't understand.
What polling are you talking about?
I'm sorry, but I don't understand.
What polling are you talking about?
ASKER
All adapter polling scenarios and all adapter types such as flat file, FTP, JDBC and SAP.
With the command’s I provided earlier, it will be checking the status of the message endpoint associated with an activation specification and restart the polling thread if requires.
With the command’s I provided earlier, it will be checking the status of the message endpoint associated with an activation specification and restart the polling thread if requires.
Are you talking about the fact that the script is checking which ME beans are active, and attempting to restart the inactive and stopped ones?
ASKER
Yes, let me give you a scenario
If we have an Envi, where the server’s CM1 and CM2 are clustered, and a application App1 is deployed to that cluster.
And that App1 is used for processing the flat files.
We are using the below values as input for the script2.
name=App1_J2CMessageEndpoi nt,J2EEApp lication=A pp1,J2EESe rver=CM1*
name=App1_J2CMessageEndpoi nt,J2EEApp lication=A pp1,J2EESe rver=CM2*
How will the current script2 behave?
From my understanding,
It will check the app1 on CM1 and if it is inactive it start that, with out checking next input string. Even when the app1 on CM2 is Active. By doing this, if App1 on CM2 is processing any file at that time. It will corrupt the flat file as it is in middle of processing.
So , the Script2 should be capable of, Checking the status on all the Cluster Member’s before it resume the status on any one of the cluster member.
If we have an Envi, where the server’s CM1 and CM2 are clustered, and a application App1 is deployed to that cluster.
And that App1 is used for processing the flat files.
We are using the below values as input for the script2.
name=App1_J2CMessageEndpoi
name=App1_J2CMessageEndpoi
How will the current script2 behave?
From my understanding,
It will check the app1 on CM1 and if it is inactive it start that, with out checking next input string. Even when the app1 on CM2 is Active. By doing this, if App1 on CM2 is processing any file at that time. It will corrupt the flat file as it is in middle of processing.
So , the Script2 should be capable of, Checking the status on all the Cluster Member’s before it resume the status on any one of the cluster member.
well, with revisions, I would expect script 2 to:
read record #1, and look for the ME bean on server CM1,
if that bean exists, and is active, leave it along, and move on to the next record.
if it exists, but is stopped, or inactive, check the other cluster members to see if any ME on the clusters is active. ...
Only if no ME in the cluster is active would an attempt be made to "start" one.
The question remains... which one should be started?!?
read record #1, and look for the ME bean on server CM1,
if that bean exists, and is active, leave it along, and move on to the next record.
if it exists, but is stopped, or inactive, check the other cluster members to see if any ME on the clusters is active. ...
Only if no ME in the cluster is active would an attempt be made to "start" one.
The question remains... which one should be started?!?
ASKER
I also kind of stuck at that. So, I also don't have an exact answer. But for now. If we make ME bean on CM1 to start out of all Cluster Member's . If should be good. Once I am able to find an answer for that, I will open a new thread.
Can you get the script to check for all the Cluster member, not just for 2 cluster member environment.
Thanks
Can you get the script to check for all the Cluster member, not just for 2 cluster member environment.
Thanks
ASKER
Hi HonorGod,
Did you got chance to look into the update for script 2 ?
Thanks
Did you got chance to look into the update for script 2 ?
Thanks
Somehow I missed your previous update. Thanks for letting me know (reminding me).
let me try to look at it tonight, or 1st thing tomorrow.
let me try to look at it tonight, or 1st thing tomorrow.
ASKER
Hi HonorGod,
Do you have any update on Script2
Thanks..!
Do you have any update on Script2
Thanks..!
ASKER
Hi HonorGod,
Do you have any update on Script2 ? If that is too complex, can let me know the issue so we can look for some round-about and get it working on Cluster .
Thanks
Do you have any update on Script2 ? If that is too complex, can let me know the issue so we can look for some round-about and get it working on Cluster .
Thanks
Sorry, life intruded this weekend, and today. I hope to have script#2 updated for you tomorrow morning (Eastern US time)
I have some questions for you.
- In the "normal" case, are there MEbeans for each cluster member?
- What is the "state" of each MEbean?
- Is it possible for a server (cluster member) to have access to multiple Message Engines?
I'm trying to figure out the best way to work with the information generated by script#1.
Thanks
- In the "normal" case, are there MEbeans for each cluster member?
- What is the "state" of each MEbean?
- Is it possible for a server (cluster member) to have access to multiple Message Engines?
I'm trying to figure out the best way to work with the information generated by script#1.
Thanks
ASKER
Thank you for responding...!
- In the "normal" case, are there MEbeans for each cluster member?
Yes
- What is the "state" of each MEbean?
If MEBean on CM1 is Active, the rest will be inactive
- Is it possible for a server (cluster member) to have access to multiple Message Engines?
No.
taking the below as Example
name=App1_J2CMessageEndpoi nt,J2EEApp lication=A pp1,J2EESe rver=CM1*
name=App1_J2CMessageEndpoi nt,J2EEApp lication=A pp1,J2EESe rver=CM2*
Where the MBean is active on CM1 and inactive on CM2
wsadmin>objectName = AdminControl.queryNames("* :name=App1 _J2CMessag eEndpoint, J2EEApplic ation=App1 ,J2EEServe r=CM1*')
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>AdminControl.invok e(objectNa me, 'resume')
''
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>objectName = AdminControl.queryNames("* :name=App1 _J2CMessag eEndpoint, J2EEApplic ation=App1 ,J2EEServe r=CM2*')
wsadmin>AdminControl.invok e(objectNa me, 'getStatus')
'1'
wsadmin>AdminControl.invok e(objectNa me, 'resume')
WASX7015E: Exception running command: "AdminControl.invoke(objec tName, 'resume')"; exception information:
javax.management.MBeanExce ption
java.lang.IllegalStateExce ption: java.lang.IllegalStateExce ption: J2CA0526I: The Message Endpoint for ActivationSpec jndi/App1_J2CMessageEndpoi nt (com.ibm.j2ca.jdbc.inbound .JDBCActiv ationSpecW ithXid) and MDB Application App1_J2CMessageEndpoint cannot be activated nor deactivated because inbound messaging on ResourceAdapter {2} is currently disabled by the High_Availability (HA) Manager.
- In the "normal" case, are there MEbeans for each cluster member?
Yes
- What is the "state" of each MEbean?
If MEBean on CM1 is Active, the rest will be inactive
- Is it possible for a server (cluster member) to have access to multiple Message Engines?
No.
taking the below as Example
name=App1_J2CMessageEndpoi
name=App1_J2CMessageEndpoi
Where the MBean is active on CM1 and inactive on CM2
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
'1'
wsadmin>AdminControl.invok
''
wsadmin>AdminControl.invok
'1'
wsadmin>objectName = AdminControl.queryNames("*
wsadmin>AdminControl.invok
'1'
wsadmin>AdminControl.invok
WASX7015E: Exception running command: "AdminControl.invoke(objec
javax.management.MBeanExce
java.lang.IllegalStateExce
ASKER
What I am looking for now, Is, We Change the input file for Script as we required. (Doesn’t need to be exactly the same as OutPut of Script1) And in Script 2, Have a Condition to check for the status of MBean’s on all the Cluster Members. If none of them returns as active, just change the status of the CM1 MBean. I am looking form Which ever is beast and quick solution is available, we would like to use it. As we need to implement it soon.
So, it would appear that script2 should:
- Determine that an ME bean is active one one of the cluster members, and leave it, and all other cluster ME's alone... right?
- Only if:
- an ME bean is on a non-cluster, and inactive
- or ALL cluster ME's are inactive
should it (script2) try to start, or restart an ME.
Right?
- Determine that an ME bean is active one one of the cluster members, and leave it, and all other cluster ME's alone... right?
- Only if:
- an ME bean is on a non-cluster, and inactive
- or ALL cluster ME's are inactive
should it (script2) try to start, or restart an ME.
Right?
ASKER
Yes. Thats what we are looking for now. And can we captured the list of the MBean's or J2EE Aplication the script is changing the status in each time it ran.
This will help us to determine, how the script is helping our issue.
Thanks
This will help us to determine, how the script is helping our issue.
Thanks
ok, I "think" I have it figured out...
I need to finish the code, and hope to post tonight...
I need to finish the code, and hope to post tonight...
I think that this has a good chance of working. Please take a look, try it out, and let me know.
meResume.py
meResume.py
ASKER
Thanks for the updated script...But i am getting the below error: find the attachment for the input file
[b]wasadmin@dev10-ak-fis bin] $ ./wsadmin.sh -lang jython -f /tmp/meResume.py /tmp/InPutOf-meResume-Dev. txt
Realm/Cell Name: <default>
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De v.txt]"
Processing: /tmp/InPutOf-meResume-Dev. txt
Error: resource not found: name=O_SDINT50_JdaSap_OrdM edApp2#SDI NT50_JdaSa p_OrdMedJD AFTPExport #SDINT50_J daSap_OrdM ed_J2CMess ageEndpoin t,J2EEAppl ication=O_ SDINT50_Jd aSap_OrdMe dApp2,J2EE Server=DEV 0_GOLD.App Target.dev 11-Node01. 0*
Error: resource not found: name=O_SDINT50_JdaSap_OrdM edApp2#SDI NT50_JdaSa p_OrdMedJD AFTPExport #SDINT50_J daSap_OrdM ed_J2CMess ageEndpoin t,J2EEAppl ication=O_ SDINT50_Jd aSap_OrdMe dApp2,J2EE Server=DEV 0_GOLD.App Target.dev 12-Node01. 0*
Error: resource not found: name=O_SDINT7_BfdSap_DelMe dApp#SDINT 7_BfdSap_D elMedcom/b fusa/wps/o tc/sca/Fla tFileExpor t#SDINT7_B fdSap_DelM ed_J2CMess ageEndpoin t,J2EEAppl ication=O_ SDINT7_Bfd Sap_DelMed App,J2EESe rver=DEV0_ GOLD.AppTa rget.dev11 -Node01.0*
Error: resource not found: name=O_SDINT7_BfdSap_DelMe dApp#SDINT 7_BfdSap_D elMedcom/b fusa/wps/o tc/sca/Fla tFileExpor t#SDINT7_B fdSap_DelM ed_J2CMess ageEndpoin t,J2EEAppl ication=O_ SDINT7_Bfd Sap_DelMed App,J2EESe rver=DEV0_ GOLD.AppTa rget.dev12 -Node01.0*
Error: resource not found: name=O_SDOMINT88_BsroSap_O rdMedApp#S DOMINT88_B sroSap_Ord Medcom/bfu sa/wps/otc /sca/FlatF ileExport# SDOMINT88_ BsroSap_Or dMed_J2CMe ssageEndpo int,J2EEAp plication= O_SDOMINT8 8_BsroSap_ OrdMedApp, J2EEServer =DEV0_GOLD .AppTarget .dev11-Nod e01.0*
Error: resource not found: name=O_SDOMINT88_BsroSap_O rdMedApp#S DOMINT88_B sroSap_Ord Medcom/bfu sa/wps/otc /sca/FlatF ileExport# SDOMINT88_ BsroSap_Or dMed_J2CMe ssageEndpo int,J2EEAp plication= O_SDOMINT8 8_BsroSap_ OrdMedApp, J2EEServer =DEV0_GOLD .AppTarget .dev12-Nod e01.0*
Exception encountered:
Type: exceptions.NameError
value: configIdAsList[/b]
InPutOf-meResume-Dev.txt
OutPutOf-meBeans-Dev.txt
[b]wasadmin@dev10-ak-fis bin] $ ./wsadmin.sh -lang jython -f /tmp/meResume.py /tmp/InPutOf-meResume-Dev.
Realm/Cell Name: <default>
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De
Processing: /tmp/InPutOf-meResume-Dev.
Error: resource not found: name=O_SDINT50_JdaSap_OrdM
Error: resource not found: name=O_SDINT50_JdaSap_OrdM
Error: resource not found: name=O_SDINT7_BfdSap_DelMe
Error: resource not found: name=O_SDINT7_BfdSap_DelMe
Error: resource not found: name=O_SDOMINT88_BsroSap_O
Error: resource not found: name=O_SDOMINT88_BsroSap_O
Exception encountered:
Type: exceptions.NameError
value: configIdAsList[/b]
InPutOf-meResume-Dev.txt
OutPutOf-meBeans-Dev.txt
ASKER
Hi,
I did little Homework, and corrected the input file. after passing the correct input file, i am getting below message
Please fine the attached input file.
wasadmin@dev10-ak-fis bin] $ ./wsadmin.sh -lang jython -f /tmp/RammiMeResume.py /tmp/InPutOf-meResume-Dev. txt
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De v.txt]"
Processing: /tmp/InPutOf-meResume-Dev. txt
Exception encountered:
Type: exceptions.NameError
value: configIdAsList
InPutOf-meResume-Dev.txt
I did little Homework, and corrected the input file. after passing the correct input file, i am getting below message
Please fine the attached input file.
wasadmin@dev10-ak-fis bin] $ ./wsadmin.sh -lang jython -f /tmp/RammiMeResume.py /tmp/InPutOf-meResume-Dev.
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De
Processing: /tmp/InPutOf-meResume-Dev.
Exception encountered:
Type: exceptions.NameError
value: configIdAsList
InPutOf-meResume-Dev.txt
I'm sorry, that's a typographical error in line 140:
Currently it looks like (without the proper indentation):
-------------------------- ---------- ---------- ---------- ---------- ----
members = configIdAsList( AdminConfig.showAttribute( cluster, 'members' ) )
-------------------------- ---------- ---------- ---------- ---------- ----
The problem is that the function that it is supposed to be calling has a slightly different name:
-------------------------- ---------- ---------- ---------- ---------- ----
configIdsAsList( )
-------------------------- ---------- ---------- ---------- ---------- ----
instead of:
-------------------------- ---------- ---------- ---------- ---------- ----
configIdAsList(
-------------------------- ---------- ---------- ---------- ---------- ----
See where it (configIdsAsList) is defined in line 12.
So, change the "configIdAsList" line 140 to be "configIdsAsList" instead.
Note: Ids should be plural.
Currently it looks like (without the proper indentation):
--------------------------
members = configIdAsList( AdminConfig.showAttribute(
--------------------------
The problem is that the function that it is supposed to be calling has a slightly different name:
--------------------------
configIdsAsList( )
--------------------------
instead of:
--------------------------
configIdAsList(
--------------------------
See where it (configIdsAsList) is defined in line 12.
So, change the "configIdAsList" line 140 to be "configIdsAsList" instead.
Note: Ids should be plural.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
wow, the cluster checking code looks to be working fine...
Excellent.
Please let me know how the additional testing goes.
Excellent.
Please let me know how the additional testing goes.
ASKER
i think script is not checking all the Values in the input file. it is breaking after checking status for one.
Even i paused the polling for one Activation spec. it didn't changed the status.
i got the below , i didn't show which adapter is it trying to check the status and which one it started.
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De v.txt]"
Processing: /tmp/InPutOf-meResume-Dev. txt
Resource restarted successfully: member = DEV0_GOLD.AppTarget.dev12- Node01.0 node = dev12-Node01
Even i paused the polling for one Activation spec. it didn't changed the status.
i got the below , i didn't show which adapter is it trying to check the status and which one it started.
WASX7209I: Connected to process "dmgr" on node dev10-DEV-CellManager using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/tmp/InPutOf-meResume-De
Processing: /tmp/InPutOf-meResume-Dev.
Resource restarted successfully: member = DEV0_GOLD.AppTarget.dev12-
ASKER
I am doing more research on this . Can be hold for now on Script 2.
Thanks
Thanks
It only "breaks" when it it processing all of the beans that exist for a cluster, and an attempt to resume the MBbean results in a status of "1" (i.e., Active). [See line 155]
How many clusters do you have?
How many members in each cluster?
You might consider adding one or more print statements to the resume() routine to determine which bean is being processed, and the result...
You might also consider commenting out line 155 to see what happens when you attempt to resume() all MEbeans in a cluster
How many clusters do you have?
How many members in each cluster?
You might consider adding one or more print statements to the resume() routine to determine which bean is being processed, and the result...
You might also consider commenting out line 155 to see what happens when you attempt to resume() all MEbeans in a cluster
ASKER
sorry, i did get chance to look at this last week. but will update you by End of Day today.
Thanks
Thanks
Did you get a chance to test this?
ASKER
===>How many clusters do you have?
Ours is a GoldenTopology, We have 3 Cluster's, one for AppTargets, One for Messaging and one for Support.
All the app's which i need to check the polling status is on AppTarget cluster.
===>How many members in each cluster?
Each Cluster got two Cluster Member's
I tried the way you mentioned, but I still see , the script is not reading all the values in the input file.
Can you get me a script which will just show me the status of the Adapter polling on which one is active.
just check the condition on both Cluster member and print the status on which one is active.
I am not looking for starting /resume the adapter polling for now. once I have that script I will close this thread.
I am researching more on, if the Adapter polling is inactive on both, which cluster member. Once I have an answer, I will open a new thread.
Ours is a GoldenTopology, We have 3 Cluster's, one for AppTargets, One for Messaging and one for Support.
All the app's which i need to check the polling status is on AppTarget cluster.
===>How many members in each cluster?
Each Cluster got two Cluster Member's
I tried the way you mentioned, but I still see , the script is not reading all the values in the input file.
Can you get me a script which will just show me the status of the Adapter polling on which one is active.
just check the condition on both Cluster member and print the status on which one is active.
I am not looking for starting /resume the adapter polling for now. once I have that script I will close this thread.
I am researching more on, if the Adapter polling is inactive on both, which cluster member. Once I have an answer, I will open a new thread.
ASKER
I just want to rephrase my previous statement. Once I have the script for just checking the status on Adapter polling on both Cluster Members. I will close this thread with points as solution.
63 comments, clarifications, suggestions, and examples... and 0 points... ouch
ASKER
Got the solution I want
Q: Why do you want to write the MBean names to a file?
There is no guarantee that these MBean names wouldn't change after a resource is recycled.
Q: What, exactly, do you mean by a "readable format"?
Q: Why do you want to read the MBean names from a file?
Q: When you say that the input file may contain 50 values, do you mean that you have upwards of 50 Messaging Engines defined in your environment?