简体   繁体   中英

List all my deployed applications in Websphere and their respective ports

I want to administrate some things in my WebSphere Application Server using only command line, but I'm having troubles to get a list of my deployed apps and ports.

What I want:

I need to get a list of my depĺoyed apps and their ports. I'm new in the WAS administration and comparing with Apache Web Server I want something like the command apachectl -t -D DUMP_VHOSTS

Example of apachectl output:

VirtualHost configuration:

*:80 mysite.com (/etc/apache2/sites-enabled/site.conf:1)

*:443 secure.com (/etc/apache2/sites-enabled/secure.conf:2)

Note: I know that Apache and WAS is not the same thing (more similarities among WAS and Apache Tomcat) , but its just a example of my desired output: A list of my apps (virtual hosts in apache's example) and their respective ports

What I have until now:

Since I need to do it from command line, I'm using the wsadmin shell following the steps below (Debian Server):

cd <Was_Root_Dir>/AppServer/bin
./wsadmin.sh -lang jython -user user -password pass
wsadmin>print AddminApp.list()

The result is like below:

DefaultApplication site secure

That is the list that I want but I don't know the ports for each application and I can't find how to achieve it anywhere.

I think that list is extensive and include apps in all servers and all profiles of my WAS instance. Am I right here?

Plus:

A list with all deployed apps is pretty fine, but a plus could be a way of filter only apps that use the secure port with SSL.

Is it possible? Am I misunderstood something?

Use wsadmin listApplicationServerPorts command to list the ports, in order to access a particular application. See IBM KC link ( listApplicationServerPorts ) fro more details.

I have prepared a script for you, Copy and paste the below contents to a file (script.py) and run it using wsadmin, as given below

./wsadmin.sh -lang jython -user user -password pass -f script.py

#Get the list of ALL installed APPs
appList=AdminApp.list().splitlines()

#Get the list of Application ports for each APP
for app in appList:
    print "  "
    #print APP Name
    print app
    #Get the list of Application Ports
    portList=AdminTask.listApplicationPorts(app).splitlines()
    for port in portList:
        #Print the port Details for the APP
        print port

This would print the appName and the list of applicationports.

From this list, " WC_defaulthost " port can be used for http and " WC_defaulthost_secure " for https .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM