Just like CPU usage, memory usage is one of the key metrics used by development teams to monitor application health and optimize performance.
To visualize memory usage per pod, create a Time Series panel in Grafana and use the following PromQL query:
sum(container_memory_working_set_bytes{container!="",namespace=~"^$namespace$"}) by (pod)
How the Query Works
container_memory_working_set_bytes→ Returns the actual memory currently being used, excluding reclaimable cache.container!=""→ Excludes empty or system containers.namespace=~"^$namespace$"→ Filters the results to the namespace selected in your Grafana dashboard variable.sum(...) by (pod)→ Adds together the memory usage of all containers belonging to the same pod, giving a single memory usage value per pod.
After applying these settings, Grafana will display the current memory usage for each pod in the selected namespace, making it easy to identify workloads consuming the most memory.
#grafana #prometheus #monitoring
0 Comments