Ad Widget

Collapse

PATCH: fix for system.cpu.util on Solaris

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • art
    Junior Member
    • Oct 2006
    • 12

    #1

    PATCH: fix for system.cpu.util on Solaris

    Looks like current SYSTEM_CPU_UTIL function uses kstat system calls which returns cpu utilisation counters since last reboot(?) - therefore zabbix shows average cpu utilisation for quite long period of time instead of current state of things. Though I'm not a C programmer (well, not programmer at all) I patched cpu.c so it now returns more meaningful data ( more or less the same as sar does).

    Again, I'm not programmer and possibly there is more correct way to work with kstat data but it works for us ( tested on Solaris9 ).

    Patch (against zabbix-1.1.2/src/libs/zbxsysinfo/solaris/cpu.c):


    79a80,81
    > unsigned long long cpu_val_s[4];
    > unsigned long long cpu_val_e[4];
    140c142
    < if (get_cpu_data(&cpu_val[CPU_I], &cpu_val[CPU_K], &cpu_val[CPU_U], &cpu_val[CPU_W]))
    ---
    > if (get_cpu_data(&cpu_val_s[CPU_I], &cpu_val_s[CPU_K], &cpu_val_s[CPU_U], &cpu_val_s[CPU_W]))
    141a144,149
    > sleep(5);
    > int q = get_cpu_data(&cpu_val_e[CPU_I], &cpu_val_e[CPU_K], &cpu_val_e[CPU_U], &cpu_val_e[CPU_W]);
    > cpu_val[CPU_I] = cpu_val_e[CPU_I] - cpu_val_s[CPU_I];
    > cpu_val[CPU_K] = cpu_val_e[CPU_K] - cpu_val_s[CPU_K];
    > cpu_val[CPU_U] = cpu_val_e[CPU_U] - cpu_val_s[CPU_U];
    > cpu_val[CPU_W] = cpu_val_e[CPU_W] - cpu_val_s[CPU_W];
    Edit/Delete Message
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    It has been implemented for Solaris yet differently. Thanks.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • themons
      Senior Member
      • Feb 2005
      • 110

      #3
      which version

      In which version this patch will be implemented
      Zabbix 1.8.3
      SLES 11 x64

      French Zabbix user

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        It will be part of 1.1.5 and 1.3.3 and later releases.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • themons
          Senior Member
          • Feb 2005
          • 110

          #5
          Could you post the patched CPU.C
          Or is it available in the cvs.

          I need to instal agent on solaris servers they will be in production next week, so non change will be possible.
          Zabbix 1.8.3
          SLES 11 x64

          French Zabbix user

          Comment

          Working...