[ZBXNEXT-1078] add fifth parameter to the key "proc.mem" - <type of memory> Created: 2012 Jan 10  Updated: 2015 Nov 16  Resolved: 2015 Sep 09

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G), Documentation (D), Frontend (F)
Affects Version/s: 1.8.10
Fix Version/s: 2.5.0, 3.0.0alpha2

Type: New Feature Request Priority: Major
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 13
Labels: item, memory, patch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File allow-memtype-linux.patch    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-346 proc.mem should support Resident Memory Closed
is duplicated by ZBXNEXT-411 check how much memory a specific proc... Closed
is duplicated by ZBX-4532 Change the type of memory to calculat... Closed
is duplicated by ZBX-6733 wrong proc.mem in FreeBSD Closed
is duplicated by ZBX-9465 proc.mem and processes with shared me... Closed

 Description   

The key "proc.mem" uses the type of memory - VmSize (hardcoded currently)
But would be nice to be able specify it in the item key.



 Comments   
Comment by Oleksii Zagorskyi [ 2012 Jan 10 ]

High connected issue: ZBX-4532

zalex_ua after 2 years : In the ZBX-4532 you can find a discussion why implementing current feature would be very important.

Comment by Frédéric DROUET [ 2012 Feb 08 ]

Can we expect to have this in a near futur for Linux ?

Comment by Alexander Vladishev [ 2012 May 09 ]

Related issue: ZBX-3897

Comment by Jim Riggs [ 2012 May 09 ]

I can provide FreeBSD code if needed when this proceeds.

Comment by Johan Fischer [ 2012 Oct 21 ]

Hi All,

I've attached a patch I'm using on Linux (not perfect).

Comment by richlv [ 2014 Jan 02 ]

(1) we should allow to specify multiple types in the key, too

andris Multiple types of process memory in a single proc.mem key's 5-th parameter means that Zabbix agent gathers several values and calculates an expression, like

proc.mem[,,,,VmPeak - VmSize]

Is it worth implementing ?

<richlv> it was meant as a simple list, but yes - it would provide too little benefit, CLOSED

Comment by David Canós [ 2014 Aug 06 ]

AS Yoav Steinberg comment in 2012 Sep 02 09:38
As a workaround we add the following to the agent's conf:
UserParameter=proc.mem.rss[*],ps ho rss `pgrep -of "$1"`

Comment by Andris Mednis [ 2014 Sep 19 ]

Preview for Linux available in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r49183.

The 5th parameter can be one of: vmpeak, vmsize, vmlck, vmpin, vmhwm, vmrss, vmdata, vmstk, vmexe, vmlib, vmpte, vmswap (all 12 types of process memory supported by Linux kernel in lowercase).

Example of use:

 zabbix_agentd -t proc.mem[,,,,vmlck] 
Comment by Andris Mednis [ 2014 Sep 23 ]

For Solaris it was decided to implement 3 "proc.mem" types from psinfo structure:

  pr_size    /* size of process image in Kbytes */   <--- currently implemented as the only one
  pr_rssize  /* resident set size in Kbytes */ 
  pr_pctmem  /* % of system memory used by process */
Comment by Andris Mednis [ 2014 Sep 25 ]

Preview for Solaris available in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r50075.

The 5th parameter can be one of:

  • vsize (default, size of process image, tries to be compatible with "ps -o vsz"),
  • rss (resident set size, tries to be compatible with "ps -o rss"),
  • pmem (percentage of real memory, tries to be compatible with "ps -o pmem").
Comment by Andris Mednis [ 2014 Sep 25 ]

On FreeBSD process memory types could be VSZ, RSS, %MEM as shown by "ps ax -o user,vsz,rss,pmem,command".

Comment by Andris Mednis [ 2014 Sep 30 ]

Solution for ZBXNEXT-346 and ZBXNEXT-411 should be provided as part of ZBXNEXT-1078.

Comment by Andris Mednis [ 2014 Oct 07 ]

A new preview for Linux available in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r49627.

The 5th parameter can be one of:

  • vmsize or vsize (virtual memory size),
  • vmrss or rss (resident set size),
  • pmem (percentage of real memory),
  • size (size of process code + data + stack segments)
  • vmpeak (peak virtual memory size),
  • vmlck (size of locked memory),
  • vmpin (size of pinned pages),
  • vmhwm (peak resident set size),
  • vmdata (size of data segment),
  • vmstk (size of stack segment),
  • vmexe (size of code segment),
  • vmlib (size of shared libraries),
  • vmpte (size of page table entries),
  • vmswap (size of swap space used).

It is not yet peer-reviewed/tested, it may contain errors and be changed. Feedback is welcome.

Comment by Andris Mednis [ 2014 Oct 16 ]

Preview for AIX available in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r49977.

The 5th parameter can be one of:

  • vsize (virtual memory size, historically default proc.mem[] on AIX),
  • rss (resident set size, tries to be compatible with "ps -o rssize"),
  • pmem (percentage of real memory, tries to be compatible with "ps -o pmem"),
  • size (tries to be compatible with "ps gvw" SIZE column),
  • dsize ,
  • tsize (tries to be compatible with "ps gvw" TSIZ column),
  • sdsize,
  • drss,
  • trss,
  • dvm (shows the same value as 'size').

It is not yet peer-reviewed/tested, it may contain errors and be changed. Feedback is welcome.

Comment by Andris Mednis [ 2014 Oct 21 ]

Preview for FreeBSD available in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r50075.

The 5th parameter can be one of:

  • size (size of process (code + data + stack), historically default proc.mem[] on FreeBSD),
  • rss (resident set size, tries to be compatible with "ps -o rss"),
  • vsize (virtual size, tries to be compatible with "ps -o vsz"),
  • pmem (percentage of real memory, tries to be compatible with "ps -o pmem"),
  • tsize (text (code) size, tries to be compatible with "ps -o tsiz"),
  • dsize (data size, tries to be compatible with "ps -o dsiz"),
  • ssize (stack size, tries to be compatible with "ps -o ssiz").
Comment by Andris Mednis [ 2014 Oct 21 ]

Available in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078.

Comment by Andris Zeila [ 2014 Nov 04 ]

(2) Code improvements in src/libs/zbxsysinfo/linux/proc.c:PROC_MEM()

It appears that we could drop the skip flag there and simply use continue instead of setting skip = 1 and checking later for 0 == skip.

andris RESOLVED in r50516.

wiper CLOSED

Comment by Andris Zeila [ 2014 Nov 05 ]

(3) It was decided to remove vm prefix from linux supported memory types.

andris RESOLVED in r50516.

wiper CLOSED

Comment by Andris Zeila [ 2014 Nov 06 ]

Successfully tested, but please see (2) and (3).

Comment by Andris Mednis [ 2014 Nov 07 ]

(4) On Linux, if the proc.mem[] 5th parameter is "size" and reading of "VmData" or "VmStk" fails, then an error message says "Cannot get amount of "VmExe" memory.".

andris RESOLVED in r50521.

wiper CLOSED

Comment by Andris Mednis [ 2014 Nov 11 ]

Fixed in version pre-2.5.0 (trunk) rev. 50542.

Comment by Andris Mednis [ 2014 Nov 12 ]

Documented at
https://www.zabbix.com/documentation/3.0/manual/introduction/whatsnew300?&#item_changesimprovements
https://www.zabbix.com/documentation/3.0/manual/config/items/itemtypes/zabbix_agent?&#supported_item_keys
https://www.zabbix.com/documentation/3.0/manual/appendix/items/supported_by_platform
https://www.zabbix.com/documentation/3.0/manual/appendix/items/proc_mem_notes
https://www.zabbix.com/documentation/3.0/manual/appendix/items/proc_mem_num_notes

wiper Regarding the last one - maybe it would be better to rename the user to zabbixuser in examples (or we could use examples without user parameter).
andris Thanks! Replaced 'zabbix30' with 'zabbix' in 'proc_mem_num_notes' file.

Comment by Andris Mednis [ 2015 Sep 07 ]

(5) On AIX proc.mem[] with 5th parameter value 'dvm' returns the same value as 'size'. 'dvm' should be removed - no need to have 2 item keys with same value.

andris RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1078 r55445.
Documented in https://www.zabbix.com/documentation/3.0/manual/appendix/items/proc_mem_notes?&#aix (removed description of value 'dvm').
The 5th parameter for proc.mem[] was introduced in Zabbix.3.0. Nothing was changed in 2.4.

<dimir> CLOSED

Comment by Andris Mednis [ 2015 Sep 08 ]

Fixed in version pre-2.5.1 (trunk) rev. 55484.

Comment by Steve mushero [ 2015 Nov 16 ]

Note we have a spec list for this item - first is get the RSS as VSZ is useless, but also ideally have aggregate info such as:

  • Sum, Max, Avg of a process name like Apache

We need this to watch Apache processes and RAM vs. the configured max as this kills us on high-load servers and lets us find config issues.

Also useful for MySQL and other things in Java.

Steve

Comment by Andris Mednis [ 2015 Nov 16 ]

Could you clarify - is there some functionality missing ? Something designed in a wrong way ?
For example, to monitor memory used by Apache processes you can use items like proc.mem[apache2,,sum,,data] (documented in https://www.zabbix.com/documentation/3.0/manual/config/items/itemtypes/zabbix_agent , https://www.zabbix.com/documentation/3.0/manual/appendix/items/proc_mem_num_notes , https://www.zabbix.com/documentation/3.0/manual/appendix/items/proc_mem_notes ).

Generated at Fri Apr 26 06:28:09 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.