Search code examples
prometheuspromqlprometheus-node-exporter

Prometheus reports a different value for node_memory_Active_bytes and free -b


I'm quite new to Prometheus, so this is possibly a silly question - but here goes.

When I request node_memory_Active_bytes and node_memory_MemTotal_bytes I get:

node_memory_Active_bytes{instance="10.1.4.9:9100",job="node-exporter"}  3257815040

(..and..)

node_memory_MemTotal_bytes{instance="10.1.4.9:9100",job="node-exporter"}    16509550592

However, on the box, if I run free -b, I get the following:

$ free -b
              total        used        free      shared  buff/cache   available
Mem:    16509550592  2264915968  6787731456    59121664  7456903168 14140530688
Swap:             0           0           0

I'm struggling to maps prometheus's view of memory with the actual machine's view. I'm sure I must be doing something wrong, but I have no idea what. The total's match, but the free


Solution

  • Equivalent queries for free -b command:

    • total: node_memory_MemTotal_bytes
    • used: node_memory_MemTotal_bytes - node_memory_MemFree_bytes - node_memory_Buffers_bytes - node_memory_Cached_bytes - node_memory_SReclaimable_bytes
    • shared: node_memory_Shmem_bytes
    • free: node_memory_MemFree_bytes
    • buff/cache: node_memory_Buffers_bytes + node_memory_Cached_bytes + node_memory_SReclaimable_bytes
    • available: node_memory_MemAvailable_bytes