Commit d53a5983 by Chif Gergő

Added default value to CPU usage and memory usage

If the monitor info can't get the values, the values get default 0.
parent aa92a44d
......@@ -366,12 +366,18 @@ class Node(OperatedMixin, TimeStampedModel):
@property
@node_available
def cpu_usage(self):
if self.monitor_info.get('cpu.percent') is not None:
return self.monitor_info.get('cpu.percent') / 100
else:
return 0
@property
@node_available
def ram_usage(self):
if self.monitor_info.get('memory.usage') is not None:
return self.monitor_info.get('memory.usage') / 100
else:
return 0
@property
@node_available
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment