2022 Zabbix中国峰会
2022 Zabbix中国峰会

8 proc.mem 监控项中memtype参数类型的注意事项

概述

Linux, AIX, FreeBSD 和 Solaris 都支持memtype参数。

'memtype' 参数的三个常用值 pmem, rssvsize在所有系统中都适用。另外, 在一些系统中只支持该系统下的 'memtype' 值。

AIX

请参见表中AIX上的“memtype”参数所支持的值.

支持的参数值 描述 Source n procentry64 structure Tries t be compatible with
vsize (( - default value)) 虚拟内存大小 pi_s ze
pmem 实际内存的百分比 pi_prm ps -o p em
rss 驻留集大小 pi_ rss + pi_drss ps - rssize
size 进程大小(代码+数据) pi_dvm "ps gvw SIZE column
dsize 数据大小 pi
dsize
tsize 文本(代码)的大小 pi_ts ze "ps gv " TSIZ column
sdsize 来自共享库的数据大小 pi_sdsiz
drss 数据驻留集大小 pi_dr s
trss 文本驻留集大小 pi_tr s

FreeBSD

请参见表中FreeBSD上的“memtype”参数支持的值。

Supported value Description Source in kinfo_proc structure Tries to be compatible with
vsize 虚拟内存大小 kp_e roc.e_vm.vm_map.size or ki_size ps -o vsz
pmem 实际内存的百分比 calcula ed from rss ps -o p em
rss 驻留集大小 kp_ proc.e_vm.vm_rssize or ki_rssize ps - rss
size (( - default value)) 进程(代码+数据+堆栈)大小 tsize + d ize + ssize
tsize 文本(代码)的大小 kp_ep oc.e_vm.vm_tsize or ki_tsize ps -o siz
dsize 数据大小 kp
eproc.e_vm.vm_dsize or ki_dsize ps o dsiz
ssize 堆栈大小 kp
eproc.e_vm.vm_ssize or ki_ssize ps o ssiz

Linux

请参见表中Linux上的“memtype”参数支持的值。

Supported value Description Source in /proc/<pid>/status file
vsize (( - default value)) 虚拟内存大小 VmSiz
pmem 实际内存的百分比 (VmRSS/ otal_memory) * 100
rss 驻留集大小 VmRS
data 数据段的大小 VmDat
exe 代码段的大小 VmExe
hwm 驻留集峰值大小 VmHWM
lck 锁定内存大小 VmLck
lib 共享库的大小 VmLib
peak 虚拟内存峰值大小 VmPeak
pin 固定的页面大小 VmPin
pte 页表条目的大小 VmPTE
size 进程码+数据+栈段大小 VmExe + mData + VmStk
stk 堆栈段大小 VmSt
swap 使用的交换空间大小 VmSwap

Linux上注意事项:

  1. 一些旧版本Linux 内核并不是支持所有'memtype' 值的。例如, Linux 内核版本2.4就不支持 hwm, pin, peak, pteswap 等值。
  2. 我们发现 Zabbix agent 主动检查进程参数proc.mem[...,...,...,...,data] 显示的值比agent 的 /proc/<pid>/status 文件中 VmData行的值大大 4 kB。在agent自我监控管理时,agent的数据碎片增长率4 kB ,然后又返回到先前的值。

Solaris

请参见表中的Solaris上的“memtype”参数所支持的值。

支持的参数值 描述 Source n psinfo structure 兼容
vsize (( - default value)) Size of process image pr_size ps -o vsz
pmem 实际内存的百分比 pr_pct em ps -o p em
rss 驻留集大小  pr_可能会被低估 - 参看 "man ps"中rss描述. ssize ps - rss

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 value Description Source in procentry64 structure Tries to be compatible with
vsize (( - default value)) Virtual memory size pi_size
pmem Percentage of real memory pi_prm ps -o pmem
rss Resident set size pi_trss + pi_drss ps -o rssize
size Size of process (code + data) pi_dvm "ps gvw" SIZE column
dsize Data size pi_dsize
tsize Text (code) size pi_tsize "ps gvw" TSIZ column
sdsize Data size from shared library pi_sdsize
drss Data resident set size pi_drss
trss Text resident set size pi_trss

FreeBSD

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

Supported value Description Source in kinfo_proc structure Tries to be compatible with
vsize Virtual memory size kp_eproc.e_vm.vm_map.size or ki_size ps -o vsz
pmem Percentage of real memory calculated from rss ps -o pmem
rss Resident set size kp_eproc.e_vm.vm_rssize or ki_rssize ps -o rss
size (( - default value)) Size of process (code + data + stack) tsize + dsize + ssize
tsize Text (code) size kp_eproc.e_vm.vm_tsize or ki_tsize ps -o tsiz
dsize Data size kp_eproc.e_vm.vm_dsize or ki_dsize ps -o dsiz
ssize Stack size kp_eproc.e_vm.vm_ssize or ki_ssize ps -o ssiz

Linux

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

Supported value Description Source in /proc/<pid>/status file
vsize (( - default value)) Virtual memory size VmSize
pmem Percentage of real memory (VmRSS/total_memory) * 100
rss Resident set size VmRSS
data Size of data segment VmData
exe Size of code segment VmExe
hwm Peak resident set size VmHWM
lck Size of locked memory VmLck
lib Size of shared libraries VmLib
peak Peak virtual memory size VmPeak
pin Size of pinned pages VmPin
pte Size of page table entries VmPTE
size Size of process code + data + stack segments VmExe + VmData + VmStk
stk Size of stack segment VmStk
swap Size of swap space used VmSwap

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 value Description Source in psinfo structure Tries to be compatible with
vsize (( - default value)) Size of process image pr_size ps -o vsz
pmem Percentage of real memory pr_pctmem ps -o pmem
rss Resident set size
It may be underestimated - see rss description in "man ps".
pr_rssize ps -o rss