@@ -117,7 +117,8 @@ Table getTableWithHeader(final RestRequest request) {
117
117
table .addCell ("shards" , "text-align:right;desc:number of shards on node" );
118
118
table .addCell ("diskUsed" , "text-align:right;desc:disk used (total, not just ES)" );
119
119
table .addCell ("diskAvail" , "text-align:right;desc:disk available" );
120
- table .addCell ("diskRatio" , "text-align:right;desc:percent disk used" );
120
+ table .addCell ("diskTotal" , "text-align:right;desc:total capacity of all volumes" );
121
+ table .addCell ("diskPercent" , "text-align:right;desc:percent disk used" );
121
122
table .addCell ("host" , "desc:host of node" );
122
123
table .addCell ("ip" , "desc:ip of node" );
123
124
table .addCell ("node" , "desc:name of node" );
@@ -143,34 +144,25 @@ private Table buildTable(RestRequest request, final ClusterStateResponse state,
143
144
for (NodeStats nodeStats : stats .getNodes ()) {
144
145
DiscoveryNode node = nodeStats .getNode ();
145
146
146
- long used = -1 ;
147
- long avail = -1 ;
148
-
149
- Iterator <FsStats .Info > diskIter = nodeStats .getFs ().iterator ();
150
- while (diskIter .hasNext ()) {
151
- FsStats .Info disk = diskIter .next ();
152
- used += disk .getTotal ().bytes () - disk .getAvailable ().bytes ();
153
- avail += disk .getAvailable ().bytes ();
154
- }
155
-
156
- String nodeId = node .id ();
157
-
158
147
int shardCount = -1 ;
159
- if (allocs .containsKey (nodeId )) {
148
+ if (allocs .containsKey (node . id () )) {
160
149
shardCount = allocs .lget ();
161
150
}
162
151
163
- float ratio = -1 ;
152
+ long used = nodeStats .getFs ().getTotal ().getTotal ().bytes () - nodeStats .getFs ().getTotal ().getAvailable ().bytes ();
153
+ long avail = nodeStats .getFs ().getTotal ().getAvailable ().bytes ();
164
154
155
+ short diskPercent = -1 ;
165
156
if (used >= 0 && avail > 0 ) {
166
- ratio = used / (float ) avail ;
157
+ diskPercent = ( short ) ( used * 100 / (used + avail )) ;
167
158
}
168
159
169
160
table .startRow ();
170
161
table .addCell (shardCount < 0 ? null : shardCount );
171
162
table .addCell (used < 0 ? null : new ByteSizeValue (used ));
172
163
table .addCell (avail < 0 ? null : new ByteSizeValue (avail ));
173
- table .addCell (ratio < 0 ? null : String .format (Locale .ROOT , "%.1f%%" , ratio * 100.0 ));
164
+ table .addCell (nodeStats .getFs ().getTotal ().getTotal ());
165
+ table .addCell (diskPercent < 0 ? null : diskPercent );
174
166
table .addCell (node == null ? null : node .getHostName ());
175
167
table .addCell (node == null ? null : node .getHostAddress ());
176
168
table .addCell (node == null ? "UNASSIGNED" : node .name ());
@@ -185,6 +177,7 @@ private Table buildTable(RestRequest request, final ClusterStateResponse state,
185
177
table .addCell (null );
186
178
table .addCell (null );
187
179
table .addCell (null );
180
+ table .addCell (null );
188
181
table .addCell ("UNASSIGNED" );
189
182
table .endRow ();
190
183
}
0 commit comments