Siebel System Administration Guide > Siebel Management Framework APIs >

Example of Server-Level JMX API


The following is an example of the Server-level JMX API.

CAUTION:  You must test these methods carefully before deploying into production, as some of these commands can shutdown or disable components, servers, or even the enterprise.

/**

*

*/

import com.siebel.management.jmxapi.*;

public class Server

{

/**

* @param args

*/

public static void main(String[] args)

{

JmxServerMBean smb = new JmxServer();

try

{

//+ The following 2 need to be changed by the person using this program

String ent = "siebel"; // enterprise name

String srv = "sdchs21n016"; // server name

//getstate//

String srvState = smb.getState (ent, srv);

System.out.println("getState('" + srv + "'):" + srvState);

//shutdownserver//

Boolean shutdownSrv = smb.shutdownServer (ent, srv);

System.out.println("shutdownServer('" + srv + "'):" + shutdownSrv);

//A sleep time of 5 min before starting the siebel server//

System.out.println("SleepTime:5 min");

try {

Thread.sleep( 300000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" );}

//startserver//

Boolean startSrv = smb.startServer (ent, srv);

System.out.println("startServer('" + srv + "'):" + startSrv);

//A sleep time of 5 min before starting the siebel server//

System.out.println("SleepTime:5 min");

try {

Thread.sleep( 300000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" );}

//getparam//

String param = "Connect";

String paramval = smb.getParam (ent, srv, param);

System.out.println("getParam ('" + param + "'):" + paramval);

//getstat//

String stat = "NumErrors";

String statval = smb.getStat (ent, srv, stat);

System.out.println("getStat ('" + stat + "'):" + statval);

//getsval//

String sval = "SrvrTasks";

String svalval = smb.getSval (ent, srv, sval);

System.out.println("getSval ('" + sval + "'):" + svalval);

//getComps//

String[] Comps = smb.getComps (ent, srv);

System.out.println("Components:");

for (int i = 0; i < Comps.length; i++)

{

System.out.println(" " + Comps[i]);

}

//getCompstate//

String arg = "ServerMgr";

String Compval = smb.getCompState (ent, srv, arg);

System.out.println("getCompState ('" + arg + "'):" + Compval);

//shutdowncomp//

String Comp = "Dbxtract";

Boolean compstop = smb.shutdownComp (ent, srv, Comp, false);

System.out.println("shutdownComp ('" + Comp + "'):" + compstop);

//A Sleep time of 2min before starting the component//

System.out.println("Sleeptime: 2 min");

try {

Thread.sleep( 120000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" ); }

//startComp//

Boolean compstart = smb.startComp (ent, srv, Comp);

System.out.println("startComp ('" + Comp + "'):" + compstart);

}

catch (Exception e)

{

e.printStackTrace();

}

}

}

Siebel System Administration Guide Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices.