diff options
| author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-10 13:36:21 +0000 |
|---|---|---|
| committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-10 13:36:21 +0000 |
| commit | cd58120468d324ee96922fc156f9e6ca651addb1 (patch) | |
| tree | 4893ba3887eb2b0a18ab48fb15584dbc7f39f1b9 /src/zabbix_proxy | |
| parent | 5324c016a35d893a4e76951d1a45546b5a5ddaf3 (diff) | |
| download | zabbix-cd58120468d324ee96922fc156f9e6ca651addb1.tar.gz zabbix-cd58120468d324ee96922fc156f9e6ca651addb1.tar.xz zabbix-cd58120468d324ee96922fc156f9e6ca651addb1.zip | |
- [DEV-141] improved performance of ZABBIX Proxy module
git-svn-id: svn://svn.zabbix.com/trunk@5609 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_proxy')
| -rw-r--r-- | src/zabbix_proxy/datasender/datasender.c | 44 | ||||
| -rw-r--r-- | src/zabbix_proxy/housekeeper/housekeeper.c | 6 |
2 files changed, 9 insertions, 41 deletions
diff --git a/src/zabbix_proxy/datasender/datasender.c b/src/zabbix_proxy/datasender/datasender.c index 10886126..eaed9d99 100644 --- a/src/zabbix_proxy/datasender/datasender.c +++ b/src/zabbix_proxy/datasender/datasender.c @@ -46,36 +46,10 @@ struct last_ids { }; static ZBX_HISTORY_TABLE ht[]={ - {"history_sync", "history_lastid", - { - {"clock", ZBX_PROTO_TAG_CLOCK}, - {"value", ZBX_PROTO_TAG_VALUE}, - {NULL} - } - }, - {"history_uint_sync", "history_uint_lastid", - { - {"clock", ZBX_PROTO_TAG_CLOCK}, - {"value", ZBX_PROTO_TAG_VALUE}, - {NULL} - } - }, - {"history_str_sync", "history_str_lastid", - { - {"clock", ZBX_PROTO_TAG_CLOCK}, - {"value", ZBX_PROTO_TAG_VALUE}, - {NULL} - } - }, - {"history_text", "history_text_lastid", - { - {"clock", ZBX_PROTO_TAG_CLOCK}, - {"value", ZBX_PROTO_TAG_VALUE}, - {NULL} - } - }, - {"history_log", "history_log_lastid", + {"proxy_history", "history_lastid", { + {"host", ZBX_PROTO_TAG_HOST}, + {"key_", ZBX_PROTO_TAG_KEY}, {"clock", ZBX_PROTO_TAG_CLOCK}, {"timestamp", ZBX_PROTO_TAG_LOGTIMESTAMP}, {"source", ZBX_PROTO_TAG_LOGSOURCE}, @@ -225,14 +199,14 @@ static int get_history_data(struct zbx_json *j, const ZBX_HISTORY_TABLE *ht, zbx get_lastid(ht, &id); - offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, "select d.id,h.host,i.key_"); + offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, "select id"); for (f = 0; ht->fields[f].field != NULL; f ++) - offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, ",d.%s", + offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, ",%s", ht->fields[f].field); - offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " from hosts h,items i,%s d" - " where h.hostid=i.hostid and i.itemid=d.itemid and d.id>" ZBX_FS_UI64 " order by d.id", + offset += zbx_snprintf(sql + offset, sizeof(sql) - offset, " from %s" + " where id>" ZBX_FS_UI64 " order by id", ht->table, id); @@ -245,8 +219,6 @@ static int get_history_data(struct zbx_json *j, const ZBX_HISTORY_TABLE *ht, zbx *lastid = zbx_atoui64(row[0]); - zbx_json_addstring(j, ZBX_PROTO_TAG_HOST, row[1], ZBX_JSON_TYPE_STRING); - zbx_json_addstring(j, ZBX_PROTO_TAG_KEY, row[2], ZBX_JSON_TYPE_STRING); for (f = 0; ht->fields[f].field != NULL; f ++) { field = DBget_field(table, ht->fields[f].field); @@ -261,7 +233,7 @@ static int get_history_data(struct zbx_json *j, const ZBX_HISTORY_TABLE *ht, zbx break; } - zbx_json_addstring(j, ht->fields[f].tag, row[f + 3], jt); + zbx_json_addstring(j, ht->fields[f].tag, row[f + 1], jt); } records++; diff --git a/src/zabbix_proxy/housekeeper/housekeeper.c b/src/zabbix_proxy/housekeeper/housekeeper.c index 61407582..d700cdfb 100644 --- a/src/zabbix_proxy/housekeeper/housekeeper.c +++ b/src/zabbix_proxy/housekeeper/housekeeper.c @@ -110,11 +110,7 @@ static int housekeeping_history(int now) zabbix_log(LOG_LEVEL_DEBUG, "In housekeeping_history()"); - records += delete_history("history_sync", "history_lastid", now); - records += delete_history("history_uint_sync", "history_uint_lastid", now); - records += delete_history("history_str_sync", "history_str_lastid", now); - records += delete_history("history_text", "history_text_lastid", now); - records += delete_history("history_log", "history_log_lastid", now); + records += delete_history("proxy_history", "history_lastid", now); records += delete_history("proxy_dhistory", "dhistory_lastid", now); return records; |
