8 Notes on memtype parameter in proc.mem items

Overview

The memtype parameter is supported on Linux, AIX, FreeBSD, and Solaris platforms.

Three common values of ‘memtype’ are supported on all of these platforms: pmem, rss and vsize. Additionally, platform-specific ‘memtype’ values are supported on some platforms.

AIX

See values supported for ‘memtype’ parameter on AIX in the table.

Supported valueDescriptionSource in procentry64 structureTries to be compatible with
vsize 1Virtual memory sizepi_size
pmemPercentage of real memorypi_prmps -o pmem
rssResident set sizepi_trss + pi_drssps -o rssize
sizeSize of process (code + data)pi_dvm“ps gvw” SIZE column
dsizeData sizepi_dsize
tsizeText (code) sizepi_tsize“ps gvw” TSIZ column
sdsizeData size from shared librarypi_sdsize
drssData resident set sizepi_drss
trssText resident set sizepi_trss

Notes for AIX:

  1. When choosing parameters for proc.mem[] item key on AIX, try to specify narrow process selection criteria. Otherwise there is a risk of getting unwanted processes counted into proc.mem[] result.

Example:

  1. $ zabbix_agentd -t proc.mem[,,,NonExistingProcess,rss]
  2. proc.mem[,,,NonExistingProcess,rss] [u|2879488]

This example shows how specifying only command line (regular expression to match) parameter results in Zabbix agent self-accounting - probably not what you want.

  1. Do not use “ps -ef” to browse processes - it shows only non-kernel processes. Use “ps -Af” to see all processes which will be seen by Zabbix agent.

  2. Let’s go through example of ‘topasrec’ how Zabbix agent proc.mem[] selects processes.

  1. $ ps -Af | grep topasrec
  2. root 10747984 1 0 Mar 16 - 0:00 /usr/bin/topasrec -L -s 300 -R 1 -r 6 -o /var/perf daily/ -ypersistent=1 -O type=bin -ystart_time=04:08:54,Mar16,2023

proc.mem[] has arguments:

  1. proc.mem[<name>,<user>,<mode>,<cmdline>,<memtype>]

The 1st criterion is a process name (argument <name>). In our example Zabbix agent will see it as ‘topasrec’. In order to match, you need to either specify ‘topasrec’ or to leave it empty. The 2nd criterion is a user name (argument <user>). To match, you need to either specify ‘root’ or to leave it empty. The 3rd criterion used in process selection is an argument <cmdline>. Zabbix agent will see its value as ‘/usr/bin/topasrec -L -s 300 -R 1 -r 6 -o /var/perf/daily/ -ypersistent=1 -O type=bin -ystart_time=04:08:54,Mar16,2023’. To match, you need to either specify a regular expression which matches this string or to leave it empty.

Arguments <mode> and <memtype> are applied after using the three criteria mentioned above.

FreeBSD

See values supported for ‘memtype’ parameter on FreeBSD in the table.

Supported valueDescriptionSource in kinfo_proc structureTries to be compatible with
vsizeVirtual memory sizekp_eproc.e_vm.vm_map.size or ki_sizeps -o vsz
pmemPercentage of real memorycalculated from rssps -o pmem
rssResident set sizekp_eproc.e_vm.vm_rssize or ki_rssizeps -o rss
size 1Size of process (code + data + stack)tsize + dsize + ssize
tsizeText (code) sizekp_eproc.e_vm.vm_tsize or ki_tsizeps -o tsiz
dsizeData sizekp_eproc.e_vm.vm_dsize or ki_dsizeps -o dsiz
ssizeStack sizekp_eproc.e_vm.vm_ssize or ki_ssizeps -o ssiz

Linux

See values supported for ‘memtype’ parameter on Linux in the table.

Supported valueDescriptionSource in /proc/<pid>/status file
vsize 1Virtual memory sizeVmSize
pmemPercentage of real memory(VmRSS/total_memory) * 100
rssResident set sizeVmRSS
dataSize of data segmentVmData
exeSize of code segmentVmExe
hwmPeak resident set sizeVmHWM
lckSize of locked memoryVmLck
libSize of shared librariesVmLib
peakPeak virtual memory sizeVmPeak
pinSize of pinned pagesVmPin
pteSize of page table entriesVmPTE
sizeSize of process code + data + stack segmentsVmExe + VmData + VmStk
stkSize of stack segmentVmStk
swapSize of swap space usedVmSwap

Notes for Linux:

  1. Not all ‘memtype’ values are supported by older Linux kernels. For example, Linux 2.4 kernels do not support hwm, pin, peak, pte and swap values.
  2. We have noticed that self-monitoring of the Zabbix agent active check process with proc.mem[...,...,...,...,data] shows a value that is 4 kB larger than reported by VmData line in the agent’s /proc/<pid>/status file. At the time of self-measurement the agent’s data segment increases by 4 kB and then returns to the previous size.

Solaris

See values supported for ‘memtype’ parameter on Solaris in the table.

Supported valueDescriptionSource in psinfo structureTries to be compatible with
vsize 1Size of process imagepr_sizeps -o vsz
pmemPercentage of real memorypr_pctmemps -o pmem
rssResident set size
It may be underestimated - see rss description in “man ps”.
pr_rssizeps -o rss
Footnotes

1 Default value.