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 "
"; if(!isset($HTTP_GET_VARS["select"])) { $result=DBselect("select host from hosts where hostid=".$HTTP_GET_VARS["hostid"]); $host=DBget_field($result,0,0); show_table_header("$host"); } else { show_table_header("Description is like *".$HTTP_GET_VARS["select"]."*"); } # show_table_header_begin(); # echo "$host"; # show_table3_v_delimiter(); echo ""; cr(); echo ""; cr(); if(isset($HTTP_GET_VARS["select"])) { echo ""; } if(!isset($HTTP_GET_VARS["sort"])||(isset($HTTP_GET_VARS["sort"])&&($HTTP_GET_VARS["sort"]=="description"))) { echo ""; } else { if(isset($HTTP_GET_VARS["select"])) { echo ""; } else { echo ""; } } if(isset($HTTP_GET_VARS["sort"])&&($HTTP_GET_VARS["sort"]=="lastcheck")) { echo ""; } else { if(isset($HTTP_GET_VARS["select"])) { echo ""; } else { echo ""; } } cr(); echo ""; cr(); echo ""; cr(); echo ""; cr(); echo ""; cr(); echo ""; cr(); echo ""; cr(); $col=0; if(isset($HTTP_GET_VARS["sort"])) { switch ($HTTP_GET_VARS["sort"]) { case "description": $HTTP_GET_VARS["sort"]="order by i.description"; break; case "lastcheck": $HTTP_GET_VARS["sort"]="order by i.lastclock"; break; default: $HTTP_GET_VARS["sort"]="order by i.description"; break; } } else { $HTTP_GET_VARS["sort"]="order by i.description"; } if(isset($HTTP_GET_VARS["select"])) { $result=DBselect("select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type from items i,hosts h where h.hostid=i.hostid and h.status in (0,2) and i.status=0 and i.description like '%".$HTTP_GET_VARS["select"]."%' ".$HTTP_GET_VARS["sort"]); } else { $result=DBselect("select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type from items i,hosts h where h.hostid=i.hostid and h.status in (0,2) and i.status=0 and h.hostid=".$HTTP_GET_VARS["hostid"]." ".$HTTP_GET_VARS["sort"]); } while($row=DBfetch($result)) { if(!check_right("Item","R",$row["itemid"])) { continue; } if(!check_right("Host","R",$row["hostid"])) { continue; } if($col++%2 == 1) { echo ""; } else { echo ""; } if(isset($HTTP_GET_VARS["select"])) { echo ""; } echo ""; echo ""; if(isset($row["lastvalue"])) { if(round($row["lastvalue"])==$row["lastvalue"]) { if($row["value_type"] == 0 ) { echo ""; } else { echo ""; } } else { echo ""; } } else { echo ""; } if( isset($row["lastvalue"]) && isset($row["prevvalue"]) && $row["lastvalue"]-$row["prevvalue"] != 0 ) { // echo ""; // sprintf("%+0.2f"); does not work if($row["lastvalue"]-$row["prevvalue"]<0) { printf("",$row["lastvalue"]-$row["prevvalue"]); } else { printf("",$row["lastvalue"]-$row["prevvalue"]); } } else { echo ""; } if($row["value_type"]==0) { echo ""; } else { echo ""; } if($row["value_type"]==0) { echo ""; } else { echo ""; } if($row["value_type"]==0) { echo ""; } else { echo ""; } echo ""; } echo "
HostDESCRIPTIONDescriptionDescriptionLAST CHECKLast checkLast checkLast valueChangeHistoryTrendsCompare
".$row["host"]."".$row["description"].""; if($row["status"] == 2) { echo ""; } if(!isset($row["lastclock"])) { echo "
-
"; } else { echo date("d M H:i:s",$row["lastclock"]); } echo "
"; printf("%.0f",$row["lastvalue"]); echo ""; echo substr($row["lastvalue"],0,20)," ..."; echo ""; printf("%.2f",$row["lastvalue"]); echo "-"; echo $row["lastvalue"]-$row["prevvalue"]; echo "%0.2f+%0.2f-GraphGraphTrendTrendCompareCompare
"; show_table_header_end(); } ?>