diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | frontends/php/include/items.inc.php | 28 | ||||
-rw-r--r-- | src/libs/zbxwin32/perfmon.c | 2 |
3 files changed, 12 insertions, 19 deletions
@@ -37,6 +37,7 @@ Changes for 1.5: - added login/logout (Artem) Changes for 1.4.5: + - [ZBX-250] speed improvement for Triggers when use "{ITEM.VALUE}" macro (Sasha) - [ZBX-246] fixed header error in Monitoring->slideshows (Artem) - [ZBX-243] speed improvement for windows agent for eventlog[] processing (sasha) - [DEV-92] added supprt of multiple windows agents, service description (Sasha) diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index e2c4365b..e1da2c2e 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -1192,8 +1192,7 @@ COpt::profiling_stop('prepare table'); * * Peremeters: * itemid - item ID - * index - 0 - last value, 1 - prev value, 2 - prev prev, and so on - * if index=0, clock is used + * last - 0 - last value (clock is used), 1 - last value * * Author: * Alexei Vladishev @@ -1201,7 +1200,7 @@ COpt::profiling_stop('prepare table'); * Comments: * */ - function item_get_history($db_item,$index = 1, $clock = 0) + function item_get_history($db_item, $last = 1, $clock = 0) { $value = NULL; @@ -1224,29 +1223,24 @@ COpt::profiling_stop('prepare table'); $table = "history_log"; break; } - if($index == 0) + if ($last == 0) { - $sql="select value from $table where itemid=".$db_item["itemid"]." and clock<=$clock order by clock desc"; - $result = DBselect($sql, 1); + $sql = "select value from $table where itemid=".$db_item["itemid"]." and clock=$clock"; $row = DBfetch(DBselect($sql, 1)); if($row) - { $value = $row["value"]; - } } else { - $sql="select value from $table where itemid=".$db_item["itemid"]." order by clock desc"; - $result = DBselect($sql, $index); - $num=1; - while($row = DBfetch($result)) + $sql = "select max(clock) as clock from $table where itemid=".$db_item["itemid"]; + $row = DBfetch(DBselect($sql)); + if ($row && !is_null($row["clock"])) { - if($num == $index) - { + $clock = $row["clock"]; + $sql = "select value from $table where itemid=".$db_item["itemid"]." and clock=$clock"; + $row = DBfetch(DBselect($sql, 1)); + if($row) $value = $row["value"]; - break; - } - $num++; } } return $value; diff --git a/src/libs/zbxwin32/perfmon.c b/src/libs/zbxwin32/perfmon.c index ca761a8e..9f33e4a0 100644 --- a/src/libs/zbxwin32/perfmon.c +++ b/src/libs/zbxwin32/perfmon.c @@ -33,8 +33,6 @@ char *GetCounterName(DWORD index) PERFCOUNTER *counterName; DWORD dwSize; - /* NOTE: The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.*/ - zabbix_log(LOG_LEVEL_DEBUG, "In GetCounterName() [index:%u]", index); counterName = PerfCounterList; |