+++ class = "post" date = "2017-02-10T01:35:38-05:00" tags = ["diy","homelab","buildlog"] title = "Build a Custom Power Monitoring PDU" description = "Building a custom power monitoring PDU for fun and profit" type = "post" weight = 1 draft = true +++ So you've got a homelab. It runs great, you've got dozens of VMs, and a spiffy storage cluster, and the hardware wasn't cheap. But, unless you live in Québec, you also probably care about another big cost sink: power usage. Here in Ontario I'm paying anywhere from 8¢ to 18¢ per kilowatt-hour (kWh) of energy, and with my rack totaling over 1600W normally, the power usage is substantial. The problem, however, is determining how much each device is using. Sure, the UPS can give me an overall power usage figure, but with 8 servers, 2 routers, 2 switches, and several other devices, knowing exactly how much each machine is using helps enable even more granular control of the power usage. The most obvious solution to this problem is what is usually referred to as a "Metered Per-Port PDU" in marketing-speak. Simply-put, it's a large power bar (Power Distribution Unit, for the acronym-unfriendly) that contains a network port and a series of current monitors on each port, allowing you to collect information about per-port power usage via SNMP or a WebUI. Most of the big PDU vendors make one of these devices (though with different names - marketing-speak, after all), however they are not cheap. The lowest cost on I could find was from Tripp-Lite at $1200 CAD new. That's a pretty penny to pay for power distribution, so instead, in my always-present DIY mindset, I started thinking about building my own. # The basics of power usage and monitoring # An AC monitoring circuit # Building the PDU # Building the monitoring circuits # The software side # Conclusion