Ad Widget

Collapse

1.4.2 - threads counted as processes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skogan
    Member
    • Nov 2007
    • 70

    #1

    1.4.2 - threads counted as processes

    Hello.

    I'm deploying Zabbix on hour network over here and I noticed a little problem (if it's really a problem). Zabbix counts threads as processes on some systems (RHEL3, for example), which in hour case results in thousands of processes counted. The problem is that in kernel 2.4 threads are shown in /proc just like normal processes, except that the directory's name is prefixed with a "." .

    I patched the source to ignore these directories and now it counts everything properly. Do you people want the patch ?
  • skogan
    Member
    • Nov 2007
    • 70

    #2
    Not everybody at once, please!

    Here's the patch:
    Code:
    --- zabbix-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

    Working...