feat(nodes): add server counter and set allocations as max servers

This commit is contained in:
hirzidevs
2024-09-13 08:43:09 +07:00
parent 8432533f43
commit f78a6b79f9
2 changed files with 6 additions and 4 deletions

View File

@@ -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.

View File

@@ -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}` : ""}` : "") +
"```"
});
});