[ZBX-12070] proc.num[zabbix_agentd] increase in Ubuntu 16.04 Created: 2017 Apr 19  Updated: 2024 Apr 10  Resolved: 2018 Jul 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: 3.0.19rc1, 3.4.11rc1, 4.0.0alpha8, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Hayato Watanabe Assignee: Michael Veksler
Resolution: Fixed Votes: 0
Labels: proc.mem, proc.num
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

zabbix agent 3.0.x


Issue Links:
Duplicate
is duplicated by ZBX-13622 Agent items proc.num and proc.mem cou... Closed
Team: Team A
Sprint: Sprint 33, Sprint 34, Sprint 35, Sprint 36, Sprint 37, Sprint 38
Story Points: 0.25

 Description   

If you monitor "proc.num [zabbix_agentd]" in Ubuntu 16.04, the return value will increase.

Ubuntu16.04
root@hayato-MS-7673:~# uname -a
Linux hayato-MS-7673 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

root@hayato-MS-7673:~# grep ^Name /proc/*/status | grep zabbix_agentd
/proc/5262/status:Name: zabbix_agentd
/proc/5263/status:Name: zabbix_agentd
/proc/5264/status:Name: zabbix_agentd
/proc/5265/status:Name: zabbix_agentd

root@hayato-MS-7673:~# zabbix_agentd -t proc.num[zabbix_agentd,,,]
proc.num[zabbix_agentd,,,]                    [u|6]

-----------------------
proces is
  1. PID... 5262
  2. PID... 5263
  3. PID... 5264
  4. PID... 5265
  5. command "zabbix_agentd -t proc.num[zabbix_agentd,,,]"
  6. ???

Is it a problem loading "/proc/thread-self/status" ?



 Comments   
Comment by Kim Jongkwon [ 2017 Apr 19 ]

I think will occur on Kernel Version 3.17+ because /proc/thread-self/

       /proc/thread-self (since Linux 3.17)
              This directory refers to the thread accessing the /proc
              filesystem, and is identical to the /proc/self/task/[tid]
              directory named by the process thread ID ([tid]) of the same
              thread.

It leads to incorrect results for proc.num[zabbix_agentd] self monitoring.

Comment by richlv [ 2017 Apr 19 ]

to clarify, the problem description above already includes "zabbix_agentd -t..." process (numbered item 5), but there is an unexpected 6th item.

Comment by Glebs Ivanovskis (Inactive) [ 2017 Apr 21 ]

Explanation looks very plausible. Quick testing with such debug logging:

Index: src/libs/zbxsysinfo/linux/proc.c
===================================================================
--- src/libs/zbxsysinfo/linux/proc.c	(revision 67457)
+++ src/libs/zbxsysinfo/linux/proc.c	(working copy)
@@ -805,6 +805,8 @@
 		if (FAIL == check_procstate(f_stat, zbx_proc_stat))
 			continue;
 
+		printf("%s ", entries->d_name);
+
 		proccount++;
 	}
 	zbx_fclose(f_cmd);

yields the following result (no agents running in the background):

$ src/zabbix_agent/zabbix_agentd -t 'proc.num[zabbix_agentd]'
proc.num[zabbix_agentd]                      thread-self 19230  [u|2]
$ uname -sr
Linux 4.4.0-72-generic
Comment by Glebs Ivanovskis (Inactive) [ 2018 Apr 29 ]

Duplicate ZBX-13622 contains a patch and, perhaps, more details.

Comment by Sergejs Paskevics [ 2018 Jun 06 ]

Implemented in:

  • 3.0.19rc1 r81593,
  • 3.4.11rc1 r81594,
  • pre4.0.0alpha8 (trunk) r81595.
Generated at Thu Apr 25 08:06:18 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.