Can I get the Applicaton's Virutal Hosts with wsadmin? - Websphere

This is a discussion on Can I get the Applicaton's Virutal Hosts with wsadmin? - Websphere ; I'm trying to get a list of all the application's on our system by Virtual Host. Is there a way to query the Virtual Hosts with wsadmin to get this? I know I can query each application, but that is ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Can I get the Applicaton's Virutal Hosts with wsadmin?

  1. Can I get the Applicaton's Virutal Hosts with wsadmin?

    I'm trying to get a list of all the application's on our system by Virtual Host. Is there a way to query the Virtual Hosts with wsadmin to get this? I know I can query each application, but that is tedious and for that I could do the admin console.

    I would also like to do something similar with SharedLibraries? Is this possible?

    Thanks,
    Janel

  2. Re: Can I get the Applicaton's Virutal Hosts with wsadmin?

    On Oct 1, 6:19*am, janmiller10 wrote:
    > I'm trying to get a list of all the application's on our system by Virtual Host. *Is there a way to query the Virtual Hosts with wsadmin to get this? *I know I can query each application, but that is tedious and for that I could do the admin console. *
    >
    > I would also like to do something similar with SharedLibraries? *Is this possible?
    >
    > Thanks,
    > Janel


    You could start off with something like this:

    lf = java.lang.System.getProperty("line.separator")
    servers = AdminConfig.list('Server').split(lf)
    for server in servers:
    type = AdminConfig.showAttribute(server, 'serverType')
    if (type.find("WEB_SERVER") == 0):
    continue
    serverName = AdminConfig.showAttribute(server, 'name')
    if serverName == "nodeagent":
    continue
    serverEntryId = AdminConfig.getid("/ServerEntry:" + serverName + "/")
    serverEntry = AdminConfig.list("ServerEntry", serverEntryId)
    deployedApps = AdminConfig.showAttribute(serverEntry,
    "deployedApplications")
    deployAppList = deployedApps.split(";")
    for deployedApp in deployAppList:
    appParts = deployedApp.split("/")
    appName = appParts[len(appParts) - 1]
    print serverName + ":" + appName


    Which gets you a list of applications by server. Then you'll have to
    get the target mapping of each application web module to the vhost.
    That will be tricky, but I think it's possible...

    FYI,
    Steve Warsa

  3. Re: Can I get the Applicaton's Virutal Hosts with wsadmin?

    On Oct 1, 7:13*am, swarsa wrote:
    > On Oct 1, 6:19*am, janmiller10 wrote:
    >
    > > I'm trying to get a list of all the application's on our system by Virtual Host. *Is there a way to query the Virtual Hosts with wsadmin to get this? *I know I can query each application, but that is tedious and for that I could do the admin console. *

    >
    > > I would also like to do something similar with SharedLibraries? *Is this possible?

    >
    > > Thanks,
    > > Janel

    >
    > You could start off with something like this:
    >
    > lf = java.lang.System.getProperty("line.separator")
    > servers = AdminConfig.list('Server').split(lf)
    > for server in servers:
    > * * * * type = AdminConfig.showAttribute(server, 'serverType')
    > * * * * if (type.find("WEB_SERVER") == 0):
    > * * * * * * * * continue
    > * * * * serverName = AdminConfig.showAttribute(server, 'name')
    > * * * * if serverName == "nodeagent":
    > * * * * * * * * continue
    > * * * * serverEntryId = AdminConfig.getid("/ServerEntry:" + serverName + "/")
    > * * * * serverEntry = AdminConfig.list("ServerEntry", serverEntryId)
    > * * * * deployedApps = AdminConfig.showAttribute(serverEntry,
    > "deployedApplications")
    > * * * * deployAppList = deployedApps.split(";")
    > * * * * for deployedApp in deployAppList:
    > * * * * * * * * appParts = deployedApp.split("/")
    > * * * * * * * * appName = appParts[len(appParts) - 1]
    > * * * * * * * * print serverName + ":" + appName
    >
    > Which gets you a list of applications by server. *Then you'll have to
    > get the target mapping of each application web module to the vhost.
    > That will be tricky, but I think it's possible...
    >
    > FYI,
    > Steve Warsa


    Then I just found out that you can do and AdminApp.view(appName) and
    it will list out each module and all the binding/mapping information
    including MapWebModToVH. You could then parse that output using
    jython to get the virtual host mapping for the application.

    FYI,
    Steve Warsa

  4. Re: Can I get the Applicaton's Virutal Hosts with wsadmin?

    On Oct 1, 8:20*am, swarsa wrote:
    > On Oct 1, 7:13*am, swarsa wrote:
    >
    >
    >
    > > On Oct 1, 6:19*am, janmiller10 wrote:

    >
    > > > I'm trying to get a list of all the application's on our system by Virtual Host. *Is there a way to query the Virtual Hosts with wsadmin to get this? *I know I can query each application, but that is tedious and forthat I could do the admin console. *

    >
    > > > I would also like to do something similar with SharedLibraries? *Isthis possible?

    >
    > > > Thanks,
    > > > Janel

    >
    > > You could start off with something like this:

    >
    > > lf = java.lang.System.getProperty("line.separator")
    > > servers = AdminConfig.list('Server').split(lf)
    > > for server in servers:
    > > * * * * type = AdminConfig.showAttribute(server, 'serverType')
    > > * * * * if (type.find("WEB_SERVER") == 0):
    > > * * * * * * * * continue
    > > * * * * serverName = AdminConfig.showAttribute(server, 'name')
    > > * * * * if serverName == "nodeagent":
    > > * * * * * * * * continue
    > > * * * * serverEntryId = AdminConfig.getid("/ServerEntry:" + serverName + "/")
    > > * * * * serverEntry = AdminConfig.list("ServerEntry", serverEntryId)
    > > * * * * deployedApps = AdminConfig.showAttribute(serverEntry,
    > > "deployedApplications")
    > > * * * * deployAppList = deployedApps.split(";")
    > > * * * * for deployedApp in deployAppList:
    > > * * * * * * * * appParts = deployedApp.split("/")
    > > * * * * * * * * appName = appParts[len(appParts) - 1]
    > > * * * * * * * * print serverName + ":" + appName

    >
    > > Which gets you a list of applications by server. *Then you'll have to
    > > get the target mapping of each application web module to the vhost.
    > > That will be tricky, but I think it's possible...

    >
    > > FYI,
    > > Steve Warsa

    >
    > Then I just found out that you can do and AdminApp.view(appName) and
    > it will list out each module and all the binding/mapping information
    > including MapWebModToVH. *You could then parse that output using
    > jython to get the virtual host mapping for the application.
    >
    > FYI,
    > Steve Warsa


    OK, last post. Here's the whole enchilada:

    lf = java.lang.System.getProperty("line.separator")
    appsOnServer = []
    servers = AdminConfig.list('Server').split(lf)
    for server in servers:
    type = AdminConfig.showAttribute(server, 'serverType')
    if (type.find("WEB_SERVER") == 0):
    continue
    serverName = AdminConfig.showAttribute(server, 'name')
    if serverName == "nodeagent" or serverName == "dmgr" or
    serverName.find("template") == 0:
    continue
    serverEntryId = AdminConfig.getid("/ServerEntry:" + serverName + "/")
    serverEntry = AdminConfig.list("ServerEntry", serverEntryId)
    deployedApps = AdminConfig.showAttribute(serverEntry,
    "deployedApplications")
    deployAppList = deployedApps.split(";")
    for deployedApp in deployAppList:
    appParts = deployedApp.split("/")
    appName = appParts[len(appParts) - 1]
    appsOnServer.append(serverName + ":" + appName)
    # now cycle through all the entries found and print their web modules
    for appOnServer in appsOnServer:
    sName = appOnServer.split(":")[0]
    aName = appOnServer.split(":")[1]
    # now get all the info on this app
    appData = AdminApp.view(aName).split(lf)
    for line in appData:
    if line.startswith("Web module: "):
    webModuleName = line.split(": ")[1]
    if line.startswith("Virtual host: "):
    vHostName = line.split(": ")[1]
    print "serverName='" + sName + "',appName='" + aName +
    "',webModuleName='" + webModuleName + "',virtualHostMappedTo='" +
    vHostName + "'"




+ Reply to Thread