Search in sources :

Example 1 with RemoteSystemResource

use of org.graylog2.shared.rest.resources.system.RemoteSystemResource in project graylog2-server by Graylog2.

the class ClusterSystemResource method jvm.

@GET
@Timed
@ApiOperation(value = "Get JVM information of the given node")
@Path("{nodeId}/jvm")
public SystemJVMResponse jvm(@ApiParam(name = "nodeId", value = "The id of the node to retrieve JVM information.", required = true) @PathParam("nodeId") String nodeId) throws IOException, NodeNotFoundException {
    final Node targetNode = nodeService.byNodeId(nodeId);
    final RemoteSystemResource remoteSystemResource = remoteInterfaceProvider.get(targetNode, this.authenticationToken, RemoteSystemResource.class);
    final Response<SystemJVMResponse> response = remoteSystemResource.jvm().execute();
    if (response.isSuccessful()) {
        return response.body();
    } else {
        LOG.warn("Unable to get jvm information on node {}: {}", nodeId, response.message());
        throw new WebApplicationException(response.message(), BAD_GATEWAY);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) RemoteSystemResource(org.graylog2.shared.rest.resources.system.RemoteSystemResource) Node(org.graylog2.cluster.Node) SystemJVMResponse(org.graylog2.rest.models.system.responses.SystemJVMResponse) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with RemoteSystemResource

use of org.graylog2.shared.rest.resources.system.RemoteSystemResource in project graylog2-server by Graylog2.

the class ClusterSystemResource method threadDump.

@GET
@Timed
@ApiOperation(value = "Get a thread dump of the given node")
@RequiresPermissions(RestPermissions.THREADS_DUMP)
@Path("{nodeId}/threaddump")
public SystemThreadDumpResponse threadDump(@ApiParam(name = "nodeId", value = "The id of the node to get a thread dump.", required = true) @PathParam("nodeId") String nodeId) throws IOException, NodeNotFoundException {
    final Node targetNode = nodeService.byNodeId(nodeId);
    final RemoteSystemResource remoteSystemResource = remoteInterfaceProvider.get(targetNode, this.authenticationToken, RemoteSystemResource.class);
    final Response<SystemThreadDumpResponse> response = remoteSystemResource.threadDump().execute();
    if (response.isSuccessful()) {
        return response.body();
    } else {
        LOG.warn("Unable to get thread dump on node {}: {}", nodeId, response.message());
        throw new WebApplicationException(response.message(), BAD_GATEWAY);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) RemoteSystemResource(org.graylog2.shared.rest.resources.system.RemoteSystemResource) Node(org.graylog2.cluster.Node) SystemThreadDumpResponse(org.graylog2.rest.models.system.responses.SystemThreadDumpResponse) Path(javax.ws.rs.Path) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with RemoteSystemResource

use of org.graylog2.shared.rest.resources.system.RemoteSystemResource in project graylog2-server by Graylog2.

the class ClusterSystemResource method processBufferDump.

@GET
@Timed
@ApiOperation(value = "Get a process buffer dump of the given node")
@RequiresPermissions(RestPermissions.PROCESSBUFFER_DUMP)
@Path("{nodeId}/processbufferdump")
public SystemProcessBufferDumpResponse processBufferDump(@ApiParam(name = "nodeId", value = "The id of the node to get a process buffer dump.", required = true) @PathParam("nodeId") String nodeId) throws IOException, NodeNotFoundException {
    final Node targetNode = nodeService.byNodeId(nodeId);
    final RemoteSystemResource remoteSystemResource = remoteInterfaceProvider.get(targetNode, this.authenticationToken, RemoteSystemResource.class);
    final Response<SystemProcessBufferDumpResponse> response = remoteSystemResource.processBufferDump().execute();
    if (response.isSuccessful()) {
        return response.body();
    } else {
        LOG.warn("Unable to get process buffer dump on node {}: {}", nodeId, response.message());
        throw new WebApplicationException(response.message(), BAD_GATEWAY);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) RemoteSystemResource(org.graylog2.shared.rest.resources.system.RemoteSystemResource) Node(org.graylog2.cluster.Node) SystemProcessBufferDumpResponse(org.graylog2.rest.models.system.responses.SystemProcessBufferDumpResponse) Path(javax.ws.rs.Path) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)3 ApiOperation (io.swagger.annotations.ApiOperation)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 WebApplicationException (javax.ws.rs.WebApplicationException)3 Node (org.graylog2.cluster.Node)3 RemoteSystemResource (org.graylog2.shared.rest.resources.system.RemoteSystemResource)3 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)2 SystemJVMResponse (org.graylog2.rest.models.system.responses.SystemJVMResponse)1 SystemProcessBufferDumpResponse (org.graylog2.rest.models.system.responses.SystemProcessBufferDumpResponse)1 SystemThreadDumpResponse (org.graylog2.rest.models.system.responses.SystemThreadDumpResponse)1