Ad Widget

Collapse

Events page is not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alj
    Senior Member
    • Aug 2006
    • 188

    #1

    Events page is not working

    half of page shows up, for enother half of page i see
    Undefined variable: rclock[/usr/share/zabbix/include/events.inc.php:204]

    1.4.2 version.
  • alj
    Senior Member
    • Aug 2006
    • 188

    #2
    Fix

    while($rows = DBfetch($res)){
    $rclock = $rows['clock'];
    }
    if($rclock != $row['clock']) return false;

    changed to:

    $rclock=0;
    while($rows = DBfetch($res)){
    $rclock = $rows['clock'];
    }
    if($rclock != $row['clock']) return false;

    Comment

    • Aly
      ZABBIX developer
      • May 2007
      • 1126

      #3
      It's strange that you get that warning.. you really shouldn't by the logic.
      Could you show event history of that trigger(where warning occurs)..
      Zabbix | ex GUI developer

      Comment

      • alj
        Senior Member
        • Aug 2006
        • 188

        #4
        Originally posted by Aly
        It's strange that you get that warning.. you really shouldn't by the logic.
        Could you show event history of that trigger(where warning occurs)..
        I cant. There was half of page filled with errors i posted above. When i put that line into source, that half of page disappeared.

        Comment

        • alj
          Senior Member
          • Aug 2006
          • 188

          #5
          Originally posted by Aly
          It's strange that you get that warning.. you really shouldn't by the logic.
          Could you show event history of that trigger(where warning occurs)..
          Why do you think is strange? if $rlock was defined within {} scope it doesnt exist after }, right? I didnt see any definition of $rlock anywhere earlier in the script. Or php5 doesnt have meaning of variable scope?

          Comment

          • alj
            Senior Member
            • Aug 2006
            • 188

            #6
            Originally posted by Aly
            It's strange that you get that warning.. you really shouldn't by the logic.
            Could you show event history of that trigger(where warning occurs)..
            Another thing - if DBfetch($res) returns with 0 right away rlock will never receive any value, right?

            This is very confusing, i can hardly understand whats going on by looking at the source ;-))

            Comment

            • Aly
              ZABBIX developer
              • May 2007
              • 1126

              #7
              Originally posted by alj
              Why do you think is strange? if $rlock was defined within {} scope it doesnt exist after }, right? I didnt see any definition of $rlock anywhere earlier in the script. Or php5 doesnt have meaning of variable scope?
              There is var. scope, but it's not like in C or Java. $rclock will exist after }.

              You get errors because in some situation script in second DBfetch($res) returns false. But you get in this "if(!empty($events) && ($events[0]['value'] == $row['value']))" only if there is at least 1 row.

              P.S. you can change this function to this:

              Code:
              function event_initial_time($row,$show_unknown=0){
              	$sql_cond=($show_unknown == 0)?' AND value<>2 ':'';
              
              	$events = array();
              	$res = DBselect('SELECT MAX(clock) as clock, value '.
              					' FROM events '.
              					' WHERE objectid='.$row['triggerid'].$sql_cond.
              						' AND clock < '.$row['clock'].
              						' AND object='.EVENT_OBJECT_TRIGGER.
              					' GROUP BY value '.
              					' ORDER BY clock DESC');
              					
              	while($rows = DBfetch($res)){
              		$events[] = $rows;
              	}
              	if(!empty($events) && ($events[0]['value'] == $row['value'])){
              		return false;
              	}
              	return true;
              }
              Zabbix | ex GUI developer

              Comment

              Working...