Skip to content

Commit

Permalink
Checking that attribute retreived by wmi_property is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
John Zeller committed Jul 31, 2015
1 parent 160df9e commit 23c0339
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion checks.d/wmi_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ def _extract_metrics(self, results, metrics, tag_by, wmi, tag_queries, constant_
# Special-case metric will just submit 1 for every value
# returned in the result.
val = 1
else:
elif getattr(res, wmi_property):
val = float(getattr(res, wmi_property))
else:
self.log.warning("When extracting metrics with wmi, found a null value for property '{0}'. "
"Metric type of property is {1}."
.format(wmi_property, mtype))

try:
func = getattr(self, mtype)
Expand Down

0 comments on commit 23c0339

Please sign in to comment.