[GLLUG] Monitoring memory usage
Henrik Morsing
henrik at morsing.cc
Wed Oct 23 12:33:33 UTC 2024
Hi John,
On Wed, Oct 23, 2024 at 01:14:10PM +0100, John Edwards via GLLUG wrote:
>Hi
>
>
>Both good tools, although the problem I usually find is what
>measurement to use to create an alert (which may be what Henrik is
>looking for as well).
Yes,
I'm looking for the metric, not the method.
From man free I get:
available
Estimation of how much memory is available for starting new applications,
without swapping. Unlike the data provided by the cache or free fields, this
field takes into account page cache and also that not all reclaimable memory
slabs will be reclaimed due to items being in use (MemAvailable in
/proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, oth‐
erwise the same as free)
Maybe the simplest solution is just to go for that.
Of course, the ultimate solution would be to measure thrashing but that would be tricky and by the time anyone noticed it might be too late.
I use Munin as well but Munin uses RRD and graphs based on counters between reads. Red/Green monitoring such as Zabbix (our current solution) generally use point-in-time readings. We also have Grafana, maybe that could do something clever, though I would still suspect my colleagues would be nervous wrecks waiting for thrashing alerts.
Regards,
Henrik Morsing
>
>It used to be when the machine started to swap for running programs
>then performance was reduced, so swap was the thing to monitor.
>
>But I've found recent kernels (probably since 5.x) tend to swap out
>any unused programs in favour of caching the filesystem (which is
>usually the right thing to do to increase performance).
>
>Odd thing is that currently the kernel does this even when
>/proc/sys/vm/swappiness is set low (10 or even 1), and will happily
>continue until all swap is used (at which point Nagios/Icinga alerts,
>even though there is potential lots of RAM available but used for cache).
>
>
>The default 'check_swap' in the Nagios/Icinga 'monitoring-plugins'
>Debian package only seems to handle total amount of swap (either as
>percentage or absolute numbers).
>
>Munin can measure swap pages being written or read, which gives a
>better idea of how much the swap is being actively used, but it does
>not handle alerts as well as Nagios/Icinga (I think it can send email,
>but does not have its own acknowledge status).
>
>So has anyone met a Nagios/Icinga monitoring plugins which can measure
>the swap I/O levels rather than swap used (maybe through /proc/vmstat)?
>
>
>Also Munin seems to be able split memory use into applications,
>system, I/O wait, cache, etc. So I'm wondering if there might be a
>Nagios/Icinga monitoring plugins which can do the same and alert if a
>certain item (eg application memory) reaches a certain level.
>
>
>Of course the other alternative is to just not use swap at all, but
>that seems like a waste of a potential resource.
>
>
>
>--
>#---------------------------------------------------------#
>| John Edwards Email: john at cornerstonelinux.co.uk |
>#---------------------------------------------------------#
>--
>GLLUG mailing list
>GLLUG at mailman.lug.org.uk
>https://mailman.lug.org.uk/mailman/listinfo/gllug
--
More information about the GLLUG
mailing list