Rack power usage not showing #3849

Closed
opened 2025-12-29 18:31:35 +01:00 by adam · 3 comments
Owner

Originally created by @fe-franco on GitHub (Jul 9, 2020).

Environment

  • Python version: 3.7.7
  • NetBox version: v2.8.6

Steps to Reproduce

  1. Create Power Panel

  2. Create Rack

  3. Create Power Feed and add to Rack
    a. Power Feed configuration:
    -Supply: AC
    -Voltage: 220V
    -Amperage: 10A
    -Phase: Single phase
    -Max Utilization: 80%

  4. Create Device, add Power Port to the device
    a. Power Port configuration:
    -Type: C14
    -Max. Draw: 1000
    -Alloc. Draw: 500

  5. Connect Power Port to Power Feed

Expected Behavior

Total Power Usage show on "Racks" View

Observed Behavior

Power Usage Blank in "Racks view"
image

Originally created by @fe-franco on GitHub (Jul 9, 2020). ### **Environment** * Python version: 3.7.7 * NetBox version: v2.8.6 ### **Steps to Reproduce** 1. Create Power Panel 2. Create Rack 3. Create Power Feed and add to Rack a. Power Feed configuration: -Supply: AC -Voltage: 220V -Amperage: 10A -Phase: Single phase -Max Utilization: 80% 4. Create Device, add Power Port to the device a. Power Port configuration: -Type: C14 -Max. Draw: 1000 -Alloc. Draw: 500 5. Connect Power Port to Power Feed ### **Expected Behavior** Total Power Usage show on "Racks" View ### **Observed Behavior** Power Usage Blank in "Racks view" ![image](https://user-images.githubusercontent.com/67972456/87054957-1bb37b00-c1da-11ea-897e-81bf7e7c5901.png)
adam added the type: bugstatus: accepted labels 2025-12-29 18:31:35 +01:00
adam closed this issue 2025-12-29 18:31:35 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 10, 2020):

This doesn't show any utilization because power utilization for a rack is currently derived from the sum of all power ports connected to power outlets within the rack:

def get_power_utilization(self):
    """
    Determine the utilization rate of power in the rack and return it as a percentage.
    """
    power_stats = PowerFeed.objects.filter(
        rack=self
    ).annotate(
        allocated_draw_total=Sum('connected_endpoint__poweroutlets__connected_endpoint__allocated_draw'),
    ).values(
        'allocated_draw_total',
        'available_power'
    )

    if power_stats:
        allocated_draw_total = sum(x['allocated_draw_total'] for x in power_stats)
        available_power_total = sum(x['available_power'] for x in power_stats)
        return int(allocated_draw_total / available_power_total * 100) or 0
    return 0

This intends to mimic the typical use of PDU devices to distribute power within a rack. There is a minor bug preventing the graph from rendering as "0%", but otherwise this is expected.

If you would like to propose an alternate approach for calculating rack power, please open a feature request detailing the proposed strategy.

@jeremystretch commented on GitHub (Jul 10, 2020): This doesn't show any utilization because power utilization for a rack is currently derived from the sum of all power ports connected to power outlets within the rack: ```python def get_power_utilization(self): """ Determine the utilization rate of power in the rack and return it as a percentage. """ power_stats = PowerFeed.objects.filter( rack=self ).annotate( allocated_draw_total=Sum('connected_endpoint__poweroutlets__connected_endpoint__allocated_draw'), ).values( 'allocated_draw_total', 'available_power' ) if power_stats: allocated_draw_total = sum(x['allocated_draw_total'] for x in power_stats) available_power_total = sum(x['available_power'] for x in power_stats) return int(allocated_draw_total / available_power_total * 100) or 0 return 0 ``` This intends to mimic the typical use of PDU devices to distribute power within a rack. There is a minor bug preventing the graph from rendering as "0%", but otherwise this is expected. If you would like to propose an alternate approach for calculating rack power, please open a feature request detailing the proposed strategy.
Author
Owner

@abanta1 commented on GitHub (Jul 10, 2020):

I'm having the same issue, but my configuration is a little different:

Environment

  • Netbox 2.8.7
  • Python 3.8.2

Steps to Reproduce

  1. Create Power Panel
  2. Create Rack
  3. Create Power Feed, attach to rack
    a. Power Feed Config
    • AC
    • 120V
    • 20A
    • Single Phase
    • Max 80%
  4. Create Device (PDU), add Power Port, Outlet to the device, assign Outlet to Port
    a. Power Port configuration:
    • Type: L5-20P
    • Max. Draw: 2400
    • Alloc. Draw: "empty"
      b. Power Outlet configuration:
    • Type: 5-20R
  5. Create Device (Switch), add Power Port to PDU Outlet
    a Power Port configuration
    • Type: 5-20P
    • Max Draw: 700
    • Allocated Draw: 500

When viewing PDU Device, Utilization shows 0%
When viewing Power Feed, Utilization shows 0%
When viewing Individual Rack, Utilization shows 0%
When viewing All Racks, Utilization doesn't show (per bug you previously mentioned)

If I manually specify the PDU Device draw, utilization does correctly report on all views, except for the "All Racks" view which still shows nothing under the power utilization graph.

This seems counter-intuitive to me as the normally a device is what draws the power and all calculations should be dynamically calculated based on which devices are connected, not manually specified on the PDU, thus ignoring device power specifications.

I previously looked int Issue #3377, but that issue references another intermediary device not present in this configuration.

@abanta1 commented on GitHub (Jul 10, 2020): I'm having the same issue, but my configuration is a little different: **Environment** - Netbox 2.8.7 - Python 3.8.2 **Steps to Reproduce** 1. Create Power Panel 2. Create Rack 3. Create Power Feed, attach to rack a. Power Feed Config - AC - 120V - 20A - Single Phase - Max 80% 4. Create Device (PDU), add Power Port, Outlet to the device, assign Outlet to Port a. Power Port configuration: - Type: L5-20P - Max. Draw: 2400 - Alloc. Draw: "empty" b. Power Outlet configuration: - Type: 5-20R 5. Create Device (Switch), add Power Port to PDU Outlet a Power Port configuration - Type: 5-20P - Max Draw: 700 - Allocated Draw: 500 When viewing PDU Device, Utilization shows 0% When viewing Power Feed, Utilization shows 0% When viewing Individual Rack, Utilization shows 0% When viewing All Racks, Utilization doesn't show (per bug you previously mentioned) If I manually specify the PDU Device draw, utilization does correctly report on all views, except for the "All Racks" view which still shows nothing under the power utilization graph. This seems counter-intuitive to me as the normally a device is what draws the power and all calculations should be dynamically calculated based on which devices are connected, not manually specified on the PDU, thus ignoring device power specifications. I previously looked int Issue #3377, but that issue references another intermediary device not present in this configuration.
Author
Owner

@RHuehne commented on GitHub (Jul 11, 2020):

Hi There

Sorry, might be a stupid question, but is there any way to find out, if or when this bug is being fixed (if so, for which release would it be planned) ?

I am not a developer, and might not know the "communication standards" here - but my first post was just closed as duplicate. In the "duplicate" post, I was asking if the problem will be focused by the developers, and the post was just closed again commentlessly with a link to this post here, but I cannot find the answer to my question.

I can imagine, for any moderator in here, it can be frustrating to answer the same and same again, but I on the other hand would just like to get the information, and have no idea where to get it from. I have no intention to rise any pressure.

Thank you in advance, for leaving a short answer before closing this again.

@RHuehne commented on GitHub (Jul 11, 2020): Hi There Sorry, might be a stupid question, but is there any way to find out, if or when this bug is being fixed (if so, for which release would it be planned) ? I am not a developer, and might not know the "communication standards" here - but my [first post ](https://github.com/netbox-community/netbox/issues/4815) was just closed as duplicate. In the "duplicate" post, I was asking if the problem will be focused by the developers, and the post was just closed again commentlessly with a link to this post here, but I cannot find the answer to my question. I can imagine, for any moderator in here, it can be frustrating to answer the same and same again, but I on the other hand would just like to get the information, and have no idea where to get it from. I have no intention to rise any pressure. Thank you in advance, for leaving a short answer before closing this again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3849