[ZBXNEXT-1024] Add/delete some modes for vm.memory.size key under FreeBSD (or all BSD) and other OS Created: 2011 May 04 Updated: 2013 Apr 30 Resolved: 2011 Nov 23 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent (G) |
Affects Version/s: | None |
Fix Version/s: | 1.9.9 (beta) |
Type: | Change Request | Priority: | Trivial |
Reporter: | Pavel Timofeev | Assignee: | dimir |
Resolution: | Fixed | Votes: | 2 |
Labels: | freebsd, memory | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
FreeBSD |
Attachments: | memusage_with_patch.png memusage_with_patch_desc.png patch-src_freebsd_mem.c | ||||||||||||
Issue Links: |
|
Description |
Now in Zabbix we have many parameters for monitoring memory under FreeBSD: vm.memory.size[<mode>] total 5 parameters! ('pfree' and 'pused' doesn't work in my servers, and doesn't work correct anyway) Ok, not bad. If you use FreeBSD go to `top`. At head you can see memory parts: In order to know REAL FREE MEMory you need: "vm.stats.vm.v_inactive_count" * "vm.stats.vm.v_page_size" (lets call it INACT) 2. Calculate REAL FREE MEMory: 3. If you want to get REAL USED MEMory: Conclusion 4 developers: Thanks! P.S. maybe it right for all BSD systems. ____________ ? ????? ?????? Zabbix ????? ?????????? ?? ???- ???????? ??? FreeBSD (? ????? ? ??? ???? BSD) ???????? vm.memory.size: ????? ?????? ??????? ????????? ??? ?????????? ????????? ??????, ?.?. ?? ???? ??? ?????? ??????? ?????????????? swap, ????? ?????????? ???????? ????????? ????. |
Comments |
Comment by Pavel Timofeev [ 2011 May 04 ] |
Готов к диалогу |
Comment by Pavel Timofeev [ 2011 May 05 ] |
Алексей, а можно ли дать мне возможность отредактировать тикет? или закрыт его и создать новый? писал в не очень адекватном состоянии и хотел бы переделать его. |
Comment by richlv [ 2011 May 05 ] |
just add an updated summary as a new comment here, somebody surely will handle it from there |
Comment by Pavel Timofeev [ 2011 May 05 ] |
Thank you for fast reply! Maybe I will repeat myself. I just want to say: Please, add some new modes for vm.memory.size key and delete useless modes! It need for FreeBSD and maybe other BSD systems. If you want I'll check it! Also we already have 'total', 'free' and 'cached' modes. It usefull under FreeBSD. But we also need 'active', 'inactive' and 'wired' modes for vm.memory.size key under FreeBSD(BSD)! If you add up all this memory you get 'total' memory. In FreeBSD 'free' memory doesn't mean REAL free memory available for programs. I can provied graphics if you want. |
Comment by Oleksii Zagorskyi [ 2011 May 05 ] |
forum thread http://www.zabbix.com/forum/showthread.php?t=21826 |
Comment by Pavel Timofeev [ 2011 May 05 ] |
Yes, it's me. |
Comment by Pavel Timofeev [ 2011 May 05 ] |
patch that add 3 new modes for vm.memory.size in Zabbix agent under FreeBSD It works good. Just checked! |
Comment by Pavel Timofeev [ 2011 May 05 ] |
than remove shared and used modes |
Comment by Pavel Timofeev [ 2011 May 05 ] |
than 3rd patch for correct calculation of pfree and pused |
Comment by Oleksii Zagorskyi [ 2011 May 05 ] |
Pavel, it better to attach here all your patches |
Comment by Pavel Timofeev [ 2011 May 05 ] |
Cumulative patch |
Comment by Pavel Timofeev [ 2011 May 06 ] |
Small change in patch. Forgot one () You can test it. Just copy this file to /usr/ports/net-mgmt/zabbix-server/files/ directory and reinstall zabbix_agent |
Comment by Pavel Timofeev [ 2011 May 07 ] |
This ticket valid only for FreeBSD. Other BSD - other memory. |
Comment by Pavel Timofeev [ 2011 May 10 ] |
By analogy with 'pfree' and 'pused' and I'll add calculations for 'available' and 'used' memory types. |
Comment by Pavel Timofeev [ 2011 May 10 ] |
Latest patch. Tested under FreeBSD 8.2 RELEASE and Zabbix-1.8.5 from ports tree. |
Comment by Pavel Timofeev [ 2011 May 10 ] |
TOTAL RESULT: And I think 'pfree' memory type need to rename to 'pavailable'. Waiting for you marks! |
Comment by Pavel Timofeev [ 2011 Aug 10 ] |
I'm showing a few screenshots of server that works with my patch. |
Comment by Pavel Timofeev [ 2011 Aug 10 ] |
Please, talk with me =) |
Comment by Pavel Timofeev [ 2011 Aug 18 ] |
Please, read http://www.absolutebsd.com/AbsoluteBSD18.pdf |
Comment by Pavel Timofeev [ 2011 Aug 31 ] |
small correction: don't delete "shared" memory type (like in my patch). |
Comment by Pavel Timofeev [ 2011 Aug 31 ] |
When you'll solve this PR I would like to discuss about other OS and their memory types. |
Comment by richlv [ 2011 Sep 09 ] |
it might be worth attaching latest patch to this issue |
Comment by Pavel Timofeev [ 2011 Nov 10 ] |
I want to discuss about some thing like common type of memory. It is general problem. |
Comment by Pavel Timofeev [ 2011 Nov 10 ] |
All existing monitoring things (like snmp and monitoring systems) are imbrued with linuxism. For monitoring purposes: But other UNIX's have similar and different types: We need to think about it: this types are responsible for different things. May be we need to introduce COMMON types like Available and Filled (for example) and specific types for each unix. |
Comment by Aleksandrs Saveljevs [ 2011 Nov 23 ] |
Pavel, thanks for the inspiration! Below is a list of user-visible changes that were done under this issue.
Now, the main part. As Pavel mentioned, different operating systems use different memory types and different terms to describe them. We have decided that item "vm.memory.size" will support all these specific terms for each platform: for instance, "vm.memory.size[wired]" on FreeBSD and "vm.memory.size[exec]" on NetBSD. However, sometimes these specific memory types are not needed. What is really needed is a user-level estimate of how much memory is used and how much memory is available. Items "vm.memory.size[used]", "vm.memory.size[pused]" and "vm.memory.size[available]", "vm.memory.size[pavailable]" are intended to provide these estimates. Note that "vm.memory.size[used]" plus "vm.memory.size[available]" do not necessarily equal total. For instance, on FreeBSD active, inactive, wired, cached memories are considered used, because they store some useful information. At the same time inactive, cached, free memories (note that "free" here is a specific memory term, thus "pfree" is not very useful) are considered available, because these kinds of memories can be given instantly to processes that request more memory. So, for example, inactive memory is both used and available simultaneously. Because of this, item "vm.memory.size[used]" is designed for informational purposes only, while item "vm.memory.size[available]" is designed for triggers. These user-level estimate items are available for all platforms. The full list of supported arguments to "vm.memory.size" is available in the documentation. What still remains to be done is to figure out the purpose of "vm.memory.size[buffers]", "vm.memory.size[cached]", "vm.memory.size[shared]" on NetBSD and "vm.memory.size[cached]", "vm.memory.size[shared]" on OpenBSD. Another thing is that on OpenBSD the sum of "vm.memory.size[used]" and "vm.memory.size[available]" is less than "vm.memory.size[total]", which is also something that needs to be improved. |
Comment by Aleksandrs Saveljevs [ 2011 Nov 23 ] |
Available in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1024 . |
Comment by Pavel Timofeev [ 2011 Nov 23 ] |
Good explanation and solution =) Thank you very much! |
Comment by Aleksandrs Saveljevs [ 2011 Nov 29 ] |
One of the things I seem to have not done is add division by zero checks in vm.memory.size[pfree] and vm.memory.size[pavailable] for all platforms. I am not sure they are needed, though. |
Comment by dimir [ 2011 Dec 01 ] |
I guess you meant pused and pavailable. The checks are partly there so I think it makes sense to add the missing ones. |
Comment by dimir [ 2011 Dec 05 ] |
So, as I mentioned above currently vm.memory.size checks support "pused" instead of "pfree". Let's try to use "pused" on netbsd 5.0: for i in total used pused; do echo -n "$i : "; bin/zabbix_get -s netbsd50 -k vm.memory.size[$i]; done "used" is greater than "total" so we end up with used 123 %. This is because "used" includes file pages, which are not included in "total". Let's check the description of vm.memory.size[used] in 2.0 manual: "Note that the sum of vm.memory.size[used] and vm.memory.size[available] does not necessarily equal total. For instance, on FreeBSD active, inactive, wired, cached memories are considered used, because they store some useful information. At the same time inactive, cached, free memories are considered available, because these kinds of memories can be given instantly to processes that request more memory. So inactive memory is both used and available simultaneously. Because of this, item vm.memory.size[used] is designed for informational purposes only, while item vm.memory.size[available] is designed to be used in triggers." This sounds logical but do we really want to support vm.memory.size[pused]? If "used" is informative, that's OK but I don't see much sense in relating this value to "total". Opinions? |
Comment by dimir [ 2011 Dec 06 ] |
(1) "Inactive" in *BSD systems should not be included in "used" calculation. The inactive memory has valid content, but is marked as not used. <dimir> Now this looks much better: $ for i in total used pused available pavailable; do echo -n "$i : "; bin/zabbix_get -s netbsd50 -k vm.memory.size[$i]; done RESOLVED in r23816 <dimir> CLOSED, moved to (2) |
Comment by dimir [ 2012 Jan 03 ] |
(2) Tested successfully. Now someone will have to check my changes from r23601 (including) up to the latest. <Sasha> CLOSED |
Comment by dimir [ 2012 Jan 03 ] |
(3) Please review next changes to docs before I publish them:
<richlv> 'real' - how about 'physical' ? <dimir> I agree to all above. <Sasha> added support of vm.memory.size[active] on HPUX |
Comment by Pavel Timofeev [ 2012 Jan 04 ] |
> available - Inactive + free memory why don't you add cached memory to available calculation? |
Comment by dimir [ 2012 Jan 04 ] |
Great point, Pavel. It's actually there, I must fix the description. Also I spotted a couple of platforms where this isn't included in available. |
Comment by dimir [ 2012 Jan 19 ] |
New page added: http://www.zabbix.com/documentation/2.0/manual/appendix/items/vm.memory.size_params |
Comment by dimir [ 2012 Jan 19 ] |
Fixed in pre-1.9.9 r24902. |