The following is a patch of a problem where Zabbix agent counts threads as processes on systems running kernel 2.4 (RedHat EL3, for example). This happens because on these systems threads appear as directories under /proc (just like processes) the only difference being a leading "."
Code:
1.4.2.orig/src/libs/zbxsysinfo/linux/proc.c 2007-08-20 19:22:23.000000000 +0000
+++ zabbix-1.4.2/src/libs/zbxsysinfo/linux/proc.c 2007-11-22 20:50:14.000000000 +0000
@@ -151,6 +151,12 @@
continue;
}
+ /* Ignore threads -- by Stanislav Kogan, TELUS */
+ if(entries->d_name[0]=='.')
+ {
+ continue;
+ }
+
if(stat(filename,&buf)==0)
{
if(NULL == ( f = fopen(filename,"r") ))
@@ -431,6 +437,12 @@
{
continue;
}
+
+ /* Ignore threads -- by Stanislav Kogan, TELUS */
+ if(entries->d_name[0]=='.')
+ {
+ continue;
+ }
strscpy(filename,"/proc/");
zbx_strlcat(filename,entries->d_name,MAX_STRING_LEN);
Comment