Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disk space percentage to node listing #42145

Merged
merged 11 commits into from
Aug 3, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function NodeDetailStatus({ stats }) {
transport_address: transportAddress,
usedHeap,
freeSpace,
totalSpace,
documents,
dataSize,
indexCount,
Expand All @@ -24,6 +25,8 @@ export function NodeDetailStatus({ stats }) {
isOnline,
} = stats;

const percentSpaceUsed = (freeSpace / totalSpace) * 100;

const metrics = [
{
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.transportAddress', {
Expand All @@ -45,9 +48,9 @@ export function NodeDetailStatus({ stats }) {
},
{
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.freeDiskSpaceLabel', {
defaultMessage: 'Free Disk Space'
defaultMessage: 'Free Disk Space',
}),
value: formatMetric(freeSpace, '0.0 b'),
value: formatMetric(freeSpace, '0.0 b') + ' (' + formatMetric(percentSpaceUsed, '0,0.[00]', '%', { prependSpace: false }) + ')',
'data-test-subj': 'freeDiskSpace'
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
documents: undefined,
dataSize: undefined,
freeSpace: undefined,
totalSpace: undefined,
usedHeap: undefined,
nodeTypeLabel: 'Node',
nodeTypeClass: 'fa-server',
Expand Down Expand Up @@ -108,7 +109,8 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
},
fs: {
total: {
available_in_bytes: 8700
available_in_bytes: 8700,
total_in_bytes: 10000
}
},
jvm: {
Expand All @@ -135,6 +137,7 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
documents: 11000,
dataSize: 35000,
freeSpace: 8700,
totalSpace: 10000,
usedHeap: 33,
nodeTypeLabel: 'Master Node',
nodeTypeClass: 'fa-star',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function handleResponse(clusterState, shardStats, nodeUuid) {
documents: get(sourceStats, 'indices.docs.count'),
dataSize: get(sourceStats, 'indices.store.size_in_bytes'),
freeSpace: get(sourceStats, 'fs.total.available_in_bytes'),
totalSpace: get(sourceStats, 'fs.total.total_in_bytes'),
usedHeap: get(sourceStats, 'jvm.mem.heap_used_percent'),
status: i18n.translate('xpack.monitoring.es.nodes.onlineStatusLabel', {
defaultMessage: 'Online' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"documents": 24830,
"dataSize": 52847579,
"freeSpace": 186755088384,
"totalSpace": 499065712640,
"usedHeap": 29,
"status": "Online",
"isOnline": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9300',
jvmHeap: 'JVM Heap\n29%',
freeDiskSpace: 'Free Disk Space\n173.9 GB',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n24.8k',
dataSize: 'Data\n50.4 MB',
indicesCount: 'Indices\n20',
Expand All @@ -58,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9302',
jvmHeap: 'JVM Heap\n17%',
freeDiskSpace: 'Free Disk Space\n173.9 GB',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n240',
dataSize: 'Data\n1.4 MB',
indicesCount: 'Indices\n4',
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9302',
jvmHeap: 'JVM Heap\nN/A',
freeDiskSpace: 'Free Disk Space\nN/A',
freeDiskSpace: 'Free Disk Space\nN/A (N/A)',
documentCount: 'Documents\nN/A',
dataSize: 'Data\nN/A',
indicesCount: 'Indices\nN/A',
Expand Down