From 2d5c1965ec21ee6afc1d9ff3063bea3ca93bd99d Mon Sep 17 00:00:00 2001 From: Daniel Pryor Date: Wed, 9 Jun 2021 23:43:17 -0600 Subject: [PATCH] fix(fixing_sensor): Fix for badly behaving super-micro sensor #271 Precommit-Verified: a3bc138f5493dbb0bd4e76ec78f24b7019e999c367eb7874a1a56ec62bc8bc31 Co-authored-by: @Z903 --- vmware_exporter/vmware_exporter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vmware_exporter/vmware_exporter.py b/vmware_exporter/vmware_exporter.py index b15fc42..704c5b7 100755 --- a/vmware_exporter/vmware_exporter.py +++ b/vmware_exporter/vmware_exporter.py @@ -1695,7 +1695,10 @@ def _vmware_get_hosts(self, host_metrics): sensors = [s for s in sensors if ':' in s] for s in sensors: - sensor = dict(item.split("=") for item in s.split(":")[1:]) + sensor = dict(item.split("=") for item in re.split(r':(?=\w+=)', s)[1:]) + + if not all(key in sensor for key in ['sensorStatus', 'name', 'type', 'unit', 'value']): + continue sensor_status = { 'red': 0,