Why does mem_used calculate RAM + Swap against RAM total only?

Hi,

We are reviewing the mem_used check and noticed something that we would like to understand better.

For the “Total (RAM + Swap)” value, Checkmk appears to calculate:

(RAM used + Swap used) / RAM total

rather than:

(RAM used + Swap used) / (RAM total + Swap total)

For example, with 6.12 GiB RAM used, 756 MiB Swap used, 7.63 GiB total RAM and 3.91 GiB total Swap, Checkmk reports 89.92%, while using RAM + Swap as the total available memory would give approximately 59.4%.

We understand that this may be intentional rather than a bug, but the calculation seems unusual to us considering that the value is labelled “Total (RAM + Swap)”.

Could you explain the reason behind using only total RAM as the denominator?

Thanks!

The intention behind the key indicators of Linux memory are documented in the article Linux Swap Monitoring: Top Insights from Checkmk | Checkmk

The advantage of the chosen metric (RAM used + Swap used) / RAM total is that it allows to define meaningful thresholds that work on a broader range of systems, like WARN at 125% (system is lightly overbooked) and CRIT at 175% (severely overbooked).

With the metric (RAM used + Swap used) / (RAM total + Swap total), you can not tell if a measurement of e.g. 65% is actually harmful for the performance of the system, because it depends of the ratio of available RAM and Swap.

I thought a bit about it and currently we don’t do a great job to make this very clear. Even worse, in Linux we don’t show this memory demand anymore (RAM + SWAP / RAM).

I am considering the following change (for Linux):

  • Total virtual memory: 76.69% - 29.6 GiB of 38.6 GiB
    → Memory usage: 76.69% of RAM + Swap - 29.6 GiB of 38.6 GiB
  • Does not exist…
    → Memory demand: 96.72% of RAM - 29.6 GiB of 30.6 GiB

Besides the renaming of Total virtual memory, I also moved the “of what” from the absolute numbers to the % area so that you know immediately on which base the calculation is done

Let me know your thoughts!