Closed andyshoe closed 9 years ago
@andyshoe I have a PR open which among several things removes the shell call out to free command replacing it with the vmstat gem which allows it to work on more *nix platforms. Any feedback on improvement would be valuable: https://github.com/sensu-plugins/sensu-plugins-memory-checks/pull/6
Closing this, using proc is not platform agnostic. If we are going to get rid of free
I would like to find a way to also include windows not jus *nix. Absent that vmstat is the way to go.
Its more efficient to access memory information via /proc/meminfo rather than calling the "free" command via a shell. Note that MemAvailable is a more accurate indicator of free memory, but older Linux kernels don't support this. For older kernels the traditional free+buffers+cache approach is taken.
Also, the format of the "free" command output has changed between certain linux versions (notably CentOS 6 and 7). So the original method using "free" is broken in that regard as well.
This runs in my tests, but please note that I am not a ruby developer and this is literally the first piece of ruby code I have written. Enjoy!