Hello,
I have no useful examples, vmstat swap usage is si=0 and so=0 only.
The values calculated based on /proc/meminfo fit, on a Linux system.
And the system status information seems to be useful.
> Is it possible to configure Monit to alert of actual swapping
> out rather than swap file usage, or am I barking up the wrong tree?
You are right, monit does not show the actual swap file IO (page in/out
data), the data based on the usage.
monit status LINUX
Monit 5.34.0 uptime: 49d 0h 43m
System 'LINUX'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
load average [7.30] [8.60] [12.77]
cpu 0.8%usr 0.3%sys 14.7%nice 0.0%iowait
0.0%hardirq 0.0%softirq 0.0%steal 0.0%guest 0.0%guestnice
memory usage 42.6 GB [11.3%]
swap usage 10.4 MB [0.5%]
uptime 61d 19h 43m
boot time Thu, 14 Nov 2024 14:54:46
filedescriptors 16800 [0.2% of 6815744 limit]
data collected Wed, 15 Jan 2025 10:37:52
The vmstat data.
Swap
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
vmstat
procs -----------memory---------- ---swap-- -----io---- -system--
------cpu-----
r b swpd free buff cache si so bi bo in cs us sy
id wa st
7 0 10624 273713168 811688 87684144 0 0 69 40 0 0 11
1 88 0 0
vmstat -s
395130516 K total memory
120558732 K used memory
90364732 K active memory
11131200 K inactive memory
274571784 K free memory
811824 K buffer memory
88984004 K swap cache
2095100 K total swap
10624 K used swap
2084476 K free swap
1313872869 non-nice user cpu ticks
1427185498 nice user cpu ticks
247910673 system cpu ticks
22633904247 idle cpu ticks
6802373 IO-wait cpu ticks
0 IRQ cpu ticks
2608560 softirq cpu ticks
0 stolen cpu ticks
17687866581 pages paged in
10300491953 pages paged out
1345 pages swapped in
6655 pages swapped out
3444460676 interrupts
416044891 CPU context switches
1731592487 boot time
273618695 forks
The values based on /proc/meminfo.
cat /proc/meminfo
MemTotal: 395130516 kB
MemFree: 275604548 kB
MemAvailable: 353323016 kB
Buffers: 811800 kB
Cached: 85849340 kB
SwapCached: 892 kB
Active: 89256636 kB
Inactive: 11124384 kB
Active(anon): 18733260 kB
Inactive(anon): 3398376 kB
Active(file): 70523376 kB
Inactive(file): 7726008 kB
Unevictable: 975348 kB
Mlocked: 975348 kB
SwapTotal: 2095100 kB
SwapFree: 2084476 kB
Dirty: 468 kB
Writeback: 0 kB
AnonPages: 14695184 kB
Mapped: 2965708 kB
Shmem: 8423756 kB
Slab: 8029800 kB
SReclaimable: 2699580 kB
SUnreclaim: 5330220 kB
KernelStack: 70320 kB
PageTables: 421232 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 199660356 kB
Committed_AS: 26151808 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 37410524 kB
DirectMap2M: 286273536 kB
DirectMap1G: 80740352 kB
The values are used to calculate the monit swap data.
in src/process/sysdep_LINUX.c
used_system_memory_sysdep(SystemInfo_T *si)
// Swap
if (! (ptr = strstr(buf, "SwapTotal:")) || sscanf(ptr + 10,
"%llu", &swap_total) != 1) {
Log_error("system statistic error -- cannot get swap
total amount\n");
goto error;
}
if (! (ptr = strstr(buf, "SwapFree:")) || sscanf(ptr + 9,
"%llu", &swap_free) != 1) {
Log_error("system statistic error -- cannot get swap
free amount\n");
goto error;
}
si->swap.size = swap_total * 1024;
si->swap.usage.bytes = (swap_total - swap_free) * 1024;
The question is,
how does the /proc/meminfo output data look like on your system.
Are some examples available, based on vmstat and the /proc/meminfo data.
Lutz
Am 14.01.25 um 12:10 schrieb Jamie Burchell via This is the general
mailing list for monit:
> Hi
>
>
>
> I currently use Monit to alert me if swap usage is over > 20%. This works
> most of the time, but I have a particularly stubborn VM currently which
> appears to like to add data to swap and then not touch it. Using vmstat
> shows there are either no, or maybe the odd non-zero swap in operation and
> no swap outs. Is it possible to configure Monit to alert of actual swapping
> out rather than swap file usage, or am I barking up the wrong tree?
>
>
>
> Thanks in advance!
>
> Jamie
>