7

Once can have monit monitor memory usage…

check system foo
  if memory usage > 95% then alert

Does it use free RAM, or free -/+ buffers/cache? (or something else?)

# free -m
             total       used       free     shared    buffers     cached
Mem:           998        851        146          0        114         70
-/+ buffers/cache:        666        332
Swap:         2047         54       1993

3 Answers 3

6

This could be get from the source of monit https://github.com/arnaudsj/monit/tree/master/process.

For linux the value is computed in sysdep_LINUX.c and comes from /proc/meminfo :

si->total_mem_kbyte = systeminfo.mem_kbyte_max - mem_free - buffers - cached;

In other words monit use as memory usage MemTotal - MemFree - Buffers - Cached.

In your case 998 - 146 - 114 - 70 = 668

1

On latest Monit (ie: 5.25.x) the memory usage value accounts for ZFS ARC cache - so if someout is using ZFS, used memory is not ballooned by reclaimable ARC data.

Current memory usage is calculated as:

si->memory.usage.bytes = systeminfo.memory.size - zfsarcsize -
(uint64_t)(mem_free + buffers + cached + slabreclaimable) * 1024;

See here from more details.

-1

AFAIK, it based on:

used memory - cached = 851 - 70 = 781
1
  • 3
    any documentation for that? Nov 8, 2011 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .