zabbix_agentd: updated to 1.6.2 (without extended cpustats)

This commit is contained in:
Mikhail Kolesnik 2009-02-13 12:28:42 +02:00
parent 89f07776b1
commit 832c3b0430
6 changed files with 13 additions and 352 deletions

View File

@ -1,4 +1,3 @@
4fbea19748b7e9a894a18f4e11b988ca zabbix-1.4.6.tar.gz
e2dfb4636a126d4f0113c8611a14df69 zabbix-cpustats.patch
9581d0439563883e13dd748d8ba0938f zabbix_agentd
8509a8d5141d72fe033e334fd90fde4f zabbix_agentd.conf
33da3661868a04042c596a819896446f zabbix-1.6.2.tar.gz
bc2e7ce7694d32379188c547acd0b04e zabbix_agentd
227c924011d0cb56cebbf2b09b2b7c05 zabbix_agentd.conf

View File

@ -4,14 +4,15 @@
# Depends on:
name=zabbix_agentd
version=1.4.6
version=1.6.2
release=1
source=(http://dl.sourceforge.net/sourceforge/zabbix/zabbix-$version.tar.gz \
zabbix_agentd.conf zabbix_agentd zabbix-cpustats.patch)
zabbix_agentd.conf zabbix_agentd)
#zabbix-cpustats.patch)
build() {
cd zabbix-$version
patch -p1 -i $SRC/zabbix-cpustats.patch
#patch -p1 -i $SRC/zabbix-cpustats.patch
./configure --prefix=/usr \
--enable-agent
make

View File

@ -16,10 +16,9 @@ something useful.
3. Run post-install to create dedicated user for the agent instead of 'daemon'.
PRECAUTION
Before port version 1.4.4-2 'zbxagent' group was used as a pimary group of
'zbxagent' user. Later it was changed (in post-install) to 'zabbix' to fix log
files rotation issue in the directory shared with the zabbix server. Now it
should be safe to remove unused zbxagent group by hand.
PRECAUTION
Be aware that 1.6.x branch of the agent does not have extended cpustats patch.
You can use an old version of this port (with a patched 1.4.x agent) along with
1.6.x server without ineroperability problems.
RESOURCES

View File

@ -1,338 +0,0 @@
diff -Nru zabbix-1.4.6-orig/src/libs/zbxsysinfo/linux/cpu.c zabbix-1.4.6/src/libs/zbxsysinfo/linux/cpu.c
--- zabbix-1.4.6-orig/src/libs/zbxsysinfo/linux/cpu.c 2008-08-20 16:59:42.977365403 +0300
+++ zabbix-1.4.6/src/libs/zbxsysinfo/linux/cpu.c 2008-08-20 17:01:57.529362814 +0300
@@ -131,13 +131,12 @@
}
- if( 0 == strcmp(type,"idle"))
+ if( 0 == strcmp(type,"user"))
{
- if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle1)
- else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle5)
- else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle15)
+ if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user1)
+ else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user5)
+ else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user15)
else return SYSINFO_RET_FAIL;
-
}
else if( 0 == strcmp(type,"nice"))
{
@@ -147,13 +146,6 @@
else return SYSINFO_RET_FAIL;
}
- else if( 0 == strcmp(type,"user"))
- {
- if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user1)
- else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user5)
- else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user15)
- else return SYSINFO_RET_FAIL;
- }
else if( 0 == strcmp(type,"system"))
{
if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].system1)
@@ -161,6 +153,42 @@
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,"idle"))
+ {
+ if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle1)
+ else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle5)
+ else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].idle15)
+ else return SYSINFO_RET_FAIL;
+
+ }
+ else if( 0 == strcmp(type,"iowait"))
+ {
+ 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 -Nru zabbix-1.4.6-orig/src/zabbix_agent/cpustat.c zabbix-1.4.6/src/zabbix_agent/cpustat.c
--- zabbix-1.4.6-orig/src/zabbix_agent/cpustat.c 2008-08-20 16:59:42.969366586 +0300
+++ zabbix-1.4.6/src/zabbix_agent/cpustat.c 2008-08-20 17:00:59.393365475 +0300
@@ -258,9 +258,13 @@
int cpuid,
int *now,
zbx_uint64_t *cpu_user,
- zbx_uint64_t *cpu_system,
zbx_uint64_t *cpu_nice,
- zbx_uint64_t *cpu_idle
+ zbx_uint64_t *cpu_system,
+ 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
)
{
@@ -296,7 +300,7 @@
return 1;
}
- *cpu_user = *cpu_nice = *cpu_system = *cpu_idle = -1;
+ *cpu_user = *cpu_nice = *cpu_system = *cpu_idle = *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = 0;
zbx_snprintf(cpu_name, sizeof(cpu_name), "cpu%c ", cpuid > 0 ? '0' + (cpuid - 1) : ' ');
@@ -304,7 +308,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);
@@ -363,9 +368,13 @@
int cpuid,
int now,
zbx_uint64_t cpu_user,
- zbx_uint64_t cpu_system,
zbx_uint64_t cpu_nice,
- zbx_uint64_t cpu_idle
+ zbx_uint64_t cpu_system,
+ 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
)
{
register int i = 0;
@@ -376,22 +385,38 @@
time15 = 0;
zbx_uint64_t
- idle = 0,
- idle1 = 0,
- idle5 = 0,
- idle15 = 0,
user = 0,
user1 = 0,
user5 = 0,
user15 = 0,
- system = 0,
- system1 = 0,
- system5 = 0,
- system15= 0,
nice = 0,
nice1 = 0,
nice5 = 0,
nice15 = 0,
+ system = 0,
+ system1 = 0,
+ system5 = 0,
+ system15= 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,
all = 0,
all1 = 0,
all5 = 0,
@@ -408,11 +433,15 @@
curr_cpu->clock[i] = now;
user = curr_cpu->h_user[i] = cpu_user;
- system = curr_cpu->h_system[i] = cpu_system;
nice = curr_cpu->h_nice[i] = cpu_nice;
+ system = curr_cpu->h_system[i] = cpu_system;
idle = curr_cpu->h_idle[i] = cpu_idle;
+ iowait = curr_cpu->h_iowait[i] = cpu_iowait;
+ irq = curr_cpu->h_irq[i] = cpu_irq;
+ softirq = curr_cpu->h_softirq[i]= cpu_softirq;
+ steal = curr_cpu->h_steal[i] = cpu_steal;
- all = cpu_idle + cpu_user + cpu_nice + cpu_system;
+ all = cpu_user + cpu_nice + cpu_system + cpu_idle + cpu_iowait + cpu_irq + cpu_softirq + cpu_steal;
break;
}
}
@@ -425,22 +454,30 @@
if(curr_cpu->clock[i] == now)
{
- idle = curr_cpu->h_idle[i];
user = curr_cpu->h_user[i];
nice = curr_cpu->h_nice[i];
system = curr_cpu->h_system[i];
- all = idle + user + nice + system;
+ idle = curr_cpu->h_idle[i];
+ iowait = curr_cpu->h_iowait[i];
+ irq = curr_cpu->h_irq[i];
+ softirq = curr_cpu->h_softirq[i];
+ steal = curr_cpu->h_steal[i];
+ all = user + nice + system + idle + iowait + irq + softirq + steal;
}
#define SAVE_CPU_CLOCK_FOR(t) \
if((curr_cpu->clock[i] >= (now - (t * 60))) && (time ## t > curr_cpu->clock[i])) \
{ \
time ## t = curr_cpu->clock[i]; \
- idle ## t = curr_cpu->h_idle[i]; \
user ## t = curr_cpu->h_user[i]; \
nice ## t = curr_cpu->h_nice[i]; \
system ## t = curr_cpu->h_system[i]; \
- all ## t = idle ## t + user ## t + nice ## t + system ## t; \
+ 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]; \
+ all ## t = user ## t + nice ## t + system ## t + idle ## t + iowait ## t + irq ## t + softirq ## t + steal ##t; \
}
SAVE_CPU_CLOCK_FOR(1);
@@ -459,10 +496,6 @@
curr_cpu->type ## time = 0.; \
}
- CALC_CPU_LOAD(idle, 1);
- CALC_CPU_LOAD(idle, 5);
- CALC_CPU_LOAD(idle, 15);
-
CALC_CPU_LOAD(user, 1);
CALC_CPU_LOAD(user, 5);
CALC_CPU_LOAD(user, 15);
@@ -474,6 +507,26 @@
CALC_CPU_LOAD(system, 1);
CALC_CPU_LOAD(system, 5);
CALC_CPU_LOAD(system, 15);
+
+ CALC_CPU_LOAD(idle, 1);
+ 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(irq, 1);
+ CALC_CPU_LOAD(irq, 5);
+ CALC_CPU_LOAD(irq, 15);
}
#endif /* not _WINDOWS */
@@ -593,14 +646,14 @@
register int i = 0;
int now = 0;
- zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle;
+ zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal;
for ( i = 0; i <= pcpus->count; i++ )
{
- if(0 != get_cpustat(i, &now, &cpu_user, &cpu_system, &cpu_nice, &cpu_idle))
+ if(0 != get_cpustat(i, &now, &cpu_user, &cpu_nice, &cpu_system, &cpu_idle, &cpu_iowait, &cpu_irq, &cpu_softirq, &cpu_steal))
continue;
- apply_cpustat(pcpus, i, now, cpu_user, cpu_system, cpu_nice, cpu_idle);
+ apply_cpustat(pcpus, i, now, cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal);
}
#endif /* _WINDOWS */
diff -Nru zabbix-1.4.6-orig/src/zabbix_agent/cpustat.h zabbix-1.4.6/src/zabbix_agent/cpustat.h
--- zabbix-1.4.6-orig/src/zabbix_agent/cpustat.h 2008-08-20 16:59:42.969366586 +0300
+++ zabbix-1.4.6/src/zabbix_agent/cpustat.h 2008-08-20 17:00:59.393365475 +0300
@@ -69,23 +69,39 @@
/* private */
int clock[MAX_CPU_HISTORY];
zbx_uint64_t h_user[MAX_CPU_HISTORY];
- zbx_uint64_t h_system[MAX_CPU_HISTORY];
zbx_uint64_t h_nice[MAX_CPU_HISTORY];
+ zbx_uint64_t h_system[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];
/* public */
- double idle1;
- double idle5;
- double idle15;
double user1;
double user5;
double user15;
- double system1;
- double system5;
- double system15;
double nice1;
double nice5;
double nice15;
+ double system1;
+ double system5;
+ double system15;
+ 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;
} ZBX_SINGLE_CPU_STAT_DATA;

View File

@ -8,7 +8,7 @@ start)
su daemon -c /usr/bin/zabbix_agentd
;;
stop)
killall -q /usr/bin/zabbix_agentd
kill `cat /var/run/zabbix_agentd/zabbix_agentd.pid`
;;
restart)
$0 stop

View File

@ -65,7 +65,7 @@ PidFile=/var/run/zabbix_agentd/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
# Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
#LogFileSize=1
LogFileSize=10
# Spend no more than Timeout seconds on processing
# Must be between 1 and 30