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);