[ZBX-3897] proc.num show incorrect data under FreeBSD Created: 2011 Jun 19 Updated: 2017 May 30 Resolved: 2012 May 09 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 1.8.5 |
Fix Version/s: | 1.8.14rc1, 2.0.1rc1, 2.1.0 |
Type: | Incident report | Priority: | Major |
Reporter: | gescheit | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 4 |
Labels: | freebsd | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
FreeBSD |
Attachments: | proc.c+vsz.patch proc.c.patch | ||||||||
Issue Links: |
|
Description |
proc.num show incorrect data under FreeBSD. Example: ps ax|wc -l zabbix_agentd -t proc.num[] |
Comments |
Comment by Oleksii Zagorskyi [ 2011 Jun 19 ] |
Several users can confirm the same: http://www.zabbix.com/forum/showthread.php?t=22322 |
Comment by Alexander Vladishev [ 2011 Jun 20 ] |
Confirmed in version pre1.8.6, r20279. |
Comment by Ya Bo [ 2012 Feb 11 ] |
FreeBSD 9.0, zabbix-agent-1.8.10,2 zabbix-1.8.10/src/libs/zbxsysinfo/freebsd/proc.c не работает, в результате имеем +системные треды |
Comment by Oleksii Zagorskyi [ 2012 Feb 28 ] |
related issue |
Comment by Jim Riggs [ 2012 Mar 28 ] |
Please try the attached patch. It correctly calls sysctl() for proc.num and proc.mem with KERN_PROC_PROC instead of KERN_PROC_ALL for FreeBSD 5 and later. (Is this check really necessary anymore? Is < v5 supported?) This has fixed the issue in my environment. |
Comment by Ya Bo [ 2012 Mar 29 ] |
FreeBSD 8.3-PRERELEASE confirm, patch is good |
Comment by Pavel Timofeev [ 2012 Mar 29 ] |
thanks to Jim! proc.num work on FreeBSD 9.0-RELEASE amd64. But I can't decide about proc.mem. Which unit does proc.mem return? Kbytes, bytes, etc.? Documentation didn't help=( |
Comment by richlv [ 2012 Mar 30 ] |
regarding documentation, could you please open another issue (documentation component) ? |
Comment by Pavel Timofeev [ 2012 Apr 03 ] |
Comment by Pavel Timofeev [ 2012 Apr 03 ] |
Jim, does proc.mem work for you? |
Comment by Pavel Timofeev [ 2012 Apr 03 ] |
Jim's patch applied 2232320 Bytes = 2180 KBytes but != 12184 KBytes or 1340 KBytes returned by ps |
Comment by Jim Riggs [ 2012 Apr 25 ] |
The "memory usage" of a process is a controversial and subjective topic. There are many different views about what actually constitutes a proc's memory usage. Currently, the zabbix code is using text size + data size + stack size for proc.mem (ki_tsize + ki_dsize + ki_ssize), whereas `top' and `ps' display resident size (ki_rssize) and VM size (ki_size). This is why the values from zabbix vs. top and ps are different. I would think that to eliminate confusion and to make the zabbix value more "verifiable," we should probably switch to using ki_rssize. Thoughts? What are other OSes doing? I haven't dug into the linux code, for example. |
Comment by richlv [ 2012 Apr 26 ] |
i suppose we will want to match some value(s) from standard tools like ps if only to reduce the confusion - as noted, there is no definite "used memory" value, it's all quite relative. |
Comment by Jim Riggs [ 2012 Apr 26 ] |
Attached is proc.c+rss.patch which includes the original patch plus a switch to using the resident size for proc.mem as discussed. This works for me in FreeBSD 8 and 9 for single and multiple processes. It would be nice to get these issues fixed sooner rather than later, if possible. The proc.num issue, specifically, has been causing problems for quite some time. |
Comment by Jim Riggs [ 2012 Apr 26 ] |
I guess the question still remains, is resident size what people expect from proc.mem or VM size? Resident is closer to what the value was before, but VM size might give a better picture of actual memory footprint. Hrm. Looking at the Linux agent, it is pulling the VM size (vsz). We should probably match. New patch coming... |
Comment by Jim Riggs [ 2012 Apr 26 ] |
OK, proc.c+vsz.patch should be good to go. Original patch to fix proc.num + vsize patch to "fix" proc.mem on FreeBSD. Tested on FreeBSD 8 and 9. |
Comment by Oleksii Zagorskyi [ 2012 Apr 26 ] |
Jim, I'm sorry, it's not related to proc.mem, but do you know about changes for agent 2.0 ? I think would be better to not mix here discussion about proc.num and proc.mem Also see |
Comment by Pavel Timofeev [ 2012 Apr 26 ] |
Oleksiy Zagorskyi, |
Comment by Pavel Timofeev [ 2012 Apr 26 ] |
> Jim Riggs added a comment - 2012 Apr 26 07:07 Excellent, Jim! Patch works fine on FreeBSD 9-RELEASE amd64. I hope this patch will be included in the nearest release. |
Comment by Alexander Vladishev [ 2012 May 09 ] |
Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-3897 Fixed incorrect processing of proc.num[] item. |
Comment by dimir [ 2012 May 14 ] |
I wonder why do I get less processes with zabbix get on FreeBSD 7.3. I tried 1.8.5, latest 1.8 with and without the fix: $ uname -a $ ps ax|wc -l $ bin/zabbix_get -s 127.0.0.1 -k agent.version $ bin/zabbix_get -s 127.0.0.1 -k agent.version
|
Comment by dimir [ 2012 May 14 ] |
It appeared to be a problem on my side, please ignore the comment above. |
Comment by dimir [ 2012 May 14 ] |
Successfully tested, now the number of processes is reported properly. |
Comment by Alexander Vladishev [ 2012 May 15 ] |
Fixed in versions pre-1.8.14 r27534, pre-2.0.1 r27689, pre-2.1.0 (beta) r27694 |