Monitoring UPS battery health with NUT and Prometheus
A UPS is often treated as a black box: the rack has power until a test reveals otherwise. Battery ageing, repeated transfers, heat and poor ventilation can reduce reserve long before the unit reports a failure. Network UPS Tools (NUT) reads supported UPS models over USB, serial or SNMP and exposes their state as standard variables. Prometheus records those values over time, turning a maintenance surprise into an observable trend.
Australian installations add useful context. Mains power is nominally 230 V at 50 Hz, Type I outlets are standard, and summer heat, storms and bushfire-related grid disruptions affect cities and regional facilities differently. The aim is not a green or red badge; it is timely evidence that a battery can bridge the interval between a mains failure and generator start.
Separate battery problems from power events
Start by separating the failure domains. An OL status says the UPS is on line; it does not prove that the battery can carry a full load. Input voltage, output load, transfer state and battery condition can all tell different stories, so alerts must name the condition they represent rather than treating any non-standard status as a fault.
Useful NUT variables include battery charge, estimated runtime, battery voltage, temperature, input voltage and load percentage. Runtime is a calculated estimate based on present load and reported capacity, not a laboratory measurement of remaining life. A battery at 60 per cent charge may still be sound, while a bank at 40 per cent may be failing if its load has increased.
Keep that interpretation beside asset data: model, serial number, battery installation date, last test and supported runtime. This asset context is part of the wider systems administration context I document on my site: monitoring is useful only when it agrees with maintenance history and the physical site.
Connect NUT without exposing the UPS
Connect the UPS locally with USB or serial where practical; use SNMP for units with a network management card. NUT’s upsd service communicates with the hardware, and a maintained NUT exporter publishes the collected values for Prometheus. During setup, compare upsc ups-name@localhost with the vendor panel so label names and stale values are caught early.
Keep the exporter and NUT ports on a trusted management network. Bind them locally where possible, restrict ingress with host firewalls, use SNMP credentials appropriate to the device and never publish a UPS control interface to the internet. A read-only exporter is safer than allowing NUT variable writes, while local shutdown policy remains the responsibility of a tested upsmon configuration.
This pull model also scales predictably: each exporter performs a small local task and Prometheus aggregates it. It is the same locality-first pattern as the Redis caching layer described for high-traffic PHP sites, avoiding a central poller that must reach every rack during an outage.
Shape metrics that answer real questions
Exporter metric names differ, so confirm the contract before writing alerts. Illustrative PromQL might use battery_charge{job="nut"} < 20, battery_runtime{job="nut"} < 900 and up{job="nut"} == 0; runtime values are normally seconds. Recording rules can rename noisy vendor fields into stable site, rack and unit series before dashboards consume them.
Charge percentage is not state of health. Compare runtime at similar loads, watch decline after repeated transfers, and inspect voltage and temperature against the manufacturer’s limits. Avoid universal voltage thresholds because battery chemistry, bank size and whether the reading represents resting or loaded voltage change the valid range.
Basic NUT telemetry also may not expose cell balance, cycle count or internal resistance. Where the risk warrants it, add the manufacturer’s network card, battery-management telemetry or a periodic conductance test. PromQL then becomes trend evidence rather than a claim that one counter can diagnose every ageing cell.
Alert on outcomes, not noisy thresholds
Make critical alerts outcome-based. A critical page should mean that the available runtime is below the generator-start allowance, the UPS has failed while on battery, or a required target cannot be scraped. A warning can flag falling runtime, repeated transfers or reduced charge without waking someone at 3 a.m. for a condition with several hours of margin.
Set each warning and critical rule for a short duration so a transient self-test does not page. Route critical sites to a 24-hour roster and less urgent sites to business-hours notifications. Store timestamps in UTC, but label each target with its Australian location so rotas handle AEST and AEDT, ACST and ACDT, and AWST correctly.
Group related alerts during one mains event and inhibit downstream shutdown or escalation messages until the primary condition is understood. A generator-start event should create one timeline containing input loss, transfer, battery discharge, recovery and generator availability; separate pages for each symptom make diagnosis harder.
Build an Australian deployment that operators can own
Australian racks mix rack-mount, tower and network-card UPS models. Local electrical work should follow AS/NZS 3000, with Type I outlets covered by AS/NZS 3112 where applicable, and the contractor should verify earthing, load and RCD arrangements. Perth and Brisbane installations need particular attention to ambient heat and airflow, while storm, bushfire and grid events make Sydney, Melbourne and regional NSW or Queensland sites good places to test generator-start assumptions. Remote mines and hospitals may also have constrained WAN links. The Australian market includes Schneider Electric (APC), Eaton, Cyber Power and Vertiv products, so verify each model’s supported NUT driver rather than assuming protocol compatibility.
- Record every UPS in the asset register with its model, serial number, battery date, site, supported runtime and responsible team.
- Apply consistent
site,rackandupslabels, while keeping changing values such as status or firmware out of metric names. - Restrict management access, protect SNMP credentials and ensure the exporter cannot write configuration to the device.
- Establish a baseline under normal load and conduct controlled self-tests with facilities staff and the network operator present.
- Review runtime thresholds after generator tests, battery replacements and significant changes to rack load.
Make the checklist part of the facilities handover, not an IT side task. The facilities team should know what each warning means, which tests are safe to run, and who can replace batteries. That shared ownership reduces both false urgency and the risk that a green dashboard hides an ageing bank.
Run the monitoring as an operational service
Treat the pipeline as an operational service. Review runtime trends after every generator test and after major load changes, replace batteries according to measured condition and the manufacturer’s schedule, and keep NUT, exporter and firmware versions current. If operators already live in SharePoint, SharePoint view examples can guide a compact status board without replacing Prometheus as the source of truth.
Start with one UPS carrying a genuinely important load: install NUT, expose its exporter locally, capture a week of baseline readings under normal load, then add alerts for generator-start runtime and scrape failure. Prove the path with a coordinated test, assign the response owner, and expand the pattern only after the first unit behaves predictably.
Karl Katzke