Finding Memory Utilzation

2,395 views
Skip to first unread message

engg....@gmail.com

unread,
Feb 26, 2019, 4:21:54 AM2/26/19
to Prometheus Developers
Hi Folks,

I have started using Prometheus(and visualizations on grafana). I installed node_exporter on an Amazon EC2-Linux machine and am seeing metrics at x.y.z.w:9100/metrics.
Everything working fine till here. Now I want to see current memory utilzation of the machine as a whole, something as simple as, out of 16GB 2GB is getting used currently. Not process wise, just for the entire machine.

What query should be used.

Thanks in advance!

Julius Volz

unread,
Feb 26, 2019, 9:26:11 AM2/26/19
to engg....@gmail.com, Prometheus Developers
What exactly counts as "used" memory in Linux is a bit up to interpretation since the OS will try to use as much memory as it can for the page cache (but it can also get rid of it again easily if an application needs the memory) and some memory for IO buffers.

As far as I know, a decent approximation for actual memory usage is to add free, cached, and buffers usage together (they can all be counted as "available") and subtract that from the total memory of the machine, like so:

node_memory_MemTotal_bytes - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes)


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To post to this group, send email to prometheus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/856d7b21-7cfb-47b3-8739-072aa7428deb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Kochie

unread,
Feb 26, 2019, 9:41:20 AM2/26/19
to Julius Volz, engg....@gmail.com, Prometheus Developers
In addition, on newer Linux kernels, there is a node_memory_MemAvailable_bytes.

You can write the query like this to get either the old style or the new style:

node_memory_MemTotal_bytes - (node_memory_MemAvailable_bytes or  (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes))

mohd shoaib

unread,
Feb 27, 2019, 1:18:50 AM2/27/19
to Julius Volz, Prometheus Developers
Hi Julius,

Thanks for the help. This query Worked out.

P.S:  Maybe not the right place to say, Julius, But your talk at dockercon 17 (https://www.youtube.com/watch?v=PDxcEzu62jk) on prometheus is really good for a novice to get on toes and start using Prometheus, It was very informative and enlightening- Thanks.

-Kanib 

Julius Volz

unread,
Feb 27, 2019, 5:06:01 AM2/27/19
to mohd shoaib, Prometheus Developers
Hi Kanib,

Thanks for that, always great to hear when someone finds it useful :)

Cheers,
Julius
Reply all
Reply to author
Forward
0 new messages