Commit d40737d2 authored by Daniele Venzano's avatar Daniele Venzano

Expose more aggregated statistics about the whole platform

parent 2ba8a031
...@@ -147,8 +147,8 @@ ...@@ -147,8 +147,8 @@
<h3 class="section"><a name="platform">Platform</a></h3> <h3 class="section"><a name="platform">Platform</a></h3>
<ul> <ul>
<li>Total containers: {{ stats.platform_stats.container_count }}</li> <li>Total containers: {{ stats.platform_stats.container_count }}</li>
<li>Total memory: <script>format_bytes({{ stats.platform_stats.memory_total }}, 2) </script></li> <li>Memory: <script>format_bytes({{ stats.platform_stats.memory_total }}, 2)</script> total, <script>format_bytes({{ stats.platform_stats.memory_reserved }}, 2)</script> reserved, <script>format_bytes({{ stats.platform_stats.memory_in_use }}, 2)</script> in use</li>
<li>Total cores: {{ stats.platform_stats.cores_total }}</li> <li>Cores: {{ stats.platform_stats.cores_total }} total, {{ stats.platform_stats.cores_reserved }} reserved, {{ stats.platform_stats.cores_in_use }} in use</li>
</ul> </ul>
<div class="platform_node_detail"> <div class="platform_node_detail">
...@@ -80,6 +80,10 @@ class ClusterStats(Stats): ...@@ -80,6 +80,10 @@ class ClusterStats(Stats):
'container_count': self.container_count, 'container_count': self.container_count,
'memory_total': self.memory_total, 'memory_total': self.memory_total,
'cores_total': self.cores_total, 'cores_total': self.cores_total,
'memory_reserved': sum([n.memory_reserved for n in self.nodes]),
'cores_reserved': sum([n.cores_reserved for n in self.nodes]),
'memory_in_use': sum([n.memory_in_use for n in self.nodes]),
'cores_in_use': sum([n.cores_in_use for n in self.nodes]),
'nodes': [x.serialize() for x in self.nodes] 'nodes': [x.serialize() for x in self.nodes]
} }
...@@ -93,6 +97,26 @@ class ClusterStats(Stats): ...@@ -93,6 +97,26 @@ class ClusterStats(Stats):
"""Total number of cores installed.""" """Total number of cores installed."""
return sum([node.cores_total for node in self.nodes]) return sum([node.cores_total for node in self.nodes])
def memory_reserved(self) -> int:
"""Total memory reserved in the whole platform."""
return sum([node.memory_reserved for node in self.nodes])
def cores_reserved(self) -> int:
"""Total number of cores reserved."""
return sum([node.cores_reserved for node in self.nodes])
def memory_in_use(self) -> int:
"""Total memory in use in the whole platform."""
return sum([node.memory_in_use for node in self.nodes])
def cores_in_use(self) -> int:
"""Total number of cores in use."""
return sum([node.cores_in_use for node in self.nodes])
@property @property
def container_count(self) -> int: def container_count(self) -> int:
"""Total number of containers.""" """Total number of containers."""
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 to comment