arnaudsj / monit

Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. (unofficial mirror)
http://mmonit.com/monit/
Other
515 stars 63 forks source link

Monit memory - wrong usage #10

Closed skehub closed 6 years ago

skehub commented 6 years ago

Hello,

OS: Centos 6.5 monit: 5.22.0 mmonit: 3.5.1

I find out that monit and mmonit console are showing wrong memory usage.

Example: free -g will show only 1GB free of 132GB [root@host04 opt]# free -g total used free shared buffers cached Mem: 125 124 1 0 0 115 -/+ buffers/cache: 8 117 Swap: 7 0 7

But monit will show memory usege = 5.5%

[root@blapi04 opt]# monitctl status Monit 5.22.0 uptime: 9d 4h 34m

System 'hosti04' status OK monitoring status Monitored monitoring mode active on reboot start load average [0.30] [0.34] [0.31] cpu 0.7%us 0.1%sy 0.0%wa memory usage 7.0 GB [5.5%] swap usage 0 B [0.0%] uptime 9d 4h 35m boot time Sun, 07 Jan 2018 09:52:34 data collected Tue, 16 Jan 2018 14:27:34

Can you tell me what is wrong here?

Thank you, Matjaz

skehub commented 6 years ago

M/Monit reports the real memory usage, excluding filesystem buffer/cache. As DRAM memory is fast and discs are slower, the system tries to always utilize the free memory to cache filesystem data. If some process needs more memory, the system automatically shrinks the cache to make it available for the process. You will thus usually see close to 100% memory usage if you include buffer/cache.

The real memory usage on your system is (2+114)/123*100 = 94.3% (5.7% free)

The value reported by monit is correct ('free' rounded all values up, monit uses higher precision when calculating the statistics).

Best regards, The M/Monit team