".S_NO_PERMISSIONS.""); show_page_footer(); exit; } ?> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL), "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL), "select"=> array(T_ZBX_STR, O_OPT, NULL, NULL, NULL) ); // check_fields($fields); ?> ".S_NO_PERMISSIONS.""); show_page_footer(); exit; } ?> "; $h2=$h2.form_select("groupid",0,S_ALL_SMALL); $result=DBselect("select groupid,name from groups order by name"); while($row=DBfetch($result)) { // Check if at least one host with read permission exists for this group $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"); $cnt=0; while($row2=DBfetch($result2)) { if(!check_right("Host","R",$row2["hostid"])) { continue; } $cnt=1; break; } if($cnt!=0) { $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]); } } $h2=$h2.""; $h2=$h2.SPACE.S_HOST.SPACE; $h2=$h2.""; $h2=$h2.nbsp(" "); if(isset($_REQUEST["select"])&&($_REQUEST["select"]=="")) { unset($_REQUEST["select"]); } // $h2=$h2.S_SELECT; // $h2=$h2.nbsp(" "); if(isset($_REQUEST["select"])) { $h2=$h2.""; } else { $h2=$h2.""; } $h2=$h2.nbsp(" "); $h2=$h2.""; show_header2($h1, $h2, "
", "
"); ?> "; if(!isset($_REQUEST["select"])||($_REQUEST["select"] == "")) { $result=get_host_by_hostid($_REQUEST["hostid"]); $host=$result["host"]; // show_table_header("$host"); } else { // show_table_header("Description is like *".$_REQUEST["select"]."*"); } # show_table_header_begin(); # echo "$host"; # show_table3_v_delimiter(); // table_begin(); $header=array(); if(isset($_REQUEST["select"])) { $header=array_merge($header,array(S_HOST)); } $header=array_merge($header,array(S_DESCRIPTION, S_LAST_CHECK, S_LAST_VALUE,S_CHANGE,S_HISTORY)); $table=new CTableInfo(); $table->setHeader($header); // table_header($header); $col=0; if(isset($_REQUEST["select"])) $sql="select h.host,i.*,h.hostid from items i,hosts h". " where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED. " and i.status=0 and i.description like ".zbx_dbstr("%",$_REQUEST["select"]."%"). " order by i.description"; else $sql="select h.host,i.*,h.hostid from items i,hosts h". " where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED. " and i.status=0 and h.hostid=".$_REQUEST["hostid"]." order by i.description"; $result=DBselect($sql); while($row=DBfetch($result)) { if(!check_right("Item","R",$row["itemid"])) { continue; } if(!check_right("Host","R",$row["hostid"])) { continue; } // iif_echo($col++%2 == 1, // "", // ""); $host=NULL; if(isset($_REQUEST["select"])) { $host=$row["host"]; } $description = item_description($row["description"],$row["key_"]); if(isset($row["lastclock"])) { $lastclock=date(S_DATE_FORMAT_YMDHMS,$row["lastclock"]); } else { $lastclock="-"; } if(isset($row["lastvalue"])) { if(($row["value_type"] == ITEM_VALUE_TYPE_FLOAT) || ($row["value_type"] == ITEM_VALUE_TYPE_UINT64)) { $lastvalue=convert_units($row["lastvalue"],$row["units"]); } else { $lastvalue=nbsp(htmlspecialchars(substr($row["lastvalue"],0,20)." ...")); } $lastvalue = replace_value_by_map($lastvalue, $row["valuemapid"]); } else { $lastvalue=new CCol("-","center"); } if( isset($row["lastvalue"]) && isset($row["prevvalue"]) && ($row["value_type"] == 0) && ($row["lastvalue"]-$row["prevvalue"] != 0) ) { if($row["lastvalue"]-$row["prevvalue"]<0) { $change=convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]); $change=nbsp($change); } else { $change="+".convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]); $change=nbsp($change); } } else { $change=new CCol("-","center"); } if(($row["value_type"]==ITEM_VALUE_TYPE_FLOAT) ||($row["value_type"]==ITEM_VALUE_TYPE_UINT64)) { $actions=new CLink(S_GRAPH,"history.php?action=showhistory&itemid=".$row["itemid"],"action"); } else { $actions=new CLink(S_HISTORY,"history.php?action=showvalues&period=3600&itemid=".$row["itemid"],"action"); } $table->addRow(array( $host, $description, $lastclock, $lastvalue, $change, $actions )); } $table->show(); } ?>