use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method scheduleCustomJvmMonitoring.
@POST
@Path("scheduleCustomJvmMonitoring")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response scheduleCustomJvmMonitoring(@Context HttpServletRequest request, ScheduleCustomJvmMonitoringPojo monitoringPojo) {
final String caller = getCaller(request, monitoringPojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, monitoringPojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
Set<ReadingBean> readings = restSystemMonitor.scheduleCustomJvmMonitoring(agent, monitoringPojo.getJmxPort(), monitoringPojo.getAlias(), monitoringPojo.getMbeanName(), monitoringPojo.getUnit(), monitoringPojo.getMbeanAttributes());
restSystemMonitor.setScheduledReadingTypes(readings);
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
String statusMessage = "{\"status \": \"scheduled custom JVM monitoring with parameters '" + monitoringPojo.toString() + "'\"}";
return Response.ok(statusMessage).build();
}
use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method stopMonitoring.
@POST
@Path("stopMonitoring")
@Produces(MediaType.APPLICATION_JSON)
public Response stopMonitoring(@Context HttpServletRequest request, BasePojo basePojo) {
final String caller = getCaller(request, basePojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, basePojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
restSystemMonitor.stopMonitoring(agent);
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
return Response.ok("{\"status\":\"monitoring stopped.\"}").build();
}
use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method initializeMonitoring.
/**
* Initialize Monitoring context Must be called before calling any
* scheduleXYZMonitoring REST method
*/
@POST
@Path("initializeMonitoring")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response initializeMonitoring(@Context HttpServletRequest request, BasePojo basePojo) {
final String caller = getCaller(request, basePojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, basePojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
restSystemMonitor.initializeMonitoringContext(agent);
return Response.ok("{\"status\":\"monitoring context initialized.\"}").build();
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
}
use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method scheduleProcessMonitoring.
@POST
@Path("scheduleProcessMonitoring")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response scheduleProcessMonitoring(@Context HttpServletRequest request, ScheduleProcessMonitoringPojo monitoringPojo) {
final String caller = getCaller(request, monitoringPojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, monitoringPojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
Set<ReadingBean> readings = restSystemMonitor.scheduleProcessMonitoring(agent, monitoringPojo.getProcessPattern(), monitoringPojo.getProcessAlias(), monitoringPojo.getProcessUsername(), monitoringPojo.getProcessReadingTypes());
restSystemMonitor.setScheduledReadingTypes(readings);
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
String statusMessage = "{\"status \": \"scheduled process monitoring with parameters '" + monitoringPojo.toString() + "'\"}";
return Response.ok(statusMessage).build();
}
use of com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo in project ats-framework by Axway.
the class MonitoringServiceImpl method scheduleUserActivity.
@POST
@Path("scheduleUserActivity")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response scheduleUserActivity(@Context HttpServletRequest request, BasePojo basePojo) {
final String caller = getCaller(request, basePojo, false);
ThreadsPerCaller.registerThread(caller);
try {
SessionData sd = getSessionData(request, basePojo);
RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();
String agent = request.getLocalAddr() + ":" + request.getLocalPort();
restSystemMonitor.scheduleUserActivity(agent);
} catch (Exception e) {
return Response.serverError().entity(new ErrorPojo(e)).build();
} finally {
ThreadsPerCaller.unregisterThread();
}
String statusMessage = "{\"status \": \"scheduled user activity monitoring.\"}";
return Response.ok(statusMessage).build();
}
Aggregations