OIM 11.1.2.2 : Check OIM Scheduler Status Without Logging In
Change the localhost and port 8080 below to your OIM server's hostname and port numberimport java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class CheckSchedulerStatus{
public CheckSchedulerStatus(){
}
public void SchedulerStatus(){
try{
URL url = null;
URLConnection urlconn = null;
url =new URL("http://mindtelligent-d:14000/xlScheduler/ddstatus");
urlconn = url.openConnection();
urlconn.connect();
InputStream response =urlconn.getInputStream();
StringBuffer buffer = new StringBuffer();
BufferedReader dataInput =
new BufferedReader(new InputStreamReader(response));
String line;
while ((line = dataInput.readLine()) != null) {
buffer.append(line);
buffer.append('\n');
} if(buffer.toString().toUpperCase().indexOf("STARTED")!=-1){
System.out.println("Scheduler Status: " + "STARTED");
}
else if(buffer.toString().toUpperCase().indexOf("STOPPED")!=-1){
System.out.println("Scheduler Status: " + "STOPPED");
int stackTraceLocation = buffer.toString().indexOf("Detaild Stack Trace follows");
if (stackTraceLocation > -1) {
int stackTraceBeingIndex = buffer.toString().indexOf("<PRE>",stackTraceLocation)+5;
int stackTraceEndIndex = buffer.toString().indexOf("</PRE>",stackTraceLocation);
String stackTrace = buffer.toString().substring(stackTraceBeingIndex,stackTraceEndIndex);
System.out.println(stackTrace);
}
}
}
catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args){
CheckSchedulerStatus chckSch = new CheckSchedulerStatus();
chckSch.SchedulerStatus();
}
}