From 28955612be4bbc2ca70c0b9e640c9f6c0c29338d Mon Sep 17 00:00:00 2001 From: "Anton A. Grishin" Date: Mon, 7 Sep 2020 15:20:32 +0300 Subject: [PATCH] fix allocated_draw for inactive PSU (#168) Co-authored-by: Anton Grishyn --- netbox_agent/power.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox_agent/power.py b/netbox_agent/power.py index 9e763a8..fcc1890 100644 --- a/netbox_agent/power.py +++ b/netbox_agent/power.py @@ -117,6 +117,9 @@ class PowerSupply(): for i, nb_psu in enumerate(nb_psus): nb_psu.allocated_draw = float(psu_cons[i]) * voltage + if nb_psu.allocated_draw < 1: + logging.info('PSU is not connected or in standby mode') + continue nb_psu.save() logging.info('Updated power consumption for PSU {}: {}W'.format( nb_psu.name,