-
Incident report
-
Resolution: Fixed
-
Major
-
1.8.5, 2.0.0
-
Gentoo 34-r6, Oracle 10g2
Index: src/libs/zbxserver/expression.c
===================================================================
— src/libs/zbxserver/expression.c (revision 16617)
+++ src/libs/zbxserver/expression.c (working copy)
@@ -1261,7 +1261,7 @@
if (FAIL == trigger_get_N_functionid(expression, N_functionid, &functionid))
return FAIL;
- result = DBselect("select i.itemid,i.value_type from items i,functions f"
+ result = DBselect("select i.itemid,i.value_type,i.delay from items i,functions f"
" where i.itemid=f.itemid and f.functionid=" ZBX_FS_UI64,
functionid);
@@ -1272,9 +1272,9 @@
if (value_type == ITEM_VALUE_TYPE_LOG)
{
zbx_snprintf(sql, sizeof(sql), "select %s from history_log"
- " where itemid=%s order by id desc",
+ " where itemid=%s and clock >= common_utils.oracle2unix(SYSDATE)-2*%s order by id desc",
fieldname, - row[0]);
+ row[0],row[2]);
h_result = DBselectN(sql, 1);
@@ -1327,7 +1327,7 @@
return FAIL;
result = DBselect(
- "select i.itemid,i.value_type,i.valuemapid,i.units,i.lastvalue"
+ "select i.itemid,i.value_type,i.valuemapid,i.units,i.lastvalue,i.delay"
" from items i,functions f"
" where i.itemid=f.itemid"
" and f.functionid=" ZBX_FS_UI64,
@@ -1342,9 +1342,9 @@ { case ITEM_VALUE_TYPE_LOG: case ITEM_VALUE_TYPE_TEXT: - zbx_snprintf(tmp, sizeof(tmp), "select value from %s where itemid=%s order by id desc", + zbx_snprintf(tmp, sizeof(tmp), "select value from %s where itemid=%s and clock >= common_utils.oracle2unix(SYSDATE)-2*%s order by id desc", value_type == ITEM_VALUE_TYPE_LOG ? "history_log" : "history_text", - row[0]); + row[0],row[5]); h_result = DBselectN(tmp, 1); Index: src/libs/zbxserver/evalfunc.c =================================================================== --- src/libs/zbxserver/evalfunc.c (revision 16617) +++ src/libs/zbxserver/evalfunc.c (working copy) @@ -1695,9 +1695,11 @@ "select value" " from %s" " where itemid=" ZBX_FS_UI64 + " and clock >= common_utils.oracle2unix(SYSDATE)-3*" ZBX_FS_UI64 " order by %s desc", get_table_by_value_type(item->value_type), item->itemid, + item->delay, get_key_by_value_type(item->value_type)); result = DBselectN(sql, arg2); }