<p>I'm running multiple clusters of Kubernetes in GKE. I'm using a heapster + influxdb to get metrics on pods performances.
What is the recommended way to get and store cluster wide metrics like:</p>

<ul>
<li>number of pods in namespace</li>
<li>total memory requested/limits per namespace</li>
<li>total cpu requested/limits per namespace</li>
<li>total memory requested/limits per node</li>
<li>total cpu requested/limits per node</li>
<li>number of pod per state (running, pending, etc)</li>
</ul>

<p>AFAIK this is out of the scope of heapster but we need to keep an eye on this to understand the state of the cluster.  </p>

<p>Thanks!</p>

<p>4 of the metrics you mentioned can be visualized using Grafana, if you create custom dashboards and make good use of Grafana templates:</p>

<ul>
<li>total memory requested/limits per namespace</li>
<li>total cpu requested/limits per namespace</li>
</ul>

<p>Sort by "pod_namespace" and aggregate by "cpu/usage" or "cpu/limit" or "cpu/request"</p>

<ul>
<li>total memory requested/limits per node</li>
<li>total cpu requested/limits per node</li>
</ul>

<p>Sort by "hostname" and aggregate by "memory/limit" or "memory/request" or "cpu/usage" or "cpu/limit" or "cpu/request"</p>

<p>See: Heapster <a href="https://github.com/kubernetes/heapster/blob/master/docs/storage-schema.md" rel="nofollow">storage schema 
</a>. As soon as you understand the InfluxDB schema you can do magic.</p>

<p>The other 2 are not collected by Heapster, it means you have to come up with you own queries on the Kubernetes API if you want to push that data somewhere, probably also InfluxDB in your case.</p>
