Using the Grid Script Client to Manage the Grid

The ION Grid includes a built-in utility class that can help you control the grid and grid applications as well as query the grid for status information. It is primarily built to be used from the command line or a scripting language

For example, if you need to schedule backups, it is useful to have a script that shuts down an application programmatically, sets the application offline, performs the maintenance tasks, starts the application, and finally queries the application for its status to ensure it is running correctly.

Note: An alternative to using this script utility is to operate programmatically on the grid using REST.
  1. Copy the grid-core.jar to a directory of your choice. This jar file is located in an installed grid's resources directory.
  2. If LifeCycle Manager (LCM) is used, create a client certificate with the correct credentials. This is needed because the utility is a grid client that will perform administrative tasks in the grid.
    1. In LifeCycle Manager, click Manage Security on the dashboard for the target grid.
    2. Select Generate client keystore and click Next.
    3. Select a name, password, and target directory for your keystore (certificate file). Make sure to specify "grid-admin" in the role list.
    4. Make a note of a grid agent port and address or copy the topology file from the installed grid's config directory.
  3. If LifeCycle Manager is not used, complete these steps:
    1. Create a client certificate with the correct credentials. This is needed because the utility is a grid client that will perform administrative tasks in the grid. For more information on creating client certificates, see "Managing SSL Client Certificates in the Configuration Manager" in the Infor ION Grid Security Administration Guide.
    2. Make a note of a grid agent port and address or copy the topology file from the installed grid's config directory.
  4. To run a scripting command, use the following command line:

    java –cp grid-core.jar;grid-ui.jar com.lawson.grid.util.ScriptingClient agentAddress agentPort -ks keystoreFileName keystorePassword command target

Supported Commands

The following commands are supported. The result will be presented on standard out and the return code will be 0 unless there is an ERROR message. In the case of an ERROR, the return code will be 1 and all messages will be presented on standard err. If you get an ERROR result the command has failed to complete

Command Results and Descriptions
startgrid

SUCCESS - grid successfully started

TIMED_OUT - grid not started within timeout period

stopgrid

SUCCESS - grid successfully stopped

TIMED_OUT - grid not stopped within timeout period

gridoffline SUCCESS - grid is set offline
gridonline SUCCESS - grid is set online
gridstatus

REGISTRY_STOPPED - the registry is stopped

ADMINROUTER_STOPPED - the admin router is stopped

GRIDAGENT_STOPPED - reported once for each grid agent that is stopped

GRIDAGENT_RUNNING - reported once for each grid agent that is running

OK - registry, router, and all grid agents are running

STOPPED - when only grid agents are running

OFFLINE - the grid is offline

ONLINE - the grid is online

NO_OFFLINE_STATUS - unable to get offline status (the grid might be stopped)

hostoffline hostName SUCCESS - host is set offline
hostonline hostName SUCCESS - host is set offline
hoststatus hostName

GRIDAGENT_RUNNING - the grid agent is running

GRIDAGENT_STOPPED - the grid agent is stopped

OFFLINE - the host is offline

ONLINE - the host is online

NO_OFFLINE_STATUS - unable to get offline status for this host (the grid might be stopped)

applicationstatus application

OK - the application global status returns OK

NOT_OK - the application global status returns NOT OK

COMMENT - each line of the application status report is reported as a COMMENT line

NO_APPLICATION_STATUS - unable to get application status

STOPPED - the application is stopped

OFFLINE - the application is offline

ONLINE - the application is online

NO_OFFLINE_STATUS - unable to get offline status for this application (the grid might be stopped)

applicationoffline -p true/false application

SUCCESS - application is set offline

-p controls whether the application should be set permanently offline (true) or offline until Grid is next restarted (false).

applicationonline application SUCCESS - application is set online
startapplication application

SUCCESS - application is started

TIMED_OUT - application not started within timeout period

stopapplication application

SUCCESS - application is stopped

TIMED_OUT - application not stopped within timeout period

deploystatus application

OK - application is successfully installed - version is <version>

NOT_OK - application is not deployed

NOT_OK - deploy is in progress

NOT_OK - undeploy is in progress

ERROR - failed to query application deploy state

ERROR - deploy failed

ERROR - undeploy failed

ERROR - application state is unknown: <state>