[ZBX-13233] add new memory types to monitor by vm.memory.size[] Created: 2017 Dec 21  Updated: 2024 Apr 10  Resolved: 2018 Feb 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 3.4.5rc1, 4.0.0alpha1
Fix Version/s: 4.0.0alpha3, 4.0 (plan)

Type: Patch request Priority: Trivial
Reporter: Tomasz Kłoczko Assignee: Viktors Tjarve
Resolution: Fixed Votes: 0
Labels: patch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux kernel 4.15 rc4


Attachments: File zabbix-linux_vm.memory.size-v1.0.patch    
Team: Team A
Team: Team A
Sprint: Sprint 24, Sprint 25, Sprint 26
Story Points: 1

 Description   

Submitted patch changes in src/libs/zbxsysinfo/linux/memory.c

  • reordered functions VM_MEMORY_*() to put them in the order as they are used in
    VM_MEMORY_SIZE()
  • added vm.memory.size[] key new parameters:
    vm.memory.size[active]
    vm.memory.size[anon]
    vm.memory.size[inactive]
    vm.memory.size[slabs]
  • added new function VM_MEMORY_PROC_MEMINFO() which is used to handle new vm.memory.size[] parameters
  • use VM_MEMORY_PROC_MEMINFO() to handle:
    vm.memory.size[cached]

Please let me know if you are happy to add something like this.
If yes I'll try to add handle more /prc/meminfo entries.

Patch can be cleanly applied against 3.4 and trunk and probably against older branches as well.



 Comments   
Comment by Tomasz Kłoczko [ 2017 Dec 21 ]

Test result of the pached agent binary on my laptop

$ for i in active anon available buffers cached exec file free inactive pavailable pinned pused shared slab total used wired; do echo -n $i " "; /usr/sbin/zabbix_agentd -t "vm.memory.size[$i]";done
active  vm.memory.size[active]                        [u|3842932736]
anon  vm.memory.size[anon]                          [u|2779541504]
available  vm.memory.size[available]                     [m|ZBX_NOTSUPPORTED]
buffers  vm.memory.size[buffers]                       [u|12288]
cached  vm.memory.size[cached]                        [u|3653885952]
exec  vm.memory.size[exec]                          [m|ZBX_NOTSUPPORTED] [Invalid first parameter.]
file  vm.memory.size[file]                          [m|ZBX_NOTSUPPORTED] [Invalid first parameter.]
free  vm.memory.size[free]                          [u|160473088]
inactive  vm.memory.size[inactive]                      [u|2587189248]
pavailable  vm.memory.size[pavailable]                    [d|53.878148]
pinned  vm.memory.size[pinned]                        [m|ZBX_NOTSUPPORTED] [Invalid first parameter.]
pused  vm.memory.size[pused]                         [d|98.131269]
shared  vm.memory.size[shared]                        [m|ZBX_NOTSUPPORTED] [Supported for Linux 2.4 only.]
slab  vm.memory.size[slab]                          [u|1374564352]
total  vm.memory.size[total]                         [u|8243810304]
used  vm.memory.size[used]                          [u|8090054656]
wired  vm.memory.size[wired]                         [m|ZBX_NOTSUPPORTED] [Invalid first parameter.]
Comment by Tomasz Kłoczko [ 2017 Dec 21 ]

Tomorrow will try to add those new keys and some graphs/screens in my OS Linux template on
https://github.com/kloczek/zabbix-templates/tree/master/OS%20Linux%20ZBX-13233

Comment by Tomasz Kłoczko [ 2018 Jan 04 ]

Alex could you please make some comment about do you like this patch or not?
It is possible to add more memory types using VM_MEMORY_PROC_MEMINFO() call so please let me know what do you think generally about this patch

Comment by Viktors Tjarve [ 2018 Jan 09 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-13233

Comment by Strahinja Kustudic [ 2018 Jan 12 ]

Why not add vm.memory.size[dirty] as well, since you added all these?

Comment by Tomasz Kłoczko [ 2018 Jan 12 ]

First I've been waiting for the comment
Instead looks like patch has been pushed to integrate with trunk so looks like it is not straight approval
Probably this weekend will try to add add patch with rest of the memory types listed in meminfo.

Comment by Strahinja Kustudic [ 2018 Jan 12 ]

Would also be cool to change how used is calculated as described in ZBXNEXT-4335.

Comment by Viktors Tjarve [ 2018 Jan 19 ]

Hi Tomasz,
Huge thanks for the patch. We always appreciate receiving patches from Zabbix community. When a community patch is considered to be applied to the source code it's reviewed by Zabbix developer. There are certain development and coding style guidelines we follow and patches almost always cannot be straight approved. Tomasz, your patch is really good only the code it was based on needed some improvement event before you worked on it. That is why we changed the patch a bit. Also when we make changes we like the diff to be as small as possible so we usually do not change anything that does not make difference on how the code is generally structured and/or how it performs.

Comment by Viktors Tjarve [ 2018 Jan 25 ]

Released in:

  • 4.0.0alpha3 r77200
Comment by Tomasz Kłoczko [ 2018 Jan 25 ]

Thank you guys for accepting and committing my changes.

You may expect the second batch of the changes

Generated at Wed Apr 17 02:55:30 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.