Ad Widget

Collapse

Threads counted as processes

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

    #1

    Threads counted as processes

    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);
  • skogan
    Member
    • Nov 2007
    • 70

    #2
    This bug is still there in 1.6! I guess for some people it's hard to imagine that anybody uses any other flavor of Linux besides Ubuntu

    Comment

    Working...