Search in sources :

Example 1 with ClusterHealth

use of org.graylog2.rest.models.system.indexer.responses.ClusterHealth in project graylog2-server by Graylog2.

the class IndexerClusterResource method clusterHealth.

@GET
@Timed
@Path("/health")
@ApiOperation(value = "Get cluster and shard health overview")
@RequiresPermissions(RestPermissions.INDEXERCLUSTER_READ)
@Produces(MediaType.APPLICATION_JSON)
public ClusterHealth clusterHealth() {
    final ClusterHealthResponse health = cluster.health();
    final ClusterHealth.ShardStatus shards = ClusterHealth.ShardStatus.create(health.getActiveShards(), health.getInitializingShards(), health.getRelocatingShards(), health.getUnassignedShards());
    return ClusterHealth.create(health.getStatus().toString().toLowerCase(Locale.ENGLISH), shards);
}
Also used : ClusterHealthResponse(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse) ClusterHealth(org.graylog2.rest.models.system.indexer.responses.ClusterHealth) Path(javax.ws.rs.Path) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)1 ClusterHealthResponse (org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse)1 ClusterHealth (org.graylog2.rest.models.system.indexer.responses.ClusterHealth)1