diff -ur zabbix-1.6.1/src/libs/zbxsysinfo/linux/cpu.c zabbix-1.6.1-patched/src/libs/zbxsysinfo/linux/cpu.c --- zabbix-1.6.1/src/libs/zbxsysinfo/linux/cpu.c 2008-11-04 22:44:59.000000000 +0100 +++ zabbix-1.6.1-patched/src/libs/zbxsysinfo/linux/cpu.c 2008-11-05 01:31:39.000000000 +0100 @@ -154,6 +154,38 @@ else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].system15) else return SYSINFO_RET_FAIL; } + else if( 0 == strcmp(type,"wait")) + { + if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].iowait1) + else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].iowait5) + else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].iowait15) + else return SYSINFO_RET_FAIL; + + } + else if( 0 == strcmp(type,"irq")) + { + if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].irq1) + else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].irq5) + else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].irq15) + else return SYSINFO_RET_FAIL; + + } + else if( 0 == strcmp(type,"softirq")) + { + if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].softirq1) + else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].softirq5) + else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].softirq15) + else return SYSINFO_RET_FAIL; + + } + else if( 0 == strcmp(type,"steal")) + { + if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].steal1) + else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].steal5) + else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].steal15) + else return SYSINFO_RET_FAIL; + + } else { return SYSINFO_RET_FAIL; diff -ur zabbix-1.6.1/src/zabbix_agent/cpustat.c zabbix-1.6.1-patched/src/zabbix_agent/cpustat.c --- zabbix-1.6.1/src/zabbix_agent/cpustat.c 2008-11-04 22:45:00.000000000 +0100 +++ zabbix-1.6.1-patched/src/zabbix_agent/cpustat.c 2008-11-05 01:31:39.000000000 +0100 @@ -183,6 +183,10 @@ zbx_uint64_t *cpu_system, zbx_uint64_t *cpu_nice, zbx_uint64_t *cpu_idle, + zbx_uint64_t *cpu_iowait, + zbx_uint64_t *cpu_irq, + zbx_uint64_t *cpu_softirq, + zbx_uint64_t *cpu_steal, zbx_uint64_t *cpu_interrupt ) { @@ -225,7 +229,7 @@ return 1; } - *cpu_user = *cpu_system = *cpu_nice = *cpu_idle = -1; + *cpu_user = *cpu_system = *cpu_nice = *cpu_idle = *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = -1; *cpu_interrupt = 0; zbx_snprintf(cpu_name, sizeof(cpu_name), "cpu%c ", cpuid > 0 ? '0' + (cpuid - 1) : ' '); @@ -234,7 +238,8 @@ { if(strstr(line, cpu_name) == NULL) continue; - sscanf(line, "%*s " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64, cpu_user, cpu_nice, cpu_system, cpu_idle); + sscanf(line, "%*s " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64, + cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal); break; } zbx_fclose(file); @@ -252,6 +257,7 @@ *cpu_system = (zbx_uint64_t)stats.psd_cpu_time[CP_SYS]; *cpu_idle = (zbx_uint64_t)stats.psd_cpu_time[CP_IDLE]; *cpu_interrupt = 0; + *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = 0; } else if( cpuid > 0 ) { @@ -264,6 +270,7 @@ *cpu_nice = (zbx_uint64_t)psp.psp_cpu_time[CP_NICE]; *cpu_system = (zbx_uint64_t)psp.psp_cpu_time[CP_SYS]; *cpu_idle = (zbx_uint64_t)psp.psp_cpu_time[CP_IDLE]; + *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = 0; *cpu_interrupt = 0; } else @@ -285,6 +292,7 @@ *cpu_system = (zbx_uint64_t)cp_time[CP_SYS]; *cpu_interrupt = (zbx_uint64_t)cp_time[CP_INTR]; *cpu_idle = (zbx_uint64_t)cp_time[CP_IDLE]; + *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = 0; #elif defined(HAVE_FUNCTION_SYSCTL_KERN_CPTIME) /* OpenBSD 4.3 */ @@ -345,6 +353,10 @@ zbx_uint64_t cpu_system, zbx_uint64_t cpu_nice, zbx_uint64_t cpu_idle, + zbx_uint64_t cpu_iowait, + zbx_uint64_t cpu_irq, + zbx_uint64_t cpu_softirq, + zbx_uint64_t cpu_steal, zbx_uint64_t cpu_interrupt ) { @@ -355,6 +367,10 @@ system = 0, system1 = 0, system5 = 0, system15 = 0, nice = 0, nice1 = 0, nice5 = 0, nice15 = 0, idle = 0, idle1 = 0, idle5 = 0, idle15 = 0, + iowait = 0, iowait1 = 0, iowait5 = 0, iowait15 = 0, + irq = 0, irq1 = 0, irq5 = 0, irq15 = 0, + softirq = 0, softirq1 = 0, softirq5 = 0, softirq15 = 0, + steal = 0, steal1 = 0, steal5 = 0, steal15 = 0, interrupt = 0, interrupt1 = 0, interrupt5 = 0, interrupt15 = 0, all = 0, all1 = 0, all5 = 0, all15 = 0; @@ -371,9 +387,13 @@ curr_cpu->h_system[i] = system = cpu_system; curr_cpu->h_nice[i] = nice = cpu_nice; curr_cpu->h_idle[i] = idle = cpu_idle; + curr_cpu->h_iowait[i] = iowait = cpu_iowait; + curr_cpu->h_irq[i] = irq = cpu_irq; + curr_cpu->h_softirq[i] = softirq = cpu_softirq; + curr_cpu->h_steal[i] = steal = cpu_steal; curr_cpu->h_interrupt[i] = interrupt = cpu_interrupt; - all = cpu_user + cpu_system + cpu_nice + cpu_idle + cpu_interrupt; + all = cpu_user + cpu_system + cpu_nice + cpu_idle + cpu_interrupt + cpu_iowait + cpu_irq + cpu_softirq + cpu_steal; break; } @@ -392,8 +412,12 @@ system ## t = curr_cpu->h_system[i]; \ nice ## t = curr_cpu->h_nice[i]; \ idle ## t = curr_cpu->h_idle[i]; \ + iowait ## t = curr_cpu->h_iowait[i]; \ + irq ## t = curr_cpu->h_irq[i]; \ + softirq ## t = curr_cpu->h_softirq[i]; \ + steal ## t = curr_cpu->h_steal[i]; \ interrupt ## t = curr_cpu->h_interrupt[i]; \ - all ## t = user ## t + system ## t + nice ## t + idle ## t + interrupt ## t; \ + all ## t = user ## t + system ## t + nice ## t + idle ## t + iowait ## t + irq ## t + softirq ## t + steal ## t + interrupt ## t; \ } SAVE_CPU_CLOCK_FOR(1); @@ -428,6 +452,22 @@ CALC_CPU_LOAD(idle, 5); CALC_CPU_LOAD(idle, 15); + CALC_CPU_LOAD(iowait, 1); + CALC_CPU_LOAD(iowait, 5); + CALC_CPU_LOAD(iowait, 15); + + CALC_CPU_LOAD(irq, 1); + CALC_CPU_LOAD(irq, 5); + CALC_CPU_LOAD(irq, 15); + + CALC_CPU_LOAD(softirq, 1); + CALC_CPU_LOAD(softirq, 5); + CALC_CPU_LOAD(softirq, 15); + + CALC_CPU_LOAD(steal, 1); + CALC_CPU_LOAD(steal, 5); + CALC_CPU_LOAD(steal, 15); + CALC_CPU_LOAD(interrupt, 1); CALC_CPU_LOAD(interrupt, 5); CALC_CPU_LOAD(interrupt, 15); @@ -550,14 +590,14 @@ register int i = 0; int now = 0; - zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_interrupt; + zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal, cpu_interrupt; for ( i = 0; i <= pcpus->count; i++ ) { - if(0 != get_cpustat(i, &now, &cpu_user, &cpu_system, &cpu_nice, &cpu_idle, &cpu_interrupt)) + if(0 != get_cpustat(i, &now, &cpu_user, &cpu_system, &cpu_nice, &cpu_idle, &cpu_iowait, &cpu_irq, &cpu_softirq, &cpu_steal, &cpu_interrupt)) continue; - apply_cpustat(pcpus, i, now, cpu_user, cpu_system, cpu_nice, cpu_idle, cpu_interrupt); + apply_cpustat(pcpus, i, now, cpu_user, cpu_system, cpu_nice, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal, cpu_interrupt); } #endif /* _WINDOWS */ diff -ur zabbix-1.6.1/src/zabbix_agent/cpustat.h zabbix-1.6.1-patched/src/zabbix_agent/cpustat.h --- zabbix-1.6.1/src/zabbix_agent/cpustat.h 2008-11-04 22:45:00.000000000 +0100 +++ zabbix-1.6.1-patched/src/zabbix_agent/cpustat.h 2008-11-05 01:31:39.000000000 +0100 @@ -70,6 +70,10 @@ zbx_uint64_t h_system[MAX_CPU_HISTORY]; zbx_uint64_t h_nice[MAX_CPU_HISTORY]; zbx_uint64_t h_idle[MAX_CPU_HISTORY]; + zbx_uint64_t h_iowait[MAX_CPU_HISTORY]; + zbx_uint64_t h_irq[MAX_CPU_HISTORY]; + zbx_uint64_t h_softirq[MAX_CPU_HISTORY]; + zbx_uint64_t h_steal[MAX_CPU_HISTORY]; zbx_uint64_t h_interrupt[MAX_CPU_HISTORY]; /* public */ @@ -85,6 +89,18 @@ double idle1; double idle5; double idle15; + double iowait1; + double iowait5; + double iowait15; + double irq1; + double irq5; + double irq15; + double softirq1; + double softirq5; + double softirq15; + double steal1; + double steal5; + double steal15; double interrupt1; double interrupt5; double interrupt15;