mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 21:38:15 +00:00
Adds disk used by indices to _cat/allocation
Sets Store flag on request
This commit is contained in:
parent
edac9c17fa
commit
03c6e8e1cb
@ -26,6 +26,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
|||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||||
|
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
@ -68,7 +69,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
|||||||
@Override
|
@Override
|
||||||
public void processResponse(final ClusterStateResponse state) {
|
public void processResponse(final ClusterStateResponse state) {
|
||||||
NodesStatsRequest statsRequest = new NodesStatsRequest(nodes);
|
NodesStatsRequest statsRequest = new NodesStatsRequest(nodes);
|
||||||
statsRequest.clear().fs(true);
|
statsRequest.clear().fs(true).indices(new CommonStatsFlags(CommonStatsFlags.Flag.Store));
|
||||||
|
|
||||||
client.admin().cluster().nodesStats(statsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
|
client.admin().cluster().nodesStats(statsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
@ -87,6 +88,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
|||||||
final Table table = new Table();
|
final Table table = new Table();
|
||||||
table.startHeaders();
|
table.startHeaders();
|
||||||
table.addCell("shards", "alias:s;text-align:right;desc:number of shards on node");
|
table.addCell("shards", "alias:s;text-align:right;desc:number of shards on node");
|
||||||
|
table.addCell("disk.indices", "alias:di,diskIndices;text-align:right;desc:disk used by ES indices");
|
||||||
table.addCell("disk.used", "alias:du,diskUsed;text-align:right;desc:disk used (total, not just ES)");
|
table.addCell("disk.used", "alias:du,diskUsed;text-align:right;desc:disk used (total, not just ES)");
|
||||||
table.addCell("disk.avail", "alias:da,diskAvail;text-align:right;desc:disk available");
|
table.addCell("disk.avail", "alias:da,diskAvail;text-align:right;desc:disk available");
|
||||||
table.addCell("disk.total", "alias:dt,diskTotal;text-align:right;desc:total capacity of all volumes");
|
table.addCell("disk.total", "alias:dt,diskTotal;text-align:right;desc:total capacity of all volumes");
|
||||||
@ -132,6 +134,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
|||||||
|
|
||||||
table.startRow();
|
table.startRow();
|
||||||
table.addCell(shardCount);
|
table.addCell(shardCount);
|
||||||
|
table.addCell(nodeStats.getIndices().getStore().getSize());
|
||||||
table.addCell(used < 0 ? null : new ByteSizeValue(used));
|
table.addCell(used < 0 ? null : new ByteSizeValue(used));
|
||||||
table.addCell(avail.bytes() < 0 ? null : avail);
|
table.addCell(avail.bytes() < 0 ? null : avail);
|
||||||
table.addCell(total.bytes() < 0 ? null : total);
|
table.addCell(total.bytes() < 0 ? null : total);
|
||||||
@ -152,6 +155,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
|||||||
table.addCell(null);
|
table.addCell(null);
|
||||||
table.addCell(null);
|
table.addCell(null);
|
||||||
table.addCell(null);
|
table.addCell(null);
|
||||||
|
table.addCell(null);
|
||||||
table.addCell(UNASSIGNED);
|
table.addCell(UNASSIGNED);
|
||||||
table.endRow();
|
table.endRow();
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,15 @@
|
|||||||
|
|
||||||
- match:
|
- match:
|
||||||
$body: |
|
$body: |
|
||||||
/^ shards .+ \n
|
/^ shards .+ \n
|
||||||
disk.used .+ \n
|
disk.indices .+ \n
|
||||||
disk.avail .+ \n
|
disk.used .+ \n
|
||||||
disk.total .+ \n
|
disk.avail .+ \n
|
||||||
disk.percent .+ \n
|
disk.total .+ \n
|
||||||
host .+ \n
|
disk.percent .+ \n
|
||||||
ip .+ \n
|
host .+ \n
|
||||||
node .+ \n
|
ip .+ \n
|
||||||
|
node .+ \n
|
||||||
$/
|
$/
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -26,6 +27,7 @@
|
|||||||
$body: |
|
$body: |
|
||||||
/^
|
/^
|
||||||
( 0 \s+
|
( 0 \s+
|
||||||
|
0b \s+
|
||||||
\d+(\.\d+)?[kmgt]?b \s+
|
\d+(\.\d+)?[kmgt]?b \s+
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
@ -56,6 +58,7 @@
|
|||||||
/^
|
/^
|
||||||
( \s* #allow leading spaces to account for right-justified text
|
( \s* #allow leading spaces to account for right-justified text
|
||||||
\d+ \s+
|
\d+ \s+
|
||||||
|
\d+(\.\d+)?b \s+
|
||||||
\d+(\.\d+)?[kmgt]?b \s+
|
\d+(\.\d+)?[kmgt]?b \s+
|
||||||
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
||||||
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
||||||
@ -84,6 +87,7 @@
|
|||||||
$body: |
|
$body: |
|
||||||
/^
|
/^
|
||||||
( 0 \s+
|
( 0 \s+
|
||||||
|
0b \s+
|
||||||
\d+(\.\d+)?[kmgt]?b \s+
|
\d+(\.\d+)?[kmgt]?b \s+
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
@ -117,6 +121,7 @@
|
|||||||
/^
|
/^
|
||||||
( \s* #allow leading spaces to account for right-justified text
|
( \s* #allow leading spaces to account for right-justified text
|
||||||
\d+ \s+
|
\d+ \s+
|
||||||
|
\d+(\.\d+)?b \s+
|
||||||
\d+(\.\d+)?[kmgt]?b \s+
|
\d+(\.\d+)?[kmgt]?b \s+
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
|
||||||
@ -144,6 +149,7 @@
|
|||||||
|
|
||||||
$body: |
|
$body: |
|
||||||
/^ shards \s+
|
/^ shards \s+
|
||||||
|
disk.indices \s+
|
||||||
disk.used \s+
|
disk.used \s+
|
||||||
disk.avail \s+
|
disk.avail \s+
|
||||||
disk.total \s+
|
disk.total \s+
|
||||||
@ -155,6 +161,7 @@
|
|||||||
|
|
||||||
( \s* #allow leading spaces to account for right-justified text
|
( \s* #allow leading spaces to account for right-justified text
|
||||||
0 \s+
|
0 \s+
|
||||||
|
0b \s+
|
||||||
\d+(\.\d+)?[kmgt]?b \s+
|
\d+(\.\d+)?[kmgt]?b \s+
|
||||||
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
||||||
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
(\d+(\.\d+)?[kmgt]b \s+) #always should return value since we filter out non data nodes by default
|
||||||
@ -214,6 +221,7 @@
|
|||||||
$body: |
|
$body: |
|
||||||
/^
|
/^
|
||||||
( 0 \s+
|
( 0 \s+
|
||||||
|
0 \s+
|
||||||
\d+ \s+
|
\d+ \s+
|
||||||
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
||||||
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
(\d+ \s+) #always should return value since we filter out non data nodes by default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user