summaryrefslogtreecommitdiffstats
path: root/frontends/php/report2.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-02 09:30:29 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-02 09:30:29 +0000
commit467c2281b799cf57a72682097fbeb7caa7d1faae (patch)
treef75f1d11f6160086057ee45cd3abbc464bccf2ba /frontends/php/report2.php
parentd6c398a22edb09dffc3f7589635897c78b1fae62 (diff)
downloadzabbix-467c2281b799cf57a72682097fbeb7caa7d1faae.tar.gz
zabbix-467c2281b799cf57a72682097fbeb7caa7d1faae.tar.xz
zabbix-467c2281b799cf57a72682097fbeb7caa7d1faae.zip
- [DEV-62] added availability to select all hosts in "Availability report" (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@4967 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/report2.php')
-rw-r--r--frontends/php/report2.php58
1 files changed, 42 insertions, 16 deletions
diff --git a/frontends/php/report2.php b/frontends/php/report2.php
index 3becd0b5..e4ebd350 100644
--- a/frontends/php/report2.php
+++ b/frontends/php/report2.php
@@ -30,16 +30,17 @@ include_once "include/page_header.php";
?>
<?php
-// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID, NULL),
- "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID, NULL),
+ "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL),
+ "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL),
"triggerid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID, NULL)
);
check_fields($fields);
- validate_group_with_host(PERM_READ_LIST,array("always_select_first_host","monitored_hosts","with_items"));
+// validate_group_with_host(PERM_READ_LIST,array("always_select_first_host","monitored_hosts","with_items"));
+ validate_group_with_host(PERM_READ_LIST,array("allow_all_hosts","always_select_first_host","monitored_hosts","with_items"));
?>
<?php
$r_form = new CForm();
@@ -49,6 +50,7 @@ include_once "include/page_header.php";
$cmbHosts = new CComboBox("hostid",$_REQUEST["hostid"],"submit()");
$cmbGroup->AddItem(0,S_ALL_SMALL);
+ $cmbHosts->AddItem(0,S_ALL_SMALL);
$availiable_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, get_current_nodeid());
@@ -57,6 +59,8 @@ include_once "include/page_header.php";
" and hg.groupid=g.groupid and h.status=".HOST_STATUS_MONITORED.
" and h.hostid=i.hostid and hg.hostid=h.hostid and i.status=".ITEM_STATUS_ACTIVE.
" order by g.name");
+
+
while($row=DBfetch($result))
{
$cmbGroup->AddItem(
@@ -115,21 +119,42 @@ include_once "include/page_header.php";
}
else if(isset($_REQUEST["hostid"]))
{
- $row = DBfetch(DBselect("select host from hosts where hostid=".$_REQUEST["hostid"]));
- show_table_header($row["host"]);
-
- $result = DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.value ".
- " from triggers t,hosts h,items i,functions f ".
- " where f.itemid=i.itemid and h.hostid=i.hostid and t.status=".TRIGGER_STATUS_ENABLED.
- " and t.triggerid=f.triggerid and h.hostid=".$_REQUEST["hostid"]." and h.status=".HOST_STATUS_MONITORED.
- ' and '.DBin_node('t.triggerid').
- " and i.status=".ITEM_STATUS_ACTIVE.
- " order by h.host, t.description");
-
+ if($_REQUEST['hostid'] > 0){
+ $row = DBfetch(DBselect('select host from hosts where hostid='.$_REQUEST['hostid']));
+ show_table_header($row['host']);
+
+ $result = DBselect('select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.value '.
+ ' from triggers t,hosts h,items i,functions f '.
+ ' where f.itemid=i.itemid '.
+ ' and h.hostid=i.hostid '.
+ ' and t.status='.TRIGGER_STATUS_ENABLED.
+ ' and t.triggerid=f.triggerid '.
+ ' and h.hostid='.$_REQUEST['hostid'].
+ ' and h.status='.HOST_STATUS_MONITORED.
+ ' and '.DBin_node('t.triggerid').
+ ' and i.status='.ITEM_STATUS_ACTIVE.
+ ' order by h.host, t.description');
+ }
+ else{
+ show_table_header(S_ALL_HOSTS_BIG);
+
+ $result = DBselect('SELECT DISTINCT h.hostid,h.host,t.triggerid,t.expression,t.description,t.value '.
+ ' FROM triggers t,hosts h,items i,functions f '.
+ ' WHERE f.itemid=i.itemid '.
+ ' AND h.hostid=i.hostid '.
+ ' AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' AND t.triggerid=f.triggerid '.
+ ' AND h.status='.HOST_STATUS_MONITORED.
+ ' AND h.hostid in ('.$availiable_hosts.')'.
+ ' AND '.DBin_node('t.triggerid').
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ ' ORDER BY h.host, t.description');
+ }
+
$accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY);
$table = new CTableInfo();
- $table->setHeader(array(is_show_subnodes() ? S_NODE : null, S_NAME,S_TRUE,S_FALSE,S_UNKNOWN,S_GRAPH));
+ $table->setHeader(array(is_show_subnodes() ? S_NODE : null,($_REQUEST['hostid'] == 0)?S_HOST:NULL, S_NAME,S_TRUE,S_FALSE,S_UNKNOWN,S_GRAPH));
while($row=DBfetch($result))
{
if(!check_right_on_trigger_by_triggerid(null, $row['triggerid'], $accessible_hosts))
@@ -144,6 +169,7 @@ include_once "include/page_header.php";
$table->addRow(array(
get_node_name_by_elid($row['hostid']),
+ ($_REQUEST['hostid'] == 0)?$row['host']:NULL,
new CLink(
expand_trigger_description_by_data($row),
"events.php?triggerid=".$row["triggerid"],"action"),