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
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 :
In other words monit use as memory usage MemTotal - MemFree - Buffers - Cached.
In your case 998 - 146 - 114 - 70 = 668
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:
See here from more details.
AFAIK, it based on: