PDA

View Full Version : Latest data with select - see even items with latest values


limo
11-06-2008, 19:25
When doing latest data with select, it checks only description by default. This patch checks even latest data. It means you can find some text in latest data within latest values.


--- ./latest-orig.php 2008-06-11 19:24:42.000000000 +0200
+++ ./latest-new.php 2008-06-11 19:24:53.000000000 +0200
@@ -244,7 +244,7 @@
while($db_item = DBfetch($db_items)){
$description = item_description($db_item["description"],$db_item["key_"]);

- if(!empty($_REQUEST["select"]) && !zbx_stristr($description, $_REQUEST["select"]) ) continue;
+ if(!empty($_REQUEST["select"]) && !(zbx_stristr($description, $_REQUEST["select"]) || zbx_stristr($db_item["lastvalue"],$_REQUEST["select"]) )) continue;

++$item_cnt;
if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue;
@@ -355,9 +355,9 @@

while($db_item = DBfetch($db_items)){
$description = item_description($db_item["description"],$db_item["key_"]);
-
- if(!empty($_REQUEST["select"]) && !zbx_stristr($description, $_REQUEST["select"]) ) continue;
-
+
+ if(!empty($_REQUEST["select"]) && !(zbx_stristr($description, $_REQUEST["select"]) || zbx_stristr($db_item["lastvalue"],$_REQUEST["select"]) )) continue;
+
++$item_cnt;

if(!uint_in_array(0,$_REQUEST["applications"]) && !isset($show_all_apps)) continue;