Ad Widget

Collapse

system.cpu.num for OpenBSD (needs testing)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freak
    Member
    • Oct 2007
    • 52

    #1

    system.cpu.num for OpenBSD (needs testing)

    Hi,

    based on the changes I already posted in http://www.zabbix.com/forum/showthread.php?t=8116 I added system.cpu.num for OpenBSD. I copied my changes to trunk now, since the codebase in svn seems to be the same in trunk and tags/1.4.2/

    sysctl on OpenBSD 4.1 doesn't seem to be able to differentiate between online and max, correct me on that if I'm wrong. I don't have a SMP environment to test it anyways.

    So system.cpu.num[whatever] will always return the same value as sysctl -a hw.ncpu:

    ./src/libs/zbxsysinfo/openbsd/cpu.c
    Code:
    --- trunk-sra/src/libs/zbxsysinfo/openbsd/cpu.c 2007-10-18 19:47:39.000000000 +0200
    +++ trunk/src/libs/zbxsysinfo/openbsd/cpu.c     2007-10-18 18:26:27.000000000 +0200
    @@ -23,23 +23,7 @@
    
     int    SYSTEM_CPU_NUM(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
     {
    -       int ret = SYSINFO_RET_FAIL;
    -       int mib[2];
    -       long ncpu;
    -       size_t len;
    -
    -       mib[0] = CTL_HW;
    -       mib[1] = HW_NCPU;
    -
    -       len = sizeof(ncpu);
    -
    -       if (sysctl(mib, 2, &ncpu, (size_t *) &len, NULL, 0) == 0)
    -       {
    -               SET_UI64_RESULT(result, ncpu);
    -               ret = SYSINFO_RET_OK;
    -       }
    -
    -       return ret;
    +       return SYSINFO_RET_FAIL;
     }
    
     static int get_cpu_data(unsigned long long *idle,
    So, please let me know what you think and what you find testing it..

    Sebastian

    PS: I forgot the "return ret;" at the end.
    Last edited by freak; 18-10-2007, 19:49.
Working...