".S_NO_PERMISSIONS."");
show_footer();
exit;
}
$_GET["config"]=@iif(isset($_GET["config"]),$_GET["config"],get_profile("web.hosts.config",0));
update_profile("web.hosts.config",$_GET["config"]);
update_profile("web.menu.config.last",$page["file"]);
?>
";
$h2=$h2.form_select("config",0,S_HOSTS);
$h2=$h2.form_select("config",1,S_HOST_GROUPS);
$h2=$h2.form_select("config",2,S_HOSTS_TEMPLATES_LINKAGE);
$h2=$h2."";
show_header2($h1, $h2, "
");
?>
";
if(isset($_GET["hostid"]))
{
$h2=$h2."";
}
$h2=$h2."";
$h2=$h2." ".S_HOST." ";
$h2=$h2."";
echo "
";
show_header2($h1, $h2, "");
}
?>
";
show_table_header(S_HOST_GROUPS_BIG);
table_begin();
table_header(array(S_ID,S_NAME,S_MEMBERS,S_ACTIONS));
$result=DBselect("select groupid,name from groups order by name");
$col=0;
while($row=DBfetch($result))
{
// $members=array("hide"=>1,"value"=>"");
$members=array("hide"=>0,"value"=>"");
$result1=DBselect("select distinct h.host from hosts h, hosts_groups hg where h.hostid=hg.hostid and hg.groupid=".$row["groupid"]." and h.status not in (".HOST_STATUS_DELETED.") order by host");
for($i=0;$i".S_CHANGE."";
table_row(array(
$row["groupid"],
$row["name"],
$members,
$actions
),$col++);
}
if(DBnum_rows($result)==0)
{
echo "";
echo "".S_NO_HOST_GROUPS_DEFINED." | ";
echo "
";
}
table_end();
}
?>
1,"value"=>"");
# $actions="".S_CHANGE."";
$actions="".S_CHANGE."";
table_row(array(
$host["host"],
$template["host"],
get_template_permission_str($row["items"]),
get_template_permission_str($row["triggers"]),
get_template_permission_str($row["actions"]),
get_template_permission_str($row["graphs"]),
get_template_permission_str($row["screens"]),
$actions
),$col++);
}
if(DBnum_rows($result)==0)
{
echo "
";
echo "".S_NO_LINKAGES_DEFINED." | ";
echo "
";
}
table_end();
}
if(isset($_GET["hostid"])&&$_GET["config"]==2)
{
@insert_template_form($_GET["hostid"], $_GET["hosttemplateid"]);
}
?>
";
$h2=S_GROUP." ";
$h2=$h2."";
echo "
";
show_header2($h1, $h2, "");
?>
";
if(isset($_GET["groupid"]))
{
$sql="select h.hostid,h.host,h.port,h.status,h.useip,h.ip,h.error,h.available from hosts h,hosts_groups hg where hg.groupid=".$_GET["groupid"]." and hg.hostid=h.hostid and h.status<>".HOST_STATUS_DELETED." order by h.host";
}
else
{
$sql="select h.hostid,h.host,h.port,h.status,h.useip,h.ip,h.error,h.available from hosts h where h.status<>".HOST_STATUS_DELETED." order by h.host";
}
$result=DBselect($sql);
$col=0;
while($row=DBfetch($result))
{
if(!check_right("Host","R",$row["hostid"]))
{
continue;
}
$id=" ".$row["hostid"];
$host="".$row["host"]."";
if($row["useip"]==1)
{
$ip=$row["ip"];
}
else
{
$ip="-";
}
if(check_right("Host","U",$row["hostid"]))
{
if($row["status"] == HOST_STATUS_MONITORED)
$status=array("value"=>"".S_MONITORED."","class"=>"off");
else if($row["status"] == HOST_STATUS_NOT_MONITORED)
$status=array("value"=>"".S_NOT_MONITORED."","class"=>"on");
// else if($row["status"] == 2)
// $status=array("value"=>S_UNREACHABLE,"class"=>"unknown");
else if($row["status"] == HOST_STATUS_TEMPLATE)
$status=array("value"=>S_TEMPLATE,"class"=>"unknown");
else if($row["status"] == HOST_STATUS_DELETED)
$status=array("value"=>S_DELETED,"class"=>"unknown");
else
$status=S_UNKNOWN;
}
else
{
if($row["status"] == HOST_STATUS_MONITORED)
$status=array("value"=>S_MONITORED,"class"=>"off");
else if($row["status"] == HOST_STATUS_NOT_MONITORED)
$status=array("value"=>S_NOT_MONITORED,"class"=>"on");
// else if($row["status"] == 2)
// $status=array("value"=>S_UNREACHABLE,"class"=>"unknown");
else if($row["status"] == HOST_STATUS_TEMPLATE)
$status=array("value"=>S_TEMPLATE,"class"=>"unknown");
else if($row["status"] == HOST_STATUS_DELETED)
$status=array("value"=>S_DELETED,"class"=>"unknown");
else
$status=S_UNKNOWN;
}
if($row["available"] == HOST_AVAILABLE_TRUE)
$available=array("value"=>S_AVAILABLE,"class"=>"off");
else if($row["available"] == HOST_AVAILABLE_FALSE)
$available=array("value"=>S_NOT_AVAILABLE,"class"=>"on");
else if($row["available"] == HOST_AVAILABLE_UNKNOWN)
$available=array("value"=>S_UNKNOWN,"class"=>"unknown");
if($row["error"] == "")
{
$error=array("value"=>" ","class"=>"off");
}
else
{
$error=array("value"=>$row["error"],"class"=>"on");
}
if(check_right("Host","U",$row["hostid"]))
{
if($row["status"] != HOST_STATUS_DELETED)
{
$actions="".S_CHANGE."";
/* if(isset($_GET["groupid"]))
{
$actions="".S_CHANGE."";
}
else
{
$actions="".S_CHANGE."";
}*/
}
else
{
$actions=" ";
}
}
else
{
$actions=S_CHANGE;
}
table_row(array(
$id,
$host,
$ip,
$row["port"],
$status,
$available,
$error,
$actions
),$col++);
}
if(DBnum_rows($result)==0)
{
echo "
";
echo "".S_NO_HOSTS_DEFINED." | ";
echo "
";
}
table_end();
show_form_begin();
echo "";
echo "";
echo "";
show_table2_header_end();
echo "";
}
?>
";
show_form_begin("hosts.host");
echo S_HOST;
$col=0;
show_table2_v_delimiter($col++);
echo "