PDA

View Full Version : map recurence


SLMitch
12-07-2006, 16:37
When we use a map in which we have an other map as an object, and if they are 1 error (not more) in the more deep map, status may be OK : the recursion use the same variable in each loop, and can lose information of 1 problème.

When we are more probleme, info is not important and probleme is not visible.

This patch make a temporary variable in order to memorize when a problem occur. The temporary variable is uniq and may be re-writen in a loop, but its result are only important in the case of 1 problem.


diff -uwBb zabbix-1.1-orig/frontends/php/include/maps.inc.php zabbix-1.1/frontends/php/include/maps.inc.php
--- zabbix-1.1-orig/frontends/php/include/maps.inc.php 2006-05-23 16:04:50.000000000 +0200
+++ zabbix-1.1/frontends/php/include/maps.inc.php 2006-07-12 15:27:12.000000000 +0200
@@ -291,8 +291,16 @@
" where sysmapid=".$db_element["elementid"]);
while($db_subelement = DBfetch($db_subelements))
{// recursion
- $count += get_info_by_selementid($db_subelement["selementid"],$info,$color);
+ $tmp = get_info_by_selementid($db_subelement["selementid"],$info,$color);
+ $count += $tmp;;
+ if($tmp)
+ {
+ $infotmp=$info;
+ $colortmp=$color;
+ }
}
+ $info=$infotmp;
+ $color=$colortmp;

if($count==0)
{

raminix
12-07-2006, 22:36
You sir are a gentleman and a scholar. Your patch works perfectly and has put my biggest issue with Zabbix to bed.

Thanks!

bdo
01-08-2006, 09:11
Yes thx for this Patch !!!


--bdo
Zabbix 1.1.1

ci_newman
07-08-2006, 14:31
As above, you're a star!!

We had to tweak it slightly to allow it to read *1 problem* opposed to taking its value from the trigger (if that makes sense). As the loop will only be *seen* if there is one problem, we set a static reply as reads below:


diff -uwBb zabbix-1.1-orig/frontends/php/include/maps.inc.php zabbix-1.1/frontends/php/include/maps.inc.php
--- zabbix-1.1-orig/frontends/php/include/maps.inc.php 2006-05-23 16:04:50.000000000 +0200
+++ zabbix-1.1/frontends/php/include/maps.inc.php 2006-07-12 15:27:12.000000000 +0200
@@ -291,8 +291,16 @@
" where sysmapid=".$db_element["elementid"]);
while($db_subelement = DBfetch($db_subelements))
{// recursion
- //$count += get_info_by_selementid($db_subelement["selementid"],$info,$color);
+ $tmp = get_info_by_selementid($db_subelement["selementid"],$info,$color);
+ $count += $tmp;;
+ if($tmp)
+ {
- $infotmp=$info;
- $colortmp=$color;
+ $infotmp = "1 ".S_PROBLEMS_SMALL;
+ $colortmp = $colors["Red"];
+
+ }
+ }
$info=$infotmp;
$color=$colortmp;

if($count==0)


Most excellent find though :D Sorts out one a few of my minor annoyances :)

richlv
03-03-2009, 13:58
i didn't test it ;), but is the original problem still present in latest version ?