Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7

PATCH: CPU util on FreeBSD

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.4.3
    • Component/s: Agent (G)
    • Labels:
      None

      Description

      Hello! Here is a patch which allow use cpu.util in FreeBSD

      +++ src/zabbix_agent/cpustat.c
      @@ -297,7 +297,12 @@
      #elif defined(HAVE_SYS_PSTAT_H) /* HAVE_PROC_STAT */

      struct pst_dynamic stats;
      -
      +
      +#elif defined(HAVE_SYS_SYSCTL_H) /* HAVE_SYS_SYSCTL_H */
      +
      + static long cp_time[5];
      + size_t nlen = sizeof(cp_time);
      +
      #else /* HAVE_SYS_PSTAT_H */

      return;
      @@ -340,7 +345,20 @@
      cpu_nice = (float)stats.psd_cpu_time[CP_NICE];
      cpu_system = (float)stats.psd_cpu_time[CP_SYS];
      cpu_idle = (float)stats.psd_cpu_time[CP_IDLE];
      -
      +
      +#elif defined(HAVE_SYS_SYSCTL_H) /* HAVE_SYS_SYSCTL_H */
      +
      + if (sysctlbyname("kern.cp_time", &cp_time, &nlen, NULL, 0) == -1)
      + return;
      +
      + if (nlen != sizeof(cp_time))
      + return;
      +
      + cpu_user = (float)cp_time[0];
      + cpu_nice = (float)cp_time[1];
      + cpu_system = (float)cp_time[2];
      + cpu_idle = (float)cp_time[4];
      +
      #endif /* HAVE_SYS_PSTAT_H */

      add_values_cpustat(now,cpu_user, cpu_system, cpu_nice, cpu_idle);

      http://www.zabbix.com/forum/showthread.php?t=4542

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            alexei Alexei Vladishev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: