Search in sources :

Example 1 with ErrorPojo

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();
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 2 with ErrorPojo

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();
}
Also used : ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 3 with ErrorPojo

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();
    }
}
Also used : ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 4 with ErrorPojo

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();
}
Also used : ReadingBean(com.axway.ats.common.performance.monitor.beans.ReadingBean) ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 5 with ErrorPojo

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();
}
Also used : ErrorPojo(com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo) SessionData(com.axway.ats.agent.webapp.restservice.model.SessionData) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Aggregations

ErrorPojo (com.axway.ats.agent.webapp.restservice.model.pojo.ErrorPojo)12 POST (javax.ws.rs.POST)12 Path (javax.ws.rs.Path)12 Produces (javax.ws.rs.Produces)12 SessionData (com.axway.ats.agent.webapp.restservice.model.SessionData)11 Consumes (javax.ws.rs.Consumes)11 ReadingBean (com.axway.ats.common.performance.monitor.beans.ReadingBean)6 PassiveDbAppender (com.axway.ats.log.appenders.PassiveDbAppender)1 DbAppenderConfiguration (com.axway.ats.log.autodb.DbAppenderConfiguration)1 TestCaseState (com.axway.ats.log.autodb.TestCaseState)1