Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jython wsadmin: get nodeName of server

In Jython WebSphere Wsadmin:

It appears that I can get to the server's names from the nodeName, however I haven't managed to find a direct way to find the nodeName of a server.

I thought about creating a map of all the nodes, but that is expensive.

Can anyone help?

like image 228
user967710 Avatar asked Sep 27 '11 18:09

user967710


People also ask

How do I use Wsadmin commands?

Run the wsadmin tool with the -f option, and place the commands that you want to run into the file. A profile script is a script that runs before the main script, or before entering interactive mode. You can use profile scripts to set up a scripting environment that is customized for the user or the installation.

What are Wsadmin commands?

From the wsadmin prompt, enter any Jacl or Jython command. You can also invoke commands using the AdminControl, AdminApp, AdminConfig, AdminTask, or Help wsadmin objects. To leave an interactive scripting session, use the quit or exit commands. These commands do not take any arguments.

What is Wsadmin scripting tool?

The wsadmin tool removes any leading and trailing space including \n , \r , \t , \f and space when parsing a string to avoid any user errors. For example, someone might accidentally hit the spacebar key or the Tab key and add extra space to the command string.


2 Answers

You can get the node name of the server using the Server MBean.

You can find info on the Server MBean here http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.ejbfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Fcjmx_overview.html

objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') 
print AdminControl.getAttribute(objNameString, 'nodeName')
like image 132
Snehan Solomon Avatar answered Sep 25 '22 00:09

Snehan Solomon


You can also get the node name using the getNode() method on AdminControl:

wsadmin>objn = AdminControl.completeObjectName('WebSphere:type=Server,*')

wsadmin>print AdminControl.getAttribute(objn, 'nodeName')
Node01

wsadmin>print AdminControl.getNode()
Node01

References

  • Commands for the AdminControl object using wsadmin scripting
like image 42
slm Avatar answered Sep 23 '22 00:09

slm