diff options
author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-09-06 14:47:11 +0000 |
---|---|---|
committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-09-06 14:47:11 +0000 |
commit | 85d46782a09dd1cc7cc2f06cccf1571f16a094a4 (patch) | |
tree | 3bfe81df06322fa1d0bc5ff43d5371771a32169d /src | |
parent | 9f9503d36173f5b0fea471ab7465d95103eff07e (diff) | |
download | zabbix-85d46782a09dd1cc7cc2f06cccf1571f16a094a4.tar.gz zabbix-85d46782a09dd1cc7cc2f06cccf1571f16a094a4.tar.xz zabbix-85d46782a09dd1cc7cc2f06cccf1571f16a094a4.zip |
- [NTT-16] added synchronisation of last value and timestamp for DM (Alexei)
[svn merge -r4734:4738 svn://svn.zabbix.com/branches/1.4.j]
git-svn-id: svn://svn.zabbix.com/trunk@4739 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r-- | src/zabbix_server/trapper/nodehistory.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/zabbix_server/trapper/nodehistory.c b/src/zabbix_server/trapper/nodehistory.c index 6b597309..44d34713 100644 --- a/src/zabbix_server/trapper/nodehistory.c +++ b/src/zabbix_server/trapper/nodehistory.c @@ -69,6 +69,10 @@ static int process_record(int nodeid, char *record) zbx_uint64_t value_uint; int res = FAIL; + char value_esc[MAX_STRING_LEN]; + + + zabbix_log( LOG_LEVEL_DEBUG, "In process_record [%s]", record); @@ -84,6 +88,12 @@ static int process_record(int nodeid, char *record) value=atof(tmp); res = DBadd_history(itemid, value, timestamp); + + DBexecute("update items set lastvalue='" ZBX_FS_DBL "', lastclock=%d where itemid=" ZBX_FS_UI64, + value, + timestamp, + itemid); + } else if(table == ZBX_TABLE_HISTORY_UINT) { @@ -95,6 +105,11 @@ static int process_record(int nodeid, char *record) sscanf(tmp,ZBX_FS_UI64,&value_uint); res = DBadd_history_uint(itemid, value_uint, timestamp); + + DBexecute("update items set lastvalue='" ZBX_FS_UI64 "', lastclock=%d where itemid=" ZBX_FS_UI64, + value_uint, + timestamp, + itemid); } else if(table == ZBX_TABLE_HISTORY_STR) { @@ -105,6 +120,13 @@ static int process_record(int nodeid, char *record) zbx_get_field(record,tmp,3,ZBX_DM_DELIMITER); res = DBadd_history_str(itemid, tmp, timestamp); + + DBescape_string(tmp,value_esc,MAX_STRING_LEN); + + DBexecute("update items set lastvalue='%s', lastclock=%d where itemid=" ZBX_FS_UI64, + tmp, + timestamp, + itemid); } return res; |