Who’s On Phirst

Official blog of Phurnace Software.

Tag >> Tivoli Remote Execution and Access

Posted by: Robert Reeves on

Both WebSphere Virtual Enterprise (VE) and ND 7.0 have the ability to remotely stop and start Node Agents, install WebSphere on remote servers and a whole host of handy remote activities. To perform these actions, WebSphere takes advantage of Tivoli Remote Execution and Access (RXA).

Luckily, you too can take advantage of RXA to manage your remote servers. Below, I’ll show you how to create a very simple Java class that will connect to your local windows machine and perform a directory listing.

First, you will need to create a new Eclipse project and add the following JAR to your Build Path as an external library: ${WAS_INSTALL_DIR}/plugins/com.ibm.ws.prereq.rxa.jar.

Second, create a new class and add the following main method.

      public static void main(String[] args) throws Exception {

            RemoteAccess ra = new LocalWindowsProtocol();
            ra.beginSession();
      }

At this point, you can really take advantage of the RemoteAccess object to gather information about your Local Windows host, or to run commands, manage processes, you name it. For example, the following lines added to the main method will perform a directory listing on your Local Windows host:

            ProgramOutput programOutput = ra.run("dir");
            String stdOut = programOutput.getStdout();

Of course, you might want to get STDERR while you’re at it…

Finally, RXA is not just limited to a Local Windows host. Here is an example on how to connect to a Remote SSH host:

            String username = new String("root");
            String strPassword = new String("p4ssw0rd");
            byte[] bPassword = strPassword.getBytes();
            ra = new SSHProtocol(username, bPassword);
            ra.setHostname("myhost.domain.com");
            ra.beginSession();

If you are going to be running a series of identical commands on a bunch of different servers, all with different OS types, I would recommend using the Factory design pattern to generate a RemoteAccess object of the correct Protocol type. Below is a list of the Protocol objects. As you can see, you have a very broad assortment.

AS400Protocol
LocalAS400Protocol
LocalUNIXProtocol
LocalWindowsProtocol
REXECProtocol
RSHProtocol
SSHProtocol
UNIXProtocol
WindowsProtocol

In WebSphere VEWebSphere 7.0Tivoli Remote Execution and Access
Comment (0) Read More...