Skip to content
Permalink
Browse files

ucs_c_rack_server_util: Minor fix

 * Remove wrong comment (check_levels can NOT deal with None)
 * only create items that actually contain valid data
 * for now ignore the potential KeyError if only *some* data is valid

Change-Id: I79e77f8e7b41a3c47e9dd869fd0778ad01895f3e
  • Loading branch information
mo-ki committed Jan 13, 2020
1 parent 4f0987f commit a0382686e0618954c59317f79d34d2ae57fef331
Showing with 5 additions and 5 deletions.
  1. +5 −5 checks/ucs_c_rack_server_util
@@ -50,15 +50,15 @@ def parse_ucs_c_rack_server_util(info):
rack = dn.replace("dn ", "").replace("sys/",
"").replace("rack-unit-",
"Rack unit ").replace("/utilization", "")
parsed.setdefault(rack, {})

for ds_key, ds in (('overallUtilization', overall_util), ('cpuUtilization', cpu_util),
('memoryUtilization', memory_util), ('ioUtilization', pci_io_util)):
try:
parsed[rack][ds_key] = float(ds.replace(ds_key + " ", ""))
value = float(ds.replace(ds_key + " ", ""))
except ValueError:
# The default value set by setdefault is None. These values are handled in the
# check function via check_levels() appropriatelly.
pass
continue
parsed.setdefault(rack, {})[ds_key] = value

return parsed


0 comments on commit a038268

Please sign in to comment.
You can’t perform that action at this time.