summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server/trapper
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-22 13:01:15 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-22 13:01:15 +0000
commite4fbe3d28b7dcba78a10d592a978215fcb0fb106 (patch)
treeb858f0a807861c90faabcf600132e451900bfa77 /src/zabbix_server/trapper
parent600a6f54db7bf168ef382095c7ed922efefb933d (diff)
downloadzabbix-e4fbe3d28b7dcba78a10d592a978215fcb0fb106.tar.gz
zabbix-e4fbe3d28b7dcba78a10d592a978215fcb0fb106.tar.xz
zabbix-e4fbe3d28b7dcba78a10d592a978215fcb0fb106.zip
- [DEV-109] Server changes - Trapper
git-svn-id: svn://svn.zabbix.com/trunk@5383 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/trapper')
-rw-r--r--src/zabbix_server/trapper/proxyconfig.c1
-rw-r--r--src/zabbix_server/trapper/trapper.c12
2 files changed, 8 insertions, 5 deletions
diff --git a/src/zabbix_server/trapper/proxyconfig.c b/src/zabbix_server/trapper/proxyconfig.c
index 5891c7cc..f0e5efea 100644
--- a/src/zabbix_server/trapper/proxyconfig.c
+++ b/src/zabbix_server/trapper/proxyconfig.c
@@ -144,6 +144,7 @@ static int get_proxyconfig_data(zbx_uint64_t proxyid, struct zbx_json *j)
};
static const struct proxytable_t pt[]={
+ {"proxies", NULL, NULL},
{"hosts", NULL, NULL},
{"items", "hosts", "hostid"},
{"drules", NULL, NULL},
diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c
index b09f9183..2db2f55c 100644
--- a/src/zabbix_server/trapper/trapper.c
+++ b/src/zabbix_server/trapper/trapper.c
@@ -337,7 +337,7 @@ static int process_new_values(zbx_sock_t *sock, struct zbx_json_parse *json)
DB_ROW row;
double sec;
zbx_uint64_t proxyid = 0;
- time_t now = 0;
+ time_t now = time(NULL), hosttime = 0, itemtime;
zabbix_log(LOG_LEVEL_DEBUG, "In process_new_values(json:%.*s)",
json->end - json->start + 1,
@@ -356,7 +356,7 @@ static int process_new_values(zbx_sock_t *sock, struct zbx_json_parse *json)
}
if (SUCCEED == zbx_json_value_by_name(json, ZBX_PROTO_TAG_CLOCK, clock, sizeof(clock)))
- now = atoi(clock);
+ hosttime = atoi(clock);
/* {"request":"ZBX_SENDER_DATA","data":[{"key":"system.cpu.num",...,...},{...},...]}
* ^
@@ -396,9 +396,11 @@ static int process_new_values(zbx_sock_t *sock, struct zbx_json_parse *json)
*timestamp = '\0';
*source = '\0';
*severity = '\0';
+ itemtime = now;
- if (SUCCEED == zbx_json_value_by_name(&jp_row, ZBX_PROTO_TAG_CLOCK, clock, sizeof(clock)))
- now = time(NULL) - (now - atoi(clock));
+ if (hosttime)
+ if (SUCCEED == zbx_json_value_by_name(&jp_row, ZBX_PROTO_TAG_CLOCK, clock, sizeof(clock)))
+ itemtime -= hosttime - atoi(clock);
if (FAIL == zbx_json_value_by_name(&jp_row, ZBX_PROTO_TAG_HOST, host, sizeof(host)))
continue;
@@ -418,7 +420,7 @@ static int process_new_values(zbx_sock_t *sock, struct zbx_json_parse *json)
zbx_json_value_by_name(&jp_row, ZBX_PROTO_TAG_LOGSEVERITY, severity, sizeof(severity));
DBbegin();
- if(SUCCEED == process_data(sock, proxyid, now, host, key, value, lastlogsize, timestamp, source, severity))
+ if(SUCCEED == process_data(sock, proxyid, itemtime, host, key, value, lastlogsize, timestamp, source, severity))
{
processed_ok ++;
}