|
From: Beat K. <bea...@vi...> - 2010-06-09 15:38:48
|
Hi
I found a copy and paste bug in the solaris part of cpu monitoring,
which does refuse to collect iowait data on solaris machines.
The following patch was created against version 1.8.2 and does fix this
issue, as far as i can see, the bug is still present in the never
versions, and thus the patch should applied against SVN also.
Keep in mind that Solaris 10 and up does not report iowait values
anymore, thus you will aways get 0 back, but at least the agent does not
refuse the item anymore and everything works fine on the older solaris
versions.
Regards,
Beat Kneubuehl
*** ./zabbix-1.8.2/src/zabbix_agent/cpustat.c Tue Jun 8 16:07:01 2010
--- ./zabbix-1.8.2/src/zabbix_agent/cpustat.c.fixed Tue Jun 8
16:08:26 2010
***************
*** 325,331 ****
*cpu_idle += cpu->cpu_sysinfo.cpu[CPU_IDLE];
*cpu_user += cpu->cpu_sysinfo.cpu[CPU_USER];
*cpu_system += cpu->cpu_sysinfo.cpu[CPU_KERNEL];
! *cpu_nice += cpu->cpu_sysinfo.cpu[CPU_WAIT];
}
k = k->ks_next;
}
--- 325,331 ----
*cpu_idle += cpu->cpu_sysinfo.cpu[CPU_IDLE];
*cpu_user += cpu->cpu_sysinfo.cpu[CPU_USER];
*cpu_system += cpu->cpu_sysinfo.cpu[CPU_KERNEL];
! *cpu_iowait += cpu->cpu_sysinfo.cpu[CPU_WAIT];
}
k = k->ks_next;
}
***************
*** 349,355 ****
*cpu_idle = cpu->cpu_sysinfo.cpu[CPU_IDLE];
*cpu_user = cpu->cpu_sysinfo.cpu[CPU_USER];
*cpu_system = cpu->cpu_sysinfo.cpu[CPU_KERNEL];
! *cpu_nice = cpu->cpu_sysinfo.cpu[CPU_WAIT];
}
kstat_close(kc);
--- 350,356 ----
*cpu_idle = cpu->cpu_sysinfo.cpu[CPU_IDLE];
*cpu_user = cpu->cpu_sysinfo.cpu[CPU_USER];
*cpu_system = cpu->cpu_sysinfo.cpu[CPU_KERNEL];
! *cpu_iowait = cpu->cpu_sysinfo.cpu[CPU_WAIT];
}
kstat_close(kc);
*** ./zabbix-1.8.2/src/libs/zbxsysinfo/solaris/cpu.c Tue Jun 8
16:07:08 2010
--- ./zabbix-1.8.2/src/libs/zbxsysinfo/solaris/cpu.c.fixed Tue Jun 8
16:08:17 2010
***************
*** 111,122 ****
if ('\0' == *type || 0 == strcmp(type, "user")) /* default
parameter */
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user[mode])
! else if (0 == strcmp(type, "wait"))
! SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].nice[mode])
else if (0 == strcmp(type, "kernel"))
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].system[mode])
else if (0 == strcmp(type, "idle"))
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle[mode])
else
return SYSINFO_RET_FAIL;
--- 111,122 ----
if ('\0' == *type || 0 == strcmp(type, "user")) /* default
parameter */
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user[mode])
! else if (0 == strcmp(type, "iowait"))
! SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].iowait[mode])
else if (0 == strcmp(type, "kernel"))
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].system[mode])
else if (0 == strcmp(type, "idle"))
SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle[mode])
else
return SYSINFO_RET_FAIL;
|