=$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.SPACE;
$h2=$h2."";
$h2=$h2.SPACE.S_HOST.SPACE;
$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(new CLink(S_TRIGGERS_BIG." $time","tr_status.php?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&fullscreen=1&sort=$sort"));
}
$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));
}
array_push($header,S_ACKNOWLEDGED);
array_push($header,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=new CSpan("$blink1".S_FALSE_BIG."$blink2","off");
else if($row["value"]==2)
$value=new CSpan("$blink1".S_UNKNOWN_BIG."$blink2","unknown");
else
$value=new CSpan(S_TRUE_BIG,"on");
$priority_style=NULL;
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=S_AVERAGE;
$priority_style="average";
}
elseif($row["priority"]==4)
{
$priority=S_HIGH;
$priority_style="high";
}
elseif($row["priority"]==5)
{
$priority=S_DISASTER;
$priority_style="disaster";
}
else $priority=$row["priority"];
$lastchange=new CLink(date(S_DATE_FORMAT_YMDHMS,$row["lastchange"]),"alarms.php?triggerid=".$row["triggerid"],"action");
$actions=NULL;
if($noactions!='true')
{
// $actions="".S_SHOW_ACTIONS." - ";
$actions=array(new CLink(S_HISTORY,"alarms.php?triggerid=".$row["triggerid"],"action"));
array_push($actions, " - ");
if(isset($_REQUEST["hostid"]))
{
array_push($actions, new CLink(S_CHANGE,"triggers.php?hostid=".$_REQUEST["hostid"]."&triggerid=".$row["triggerid"]."#form","action"));
}
else
{
array_push($actions, new CLink(S_CHANGE,"triggers.php?triggerid=".$row["triggerid"]."#form","action"));
}
}
$comments=NULL;
if($row["comments"] != "")
{
$comments=new CLink(S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action");
}
else
{
$comments=new CLink(S_ADD,"tr_comments.php?triggerid=".$row["triggerid"],"action");
}
$ack = "-";
if($row["value"] == 1)
{
$alarm = get_last_alarm_by_triggerid($row["triggerid"]);
if($alarm["acknowledged"] == 1)
{
$db_acks = get_acknowledges_by_alarmid($alarm["alarmid"]);
$ack=array(
new CSpan(S_YES,"off"),
SPACE."(".DBnum_rows($db_acks).SPACE,
new CLink(S_SHOW,
"acknow.php?alarmid=".$alarm["alarmid"],"action"),
")"
);
}
else
{
$ack=array(
new CSpan(S_NO,"on"),
SPACE."(",
new CLink(S_ACK,
"acknow.php?alarmid=".$alarm["alarmid"],"action"),
")"
);
}
}
$table->AddRow(array(
$description,
$value,
new CCol($priority,$priority_style),
$lastchange,
$actions,
new CCol($ack,"center"),
$comments
));
$col++;
}
$table->show();
show_table_header(S_TOTAL.":$col");
?>