[PR #3262] [MERGED] #524 - Added power utilization graphs to power feeds, devices, and racks #12534

Closed
opened 2025-12-29 22:22:07 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3262
Author: @lampwins
Created: 6/16/2019
Status: Merged
Merged: 6/17/2019
Merged by: @jeremystretch

Base: develop-2.6Head: feature/524-power-utilization-graphs


📝 Commits (1)

  • 2eeffce #524 - Added power utilization graphs to power feeds, devices, and racks

📊 Changes

7 files changed (+102 additions, -8 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
netbox/dcim/migrations/0074_powerfeed_available_power_cache.py (+18 -0)
📝 netbox/dcim/models.py (+51 -7)
📝 netbox/dcim/tables.py (+2 -1)
📝 netbox/templates/dcim/device.html (+2 -0)
📝 netbox/templates/dcim/powerfeed.html (+23 -0)
📝 netbox/templates/dcim/rack.html (+2 -0)

📄 Description

Fixes: #524

As promised, this implements simple power utilization graphs on the power feed, device, and rack detail views. It also adds a total power utilization graph to the rack list table. This is akin to the rack space utilization graph.

To pull this off, I added a couple of helpers to the power models and also converted the available_power property on power feed to an actual DB field (new migration). This acts as a cached value due to the complexity needed to calculate the value in a queryset (because of single phase vs 3 phase). This is achieved by overriding the save() method to calculate the value, set it, and then call super.

Let me know if I missed anything, or overlooked any power related magic.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/3262 **Author:** [@lampwins](https://github.com/lampwins) **Created:** 6/16/2019 **Status:** ✅ Merged **Merged:** 6/17/2019 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.6` ← **Head:** `feature/524-power-utilization-graphs` --- ### 📝 Commits (1) - [`2eeffce`](https://github.com/netbox-community/netbox/commit/2eeffce924321b635e7c0270691b45fa871bc433) #524 - Added power utilization graphs to power feeds, devices, and racks ### 📊 Changes **7 files changed** (+102 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) ➕ `netbox/dcim/migrations/0074_powerfeed_available_power_cache.py` (+18 -0) 📝 `netbox/dcim/models.py` (+51 -7) 📝 `netbox/dcim/tables.py` (+2 -1) 📝 `netbox/templates/dcim/device.html` (+2 -0) 📝 `netbox/templates/dcim/powerfeed.html` (+23 -0) 📝 `netbox/templates/dcim/rack.html` (+2 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ACCEPTED BUG REPORT OR FEATURE REQUEST, IT WILL BE MARKED AS INVALID AND CLOSED. --> ### Fixes: #524 As promised, this implements simple power utilization graphs on the power feed, device, and rack detail views. It also adds a total power utilization graph to the rack list table. This is akin to the rack space utilization graph. To pull this off, I added a couple of helpers to the power models and also converted the `available_power` property on power feed to an actual DB field (new migration). This acts as a cached value due to the complexity needed to calculate the value in a queryset (because of single phase vs 3 phase). This is achieved by overriding the `save()` method to calculate the value, set it, and then call super. Let me know if I missed anything, or overlooked any power related magic. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:22:07 +01:00
adam closed this issue 2025-12-29 22:22:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12534