Add cumulated VM Resources to Cluster view #7329

Closed
opened 2025-12-29 20:21:57 +01:00 by adam · 7 comments
Owner

Originally created by @basti1508 on GitHub (Dec 7, 2022).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.3.9

Feature type

New functionality

Proposed functionality

The cluster view should show a cumulated value for all assigned vm cpu/ram/disk.

Use case

This is especially helpful for cluster size planning and get a quick overview over all assigned resources.

Database changes

No response

External dependencies

No response

Originally created by @basti1508 on GitHub (Dec 7, 2022). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.3.9 ### Feature type New functionality ### Proposed functionality The cluster view should show a cumulated value for all assigned vm cpu/ram/disk. ### Use case This is especially helpful for cluster size planning and get a quick overview over all assigned resources. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 20:21:58 +01:00
adam closed this issue 2025-12-29 20:21:58 +01:00
Author
Owner

@stavr666 commented on GitHub (Dec 17, 2022):

In order for the developers not to come back to this several times, I would expand the request.
VMs already have base resource values:
image

It will be logical, that clusters also have same values as "resource pools" (similar to IP ranges/prefixes).
So, cluster view can show both available and assigned resources.

Devices also have CPU and RAM values, but I'd prefer them not be linked, since most of our "clusters" is either cloud resource pools or VMs with containers. So, they have defined resource limits, but have not devices to attach them.
Also, with "site requirement" limitations for clusters still in place, we can't attach devices to our physical clusters (since nodes located on different sites).

CPU cores and RAM amount for devices is our custom fields, sorry 😁

@stavr666 commented on GitHub (Dec 17, 2022): In order for the developers not to come back to this several times, I would expand the request. VMs already have base resource values: ![image](https://user-images.githubusercontent.com/84839985/208234693-65b0394b-3b26-47e0-b337-98208f992e3d.png) It will be logical, that clusters also have same values as "resource pools" (similar to IP ranges/prefixes). So, cluster view can show both available and assigned resources. ~~Devices also have CPU and RAM values, but I'd prefer them not be linked, since most of our "clusters" is either cloud resource pools or VMs with containers. So, they have defined resource limits, but have not devices to attach them. Also, with "site requirement" limitations for clusters still in place, we can't attach devices to our physical clusters (since nodes located on different sites).~~ CPU cores and RAM amount for devices is our custom fields, sorry 😁
Author
Owner

@kkthxbye-code commented on GitHub (Dec 19, 2022):

My PR implements the original accepted FR. stavr666's idea would need a new FR as it would require database migrations and API changes to add the new fields, which I don't believe we like to do in patch releases.

@kkthxbye-code commented on GitHub (Dec 19, 2022): My PR implements the original accepted FR. stavr666's idea would need a new FR as it would require database migrations and API changes to add the new fields, which I don't believe we like to do in patch releases.
Author
Owner

@stavr666 commented on GitHub (Dec 19, 2022):

stavr666's idea would need a new FR as it would require database migrations and API change

Sad, but I understand your resource limits.
You're doing great useful tool, keeping in place it's strong general concept 👌

@stavr666 commented on GitHub (Dec 19, 2022): > stavr666's idea would need a new FR as it would require database migrations and API change Sad, but I understand your resource limits. You're doing great useful tool, keeping in place it's strong general concept 👌
Author
Owner

@abhi1693 commented on GitHub (Dec 19, 2022):

@kkthxbye-code I saw your PR, but is it possible to ensure that the units use the biggest string, when a value crosses the boundary of TB, it's displayed as 12 TB instead of 12288 GB. It's easier to visualize the summary.

It'll also help to get this information on the API as raw values. I'm not sure if that would be considered a new FR.

@abhi1693 commented on GitHub (Dec 19, 2022): @kkthxbye-code I saw your PR, but is it possible to ensure that the units use the biggest string, when a value crosses the boundary of TB, it's displayed as 12 TB instead of 12288 GB. It's easier to visualize the summary. It'll also help to get this information on the API as raw values. I'm not sure if that would be considered a new FR.
Author
Owner

@jeremystretch commented on GitHub (Dec 22, 2022):

is it possible to ensure that the units use the biggest string, when a value crosses the boundary of TB, it's displayed as 12 TB instead of 12288 GB

@kkthxbye-code maybe we should modify or replicate the humanize_megabytes() template filter to work with GB as the base unit to facilitate this?

It'll also help to get this information on the API as raw values. I'm not sure if that would be considered a new FR.

Any new additions to the REST API would need to be assigned to a future minor release (e.g. v3.5), so you can open a separate FR for the API portion of the work or we can just postpone this FR until v3.5.

@jeremystretch commented on GitHub (Dec 22, 2022): > is it possible to ensure that the units use the biggest string, when a value crosses the boundary of TB, it's displayed as 12 TB instead of 12288 GB @kkthxbye-code maybe we should modify or replicate the `humanize_megabytes()` template filter to work with GB as the base unit to facilitate this? > It'll also help to get this information on the API as raw values. I'm not sure if that would be considered a new FR. Any new additions to the REST API would need to be assigned to a future minor release (e.g. v3.5), so you can open a separate FR for the API portion of the work or we can just postpone this FR until v3.5.
Author
Owner

@jeremystretch commented on GitHub (Dec 27, 2022):

Figured we can tackle this when we take a closer look at modeling disks for VMs in the future.

@jeremystretch commented on GitHub (Dec 27, 2022): Figured we can tackle this when we take a closer look at modeling disks for VMs in the future.
Author
Owner

@fixed77 commented on GitHub (Dec 28, 2022):

I writed Export Template for Virtual Machines. It calculate all used resources of cluster.

{% for cluster, items in queryset|groupby("cluster.name")|sort %}
================ HW: {{ cluster|center(30) }} ===============|CPUs| RAM(Mb) |Disk(Gb)

    {% for vm in items %}{{ vm.name|center(60) }}   {{ vm.vcpus|center(5) }}   {{ vm.memory|center(5) }}     {{ vm.disk|center(4) }}
    {% endfor %}
-------------------------------------------------------------------------------------------
Summary (all VMs):                                                 {{ items | sum(attribute='vcpus')|center(5) }}   {{ items | sum(attribute='memory')|center(6) }}    {{ items | sum(attribute='disk')|center(4) }}
Summary (active VMs only):                                         {{ items | selectattr("status", "eq", "active") | sum(attribute='vcpus')|center(5) }}   {{ items | selectattr("status", "eq", "active") | sum(attribute='memory')|center(6) }}    {{ items | selectattr("status", "eq", "active") | sum(attribute='disk')|center(4) }}


{% endfor %}

image

@fixed77 commented on GitHub (Dec 28, 2022): I writed Export Template for Virtual Machines. It calculate all used resources of cluster. ``` {% for cluster, items in queryset|groupby("cluster.name")|sort %} ================ HW: {{ cluster|center(30) }} ===============|CPUs| RAM(Mb) |Disk(Gb) {% for vm in items %}{{ vm.name|center(60) }} {{ vm.vcpus|center(5) }} {{ vm.memory|center(5) }} {{ vm.disk|center(4) }} {% endfor %} ------------------------------------------------------------------------------------------- Summary (all VMs): {{ items | sum(attribute='vcpus')|center(5) }} {{ items | sum(attribute='memory')|center(6) }} {{ items | sum(attribute='disk')|center(4) }} Summary (active VMs only): {{ items | selectattr("status", "eq", "active") | sum(attribute='vcpus')|center(5) }} {{ items | selectattr("status", "eq", "active") | sum(attribute='memory')|center(6) }} {{ items | selectattr("status", "eq", "active") | sum(attribute='disk')|center(4) }} {% endfor %} ``` ![image](https://user-images.githubusercontent.com/8656458/209767860-7975c865-54c5-48f5-b9e2-4659f00f723f.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7329