".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." ".S_HOST." "; $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_header($header); $col=0; if(isset($_REQUEST["select"])) $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ 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_ads($_REQUEST["select"])."%' order by i.description"; else $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ 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, "", ""); if(isset($_REQUEST["select"])) { table_td($row["host"],""); } table_td(item_description($row["description"],$row["key_"]),""); echo ""; if($row["status"] == 2) { echo ""; } iif_echo(!isset($row["lastclock"]), "
-
", date(S_DATE_FORMAT_YMDHMS,$row["lastclock"])); echo "
"; if(isset($row["lastvalue"])) { iif_echo( ($row["value_type"] == ITEM_VALUE_TYPE_FLOAT) || ($row["value_type"] == ITEM_VALUE_TYPE_UINT64), "".convert_units($row["lastvalue"],$row["units"])."", "".nbsp(htmlspecialchars(substr($row["lastvalue"],0,20)." ...")).""); } else { table_td("-","align=center"); } if( isset($row["lastvalue"]) && isset($row["prevvalue"]) && ($row["value_type"] == 0) && ($row["lastvalue"]-$row["prevvalue"] != 0) ) { // echo ""; echo $row["lastvalue"]-$row["prevvalue"]; echo ""; // sprintf("%+0.2f"); does not work if($row["lastvalue"]-$row["prevvalue"]<0) { $str=convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]); $str=nbsp($str); table_td($str,""); } else { $str="+".convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]); $str=nbsp($str); table_td($str,""); // printf("+%0.2f",$row["lastvalue"]-$row["prevvalue"]); } } else { echo "-"; } iif_echo(($row["value_type"]==ITEM_VALUE_TYPE_FLOAT) ||($row["value_type"]==ITEM_VALUE_TYPE_UINT64), "".S_GRAPH."", "".S_HISTORY.""); echo ""; cr(); } table_end(); show_table_header_end(); } else { table_nodata(); } ?>