summaryrefslogtreecommitdiffstats
path: root/frontends/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
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')
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
-rw-r--r--frontends/php/include/triggers.inc.php1
-rw-r--r--frontends/php/report2.php58
-rw-r--r--frontends/php/report5.php20
4 files changed, 57 insertions, 23 deletions
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 5ac58fdc..940e7a0b 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -593,6 +593,7 @@
'S_NO_APPLICATIONS_DEFINED'=> 'No applications defined',
'S_HOSTS'=> 'Hosts',
+ 'S_ALL_HOSTS_BIG'=> 'ALL HOSTS',
'S_ITEMS'=> 'Items',
'S_ITEMS_BIG'=> 'ITEMS',
'S_TRIGGERS'=> 'Triggers',
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index ae652fd7..7b958382 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -1125,6 +1125,7 @@
}
}
}
+
if(strstr($description,'{ITEM.VALUE}'))
{
$value=($flag==ZBX_FLAG_TRIGGER)?
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"),
diff --git a/frontends/php/report5.php b/frontends/php/report5.php
index dec045c5..24b9ee49 100644
--- a/frontends/php/report5.php
+++ b/frontends/php/report5.php
@@ -74,13 +74,19 @@ include_once "include/page_header.php";
$accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY);
- $result=DBselect("select h.host, t.triggerid, t.description, t.description, t.priority, count(distinct e.eventid) as count ".
- " from hosts h, triggers t, functions f, items i, events e where ".
- " h.hostid = i.hostid and i.itemid = f.itemid and t.triggerid=f.triggerid and ".
- ' t.triggerid=e.objectid and e.object='.EVENT_OBJECT_TRIGGER.' and e.clock>'.(time()-$time_dif).
- ' and h.hostid in ('.$accessible_hosts.') and '.DBin_node('t.triggerid').
- " group by h.host,t.triggerid,t.description,t.expression,t.priority ".
- " order by count desc, h.host, t.description, t.triggerid", 100);
+ $result=DBselect('SELECT h.host, t.triggerid, t.description, t.expression, t.priority, count(distinct e.eventid) as count '.
+ ' FROM hosts h, triggers t, functions f, items i, events e'.
+ ' WHERE h.hostid = i.hostid '.
+ ' and i.itemid = f.itemid '.
+ ' and t.triggerid=f.triggerid '.
+ ' and t.triggerid=e.objectid '.
+ ' and e.object='.EVENT_OBJECT_TRIGGER.
+ ' and e.clock>'.(time()-$time_dif).
+ ' and h.hostid in ('.$accessible_hosts.') '.
+ ' and '.DBin_node('t.triggerid').
+ ' GROUP BY h.host,t.triggerid,t.description,t.expression,t.priority '.
+ ' ORDER BY count desc, h.host, t.description, t.triggerid'
+ , 100);
while($row=DBfetch($result))
{