Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wsadmin - which node is a server on?

174 views
Skip to first unread message

jjpi...@efirstbank.com

unread,
Nov 10, 2009, 11:57:08 AM11/10/09
to
Is there a slick way of getting back the node name for a given server? I am starting knowing the server name, but also need the node name in order to continue desired processesing.

For instance, I can parse through the string returned via:
{code}AdminConfig.getid('/Server:myServer/'){code}
and get the info I want, but I'm hoping there is a better way along the lines of:
{code}AdminConfig.list('Node', AdminConfig.getid('/Server:myServer/'){code}

Obviously the above doesn't work, but hopefully you get the idea. I'm limited to AdminConfig, since the servers I am directly concerned with are un-managed web server definitions in the configuration.

Any insight would be greatly appreciated!

Thanks,
Josh

swarsa

unread,
Nov 10, 2009, 2:35:45 PM11/10/09
to

How about this?

def getNodeNameForServer(nm):
nodes = AdminConfig.list("Node").split(lf)
for node in nodes:
nodeServers = AdminConfig.list("Server", node).split(lf)
for nodeServer in nodeServers:
sname = AdminConfig.showAttribute(nodeServer, "name")
if sname == nm:
nname = AdminConfig.showAttribute(node, "name")
return nname
return None

FYI,
Steve Warsa

jjpi...@efirstbank.com

unread,
Nov 10, 2009, 5:23:51 PM11/10/09
to
I was able to circumvent the need to derive node name. In this case I found that in a statement like (ignore line breaks):
{code}-MapModulesToServers [[ myApp.war myApp.war,WEB-INF/web.xml
WebSphere:cell=MyCell,cluster=MyCluster+WebSphere:cell=MyCell,node=MyNode,server=MyWebServer1+
WebSphere:cell=MyCell,node=MyNode,server=MyWebServer2 ]]{code}

The "node=" designation is unnecessary. I assume this is only true as long as you do not have duplicate names on each node. Since in my case, all of our servers have unique names across our nodes, I was able to change to using:
{code}-MapModulesToServers [[ myApp.war myApp.war,WEB-INF/web.xml
WebSphere:cell=MyCell,cluster=MyCluster+WebSphere:cell=MyCell,server=MyWebServer1+
WebSphere:cell=MyCell,server=MyWebServer2 ]]{code}

And achieved the desired results.

Thanks to any that spent a little time thinking about this one!
Josh

0 new messages