=$old[0]))
{
// DISASTER
if(($new[0]-$old[0])/pow(10,5)>=1)
{
$audio="disaster_on.wav";
}
else
{
$audio="warning_on.wav";
}
}
// echo "$tr_hash
$triggers_hash
".$old[1]."
".$new[1];
?>
".S_NO_PERMISSIONS."");
show_page_footer();
exit;
}
if(isset($_REQUEST["hostid"])&&!check_right("Host","R",$_REQUEST["hostid"]))
{
show_table_header("".S_NO_PERMISSIONS."");
show_page_footer();
exit;
}
update_profile("web.menu.view.last",$page["file"]);
?>
";
}
?>
";
$h2=$h2."";
$h2=$h2.S_GROUP." ";
$h2=$h2."";
$h2=$h2." ".S_HOST." ";
$h2=$h2."";
$h2=$h2.nbsp(" ");
if(isset($_REQUEST["select"])&&($_REQUEST["select"]==""))
{
unset($_REQUEST["select"]);
}
if(isset($_REQUEST["select"]))
{
$h2=$h2."";
}
else
{
$h2=$h2."";
}
$h2=$h2.nbsp(" ");
$h2=$h2."";
// show_table_header_end();
show_header2($h1, $h2, "
");
?>
".S_ALL_SMALL." ";
}
else
{
echo "[".S_ALL_SMALL."] ";
}
while($row=DBfetch($result))
{
if(!check_right("Host","R",$row["hostid"]))
{
continue;
}
if(isset($_REQUEST["hostid"]) && ($row["hostid"] == $_REQUEST["hostid"]))
{
echo "[".$row["host"]."] ";
}
else
{
echo "".$row["host"]." ";
}
}*/
// show_table_v_delimiter(2);
// show_table_header_begin();
?>
".S_SHOW_ONLY_TRUE."] ";
}
else
{
$h1=$h1."[".S_SHOW_ALL_TRIGGERS."] ";
}
if($noactions!='true')
{
$h1=$h1."[".S_HIDE_ACTIONS."] ";
}
else
{
$h1=$h1."[".S_SHOW_ACTIONS."] ";
}
if($compact!='true')
{
$h1=$h1."[".S_HIDE_DETAILS."] ";
}
else
{
$h1=$h1."[".S_SHOW_DETAILS."] ";
}
if($select!='true')
{
$h1=$h1."[".S_SELECT."] ";
}
else
{
$h1=$h1."[".S_HIDE_SELECT."] ";
$h1=$h1."";
}
show_table_header($h1);
// echo "
";
}
$time=date("[H:i:s]",time());
if(isset($_REQUEST["fullscreen"]))
{
show_table_header("".S_TRIGGERS_BIG." $time");
$cond="";
if(isset($_REQUEST["hostid"]))
{
$cond=" and h.hostid=".$_REQUEST["hostid"]." ";
}
if($onlytrue=='true')
{
$sql="select t.priority,count(*) as cnt from triggers t,hosts h,items i,functions f".$groupname." where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and t.description $select_cond and i.status=0 $cond $groupcond group by 1";
}
else
{
$sql="select t.priority,count(*) as cnt from triggers t,hosts h,items i,functions f".$groupname." where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and h.status=".HOST_STATUS_MONITORED." and t.description $select_cond and i.status=0 $cond $groupcond group by 1";
}
$result=DBselect($sql);
$p0=$p1=$p2=$p3=$p4=$p5=0;
while($row=DBfetch($result))
{
$priority=$row["priority"];
$count=$row["cnt"];
if($priority==0) $p0=$count;
if($priority==1) $p1=$count;
if($priority==2) $p2=$count;
if($priority==3) $p3=$count;
if($priority==4) $p4=$count;
if($priority==5) $p5=$count;
}
echo "\n";
echo "";
table_td("".S_NOT_CLASSIFIED.": $p0","");
table_td("".S_INFORMATION.": $p1","");
table_td("".S_WARNING.": $p2","");
table_td("".S_AVERAGE.": $p3","BGCOLOR=#DDAAAA");
table_td("".S_HIGH.": $p4","BGCOLOR=#FF8888");
table_td("".S_DISASTER.": $p5","BGCOLOR=RED");
echo "
";
echo "
";
}
else
{
// show_table_header("".S_TRIGGERS_BIG." $time");
}
$table = new CTableInfo();
$header=array();
echo "";
if(isset($_REQUEST["fullscreen"]))
{
$fullscreen="&fullscreen=1";
}
else
{
$fullscreen="";
}
if(isset($sort) && $sort=="description")
{
$description=S_NAME_BIG;
}
else
{
if($select=="TRUE")
$description="".S_NAME;
else
$description="".S_NAME."";
}
if($compact!='true') {$description=$description."
".S_EXPRESSION."";}
$header=array_merge($header,array($description));
$header=array_merge($header,array(S_STATUS));
if(!isset($sort)||(isset($sort) && $sort=="priority"))
{
$header=array_merge($header,array(S_SEVERITY_BIG));
}
else
{
if($select=="TRUE")
$header=array_merge($header,array("".S_SEVERITY.""));
else
$header=array_merge($header,array("".S_SEVERITY.""));
}
if(isset($sort) && $sort=="lastchange")
{
$header=array_merge($header,array(nbsp(S_LAST_CHANGE_BIG)));
}
else
{
if($select=="TRUE")
{
$header=array_merge($header,array("".nbsp(S_LAST_CHANGE).""));
}
else
{
$header=array_merge($header,array("".nbsp(S_LAST_CHANGE).""));
}
}
echo "";
if($noactions!='true')
{
$header=array_merge($header,array(S_ACTIONS));
}
$header=array_merge($header,array(S_COMMENTS));
$table->setHeader($header);
unset($header);
if(isset($_REQUEST["hostid"]))
{
$cond=" and h.hostid=".$_REQUEST["hostid"]." ";
}
else
{
$cond="";
}
if(!isset($sort))
{
$sort="priority";
}
switch ($sort)
{
case "description":
$sort="order by t.description";
break;
case "priority":
$sort="order by t.priority desc, t.description";
break;
case "lastchange":
$sort="order by t.lastchange desc, t.priority";
break;
default:
$sort="order by t.priority desc, t.description";
}
if($onlytrue=='true')
{
$result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f".$groupname." where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and t.description $select_cond and t.triggerid=f.triggerid and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $groupcond $sort");
}
else
{
$result=DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.comments,t.url,t.value from triggers t,hosts h,items i,functions f".$groupname." where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.status=0 and t.description $select_cond and i.status in (0,2) and h.status=".HOST_STATUS_MONITORED." $cond $groupcond $sort");
}
$col=0;
while($row=DBfetch($result))
{
if(!check_right_on_trigger("R",$row["triggerid"]))
{
continue;
}
// Check for dependencies
$sql="select count(*) as cnt from trigger_depends d, triggers t where d.triggerid_down=".$row["triggerid"]." and d.triggerid_up=t.triggerid and t.value=1";
$result2=DBselect($sql);
$row2=DBfetch($result2);
if($row2["cnt"]>0)
{
continue;
}
$elements=array();
$description=expand_trigger_description($row["triggerid"]);
if($row["url"] != "")
{
$description="$description";
}
if($compact!='true')
{
$description=$description."
".explode_exp($row["expression"],1)."";
}
if( (time(NULL)-$row["lastchange"])<300)
{
$blink1="";
}
else
{
$blink1="";
$blink2="";
}
if($row["value"]==0)
$value=array("value"=>"$blink1".S_FALSE_BIG."$blink2","class"=>"off");
else if($row["value"]==2)
$value=array("value"=>"$blink1".S_UNKNOWN_BIG."$blink2","class"=>"unknown");
else
$value=array("value"=>S_TRUE_BIG,"class"=>"on");
if($row["priority"]==0) $priority=S_NOT_CLASSIFIED;
elseif($row["priority"]==1) $priority=S_INFORMATION;
elseif($row["priority"]==2) $priority=S_WARNING;
elseif($row["priority"]==3) $priority=array("value"=>S_AVERAGE,"class"=>"average");
elseif($row["priority"]==4) $priority=array("value"=>S_HIGH,"class"=>"high");
elseif($row["priority"]==5) $priority=array("value"=>S_DISASTER,"class"=>"disaster");
else $priority=$row["priority"];
$lastchange="".date(S_DATE_FORMAT_YMDHMS,$row["lastchange"])."";
$actions=array("hide"=>1);
if($noactions!='true')
{
// $actions="".S_SHOW_ACTIONS." - ";
$actions="".S_HISTORY." - ";
if(isset($_REQUEST["hostid"]))
{
$actions=$actions."".S_CHANGE."";
}
else
{
$actions=$actions."".S_CHANGE."";
}
}
$comments=array("hide"=>1);;
if($row["comments"] != "")
{
$comments="".S_SHOW."";
}
else
{
$comments="".S_ADD."";
}
$table->addRow(array(
$description,
$value,
$priority,
$lastchange,
$actions,
$comments
));
$col++;
}
$table->show();
show_table_header(S_TOTAL.":$col");
?>