From 8e9f9bcb893c05c6d966b0ca03d30689d2f0ba2c Mon Sep 17 00:00:00 2001 From: hirzidevs Date: Tue, 10 Sep 2024 05:12:55 +0700 Subject: [PATCH] fix: node cpu stats --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fee8e13..ba18c82 100644 --- a/index.js +++ b/index.js @@ -104,8 +104,8 @@ async function createMessage({ cache, panel, nodes, servers, users }) { value: "```\n" + `Memory: ${convertUnits(node.attributes.allocated_resources.memory, node.attributes.memory, config.nodes_settings.unit)}\n` + - `Disk : ${convertUnits(node.attributes.allocated_resources.disk, node.attributes.disk, config.nodes_settings.unit)}\n` + - `CPU : ${Math.floor(node.attributes.cpu / node.attributes.allocated_resources.cpu * 100) || 0}%` + + `Disk : ${convertUnits(node.attributes.allocated_resources.disk, node.attributes.disk, config.nodes_settings.unit)}` + + (node.attributes?.allocated_resources?.cpu ? `\nCPU : ${node.attributes?.allocated_resources?.cpu || 0}%` : "") + "```" }); });