From f78a6b79f932f855022b86e1c858caa93faf7585 Mon Sep 17 00:00:00 2001 From: hirzidevs Date: Fri, 13 Sep 2024 08:43:09 +0700 Subject: [PATCH] feat(nodes): add server counter and set allocations as max servers --- config.yml | 3 ++- index.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.yml b/config.yml index 2eafae2..ac6d947 100644 --- a/config.yml +++ b/config.yml @@ -68,7 +68,8 @@ status: nodes_settings: blacklist: [] # Add node IDs to exclude them from the status embed (e.g., blacklist: [1]). details: true # Show node details such as memory and disk usage (true/false). - servers: true # Show server details (true/false). + servers: false # Show server details (true/false). + allocations_as_max_servers: false # Show allocations as max servers (true/false). unit: "byte" # Unit for node usage, Available types: "byte" or "percentage". limit: 100 # Node limit for usage statistics display. diff --git a/index.js b/index.js index 8e34b1a..dc92355 100644 --- a/index.js +++ b/index.js @@ -130,9 +130,10 @@ async function createMessage({ cache, panel, nodes, servers, users }) { name: `${node.attributes.name} - ${node.status ? config.status.online : config.status.offline}`, 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)}` + - (node.attributes?.allocated_resources?.cpu ? `\nCPU : ${node.attributes?.allocated_resources?.cpu || 0}%` : "") + + `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)}` + + (node.attributes?.allocated_resources?.cpu ? `\nCPU : ${node.attributes?.allocated_resources?.cpu || 0}%` : "") + + (config.nodes_settings.servers ? `\nServers: ${node.attributes.relationships.servers}${config.nodes_settings.allocations_as_max_servers ? ` / ${node.attributes.relationships.allocations}` : ""}` : "") + "```" }); });