File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1097,14 +1097,17 @@ process.stdin.on('end', () => {
10971097 }
10981098
10991099 // Indices Size from KB to GB
1100- const openSearchIndicesSize = infoData [ 14 ] . reduce ( ( sum , openSearchIndex ) => sum + ( openSearchIndex [ "store.size" ] - 0 ) , 0 ) / 1000 / 1000 ;
1100+ let openSearchIndicesSize = infoData [ 14 ] . reduce ( ( sum , openSearchIndex ) => sum + ( openSearchIndex [ "store.size" ] - 0 ) , 0 ) / 1000 / 1000 ;
1101+ // Math.round only rounds to the nearest integer, so we multiply by 100 before rounding to get 2 decimal places
1102+ // Number.EPSILON is here so numbers like 1.005 get rounded correctly.
1103+ openSearchIndicesSize = Math . round ( ( openSearchIndicesSize + Number . EPSILON ) * 100 ) / 100
11011104
11021105 result . opensearch = { } ;
11031106 result . opensearch . status = { } ;
11041107 result . opensearch . status . fs = { } ;
11051108 result . opensearch . status . fs . status = openSearchWatermarkStatus ;
11061109 result . opensearch . status . fs . percent = usedDiskInPercent ;
1107- result . opensearch . status . fs . size = openSearchIndicesSize ;
1110+ result . opensearch . status . fs . size = openSearchIndicesSize + 'GB' ;
11081111 result . opensearch . status . health = openSearchClusterHealth ;
11091112
11101113 if ( statusMessages . length > 0 ) {
You can’t perform that action at this time.
0 commit comments