WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  AIX script for applications status in JVM

    Posted Fri May 25, 2012 01:39 PM
    Hi

    This Linux script is meant for checking the status of
    applications in WAS V7.0 application server/JVM. I want
    the equivalent version for AIX. I verified the wsadmn part
    of the script on AIX and no issues. Thanks in advance

    print "Getting Application Status..."
    apps = AdminApp.list().splitlines();
    for app in apps:
    #print app
    appObj=AdminControl.completeObjectName
    ('type=Application,name='+a
    pp+',*')
    if appObj != '' :
    appStatus = 'running';
    else :
    appStatus = 'stopped';
    print 'Application:'+app+'='+appStatus


    As mentioned wsadmin objects are working fine on AIX
    (As shown below). Essentially I am looking for AIX syntax.
    Thanks

    wsadmin>AdminApp.list().splitlines()
    ['ACSDummyEAR', 'B2BCustomTAMUI', 'DefaultApplication',
    'GrpRegEAR', 'HardcopyReplacementEAR', 'HomeEAR',
    'MMGEAR', 'MRSHomeEAR', 'PlantsByWebSphere',
    'SamplesGallery', 'WCTWSEAR', 'WIDummyEAR',
    'ivtApp', 'query']

    wsadmin>AdminControl.completeObjectName
    ('type=Application,*')
    WASX7026W: String "type=Application,*"
    corresponds to 19 different MBeans; returning first one.
    'WebSphere:name=MMGEAR,process=server1,platform=
    dynamicproxy,node=UD1981HTA19Node01,J2EEName=
    MMGEAR,Server=server1,version=7.0.0.21,type=Application,
    mbeanIdentifier=cells/UD1981HTA19Node01Cell/
    applications/MMGEAR.ear/deployments/MMGEAR/
    deployment.xml#ApplicationDeployment_1170692337680,
    cell=
    UD1981HTA19Node01Cell,spec=1.0'


  • 2.  AIX script for applications status in JVM

    Posted Tue May 29, 2012 08:10 AM
    Option1
    -----------
    Since your wsadmin commands are tested as positive..
    why not put them in a seperate file [.py] and call using
    normal shell script ?
    wsadmin -f {scriptfilename}.
    This optional parameter specifies a script to run.
    If you specify this parameter, wsadmin runs the script
    that you specify and then returns you to the Qshell prompt.

    option-2
    -----------
    As you are using WAS7.. make use of properties files

    check here for an example: websphere-automation.blogspot.in/2011/01...


  • 3.  AIX script for applications status in JVM

    Posted Tue May 29, 2012 03:25 PM
    I tried the following script from wsadmin prompt
    and received error. Is there any issue with
    ('type=Application,name='+app+',*')? Thanks

    apps = AdminApp.list().splitlines()
    for app in apps:
    #print app
    App_Obj=AdminControl.completeObjectName
    ('type=Application,name='+app+',*')
    if App_Obj != '' :
    appStatus = 'running';
    else :
    appStatus = 'stopped';
    print 'Application:'+app+'='+appStatus


    wsadmin>execfile("xxx.jy")
    WASX7015E: Exception running command:
    "execfile("xxx.jy")"; exception information:
     com.ibm.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
      File "", line 1, in ?
      File "xxx.jy", line 4
            App_Obj=AdminControl.completeObjectName
    ('type=Application,name='+app+',*')
            ^
    SyntaxError: invalid syntax


  • 4.  AIX script for applications status in JVM

    Posted Sat June 02, 2012 10:32 PM
    Hi WASAdmin,

      are you indenting the line? that is you need to start the next line to a for (or while, if,  etc) one space indented to the for.

    NO
    ==
    apps = AdminApp.list().splitlines()
    for app in apps:
    #print app
    App_Obj=AdminControl.completeObjectName
    ('type=Application,name='+app+',*')
    if App_Obj != '' :
    appStatus = 'running';
    else :
    appStatus = 'stopped';
    print 'Application:'+app+'='+appStatus

    YES (i have put more than one space to see de diference, but with one is enoguh)
    ===

    apps = AdminApp.list().splitlines()
    for app in apps:
        #print app
        App_Obj=AdminControl.completeObjectName  'type=Application,name='+app+',*')
        if App_Obj != '' :
           appStatus = 'running';
        else :
           appStatus = 'stopped';
        print 'Application:'+app+'='+appStatus


      is a common error when you have in jython SyntaxError

    hope this helps,


    regards,