No permissions !"); show_footer(); exit; } if(isset($HTTP_GET_VARS["select"])) { unset($HTTP_GET_VARS["hostid"]); } if(isset($HTTP_GET_VARS["hostid"])&&!check_right("Host","R",$HTTP_GET_VARS["hostid"])) { show_table_header("No permissions !"); show_footer(); exit; } ?> "; if(isset($HTTP_GET_VARS["groupid"])) { // echo "all "; echo "all "; } else { echo "[all] "; } $result=DBselect("select groupid,name from groups order by name"); while($row=DBfetch($result)) { // if(!check_right("Host","R",$row["hostid"])) // { // continue; // } if( isset($HTTP_GET_VARS["groupid"]) && ($HTTP_GET_VARS["groupid"] == $row["groupid"]) ) { echo "["; } echo "".$row["name"].""; if(isset($HTTP_GET_VARS["groupid"]) && ($HTTP_GET_VARS["groupid"] == $row["groupid"]) ) { echo "]"; } echo " "; } show_table_v_delimiter(); if(isset($HTTP_GET_VARS["groupid"])) { $result=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status in (0,2) and h.hostid=i.hostid and hg.groupid=".$HTTP_GET_VARS["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"); } else { $result=DBselect("select h.hostid,h.host from hosts h,items i where h.status in (0,2) and h.hostid=i.hostid group by h.hostid,h.host order by h.host"); } while($row=DBfetch($result)) { if(!check_right("Host","R",$row["hostid"])) { continue; } if( isset($HTTP_GET_VARS["hostid"]) && ($HTTP_GET_VARS["hostid"] == $row["hostid"]) ) { echo "["; } if(isset($HTTP_GET_VARS["groupid"])) { echo "".$row["host"].""; } else { echo "".$row["host"].""; } if(isset($HTTP_GET_VARS["hostid"]) && ($HTTP_GET_VARS["hostid"] == $row["hostid"]) ) { echo "]"; } echo " "; } echo ""; if(!isset($HTTP_GET_VARS["hostid"])&&isset($HTTP_GET_VARS["select_form"])&&!isset($HTTP_GET_VARS["select"])) { show_table_v_delimiter(); echo "
"; } else { show_table_v_delimiter(); if(isset($HTTP_GET_VARS["select"])) { echo "[Select]"; } else { echo "[Select]"; } } show_table_header_end(); if(!isset($HTTP_GET_VARS["sort"])) { $HTTP_GET_VARS["sort"]="description"; } if(isset($HTTP_GET_VARS["hostid"])) { $result=DBselect("select host from hosts where hostid=".$HTTP_GET_VARS["hostid"]); if(DBnum_rows($result)==0) { unset($HTTP_GET_VARS["hostid"]); } } if(isset($HTTP_GET_VARS["hostid"])||isset($HTTP_GET_VARS["select"])) { echo "Host | "; } if(!isset($HTTP_GET_VARS["sort"])||(isset($HTTP_GET_VARS["sort"])&&($HTTP_GET_VARS["sort"]=="description"))) { echo "DESCRIPTION | "; } else { if(isset($HTTP_GET_VARS["select"])) { echo "Description | "; } else { echo "Description | "; } } if(isset($HTTP_GET_VARS["sort"])&&($HTTP_GET_VARS["sort"]=="lastcheck")) { echo "LAST CHECK | "; } else { if(isset($HTTP_GET_VARS["select"])) { echo "Last check | "; } else { echo "Last check | "; } } cr(); echo "Last value | "; cr(); echo "Change | "; cr(); echo "History | "; cr(); echo "Trends | "; cr(); echo "Compare | "; cr(); echo "|||||
".$row["host"]." | "; } echo "".$row["description"]." | "; echo "";
if($row["status"] == 2)
{
echo "";
}
if(!isset($row["lastclock"]))
{
echo " - ";
}
else
{
echo date("d M H:i:s",$row["lastclock"]);
}
echo " | ";
if(isset($row["lastvalue"]))
{
if(round($row["lastvalue"])==$row["lastvalue"])
{
if($row["value_type"] == 0 )
{
echo ""; printf("%.0f",$row["lastvalue"]); echo " | "; } else { echo ""; echo substr($row["lastvalue"],0,20)," ..."; echo " | "; } } else { echo ""; printf("%.2f",$row["lastvalue"]); echo " | "; } } else { echo "- | "; } if( isset($row["lastvalue"]) && isset($row["prevvalue"]) && $row["lastvalue"]-$row["prevvalue"] != 0 ) { // echo ""; echo $row["lastvalue"]-$row["prevvalue"]; echo " | "; // sprintf("%+0.2f"); does not work if($row["lastvalue"]-$row["prevvalue"]<0) { printf("%0.2f | ",$row["lastvalue"]-$row["prevvalue"]); } else { printf("+%0.2f | ",$row["lastvalue"]-$row["prevvalue"]); } } else { echo "- | "; } if($row["value_type"]==0) { echo "Graph | "; } else { echo "Graph | "; } if($row["value_type"]==0) { echo "Trend | "; } else { echo "Trend | "; } if($row["value_type"]==0) { echo "Compare | "; } else { echo "Compare | "; } echo "