summaryrefslogtreecommitdiffstats
path: root/frontends/php/tr_status.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-02 09:49:44 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-02 09:49:44 +0000
commit053e091380bdeff1d9a423e1dfdcfcda396045d5 (patch)
treeda06e467138936e3cd12ee6db4c73e677c305a76 /frontends/php/tr_status.php
parent467c2281b799cf57a72682097fbeb7caa7d1faae (diff)
downloadzabbix-053e091380bdeff1d9a423e1dfdcfcda396045d5.tar.gz
zabbix-053e091380bdeff1d9a423e1dfdcfcda396045d5.tar.xz
zabbix-053e091380bdeff1d9a423e1dfdcfcda396045d5.zip
- [ZBX-134] merged rev. 4956:4966 of branches/1.4/ (Artem) (fixes for hostid/groupid validation on Node switch)
git-svn-id: svn://svn.zabbix.com/trunk@4968 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/tr_status.php')
-rw-r--r--frontends/php/tr_status.php71
1 files changed, 45 insertions, 26 deletions
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index bc670a4f..719d51c8 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -113,8 +113,10 @@ include_once "include/page_header.php";
$_REQUEST['noactions'] = get_request('noactions', get_profile('web.tr_status.noactions', 'true'));
$_REQUEST['compact'] = get_request('compact', get_profile('web.tr_status.compact', 'true'));
- validate_group_with_host(PERM_READ_ONLY,array('allow_all_hosts','always_select_first_host','monitored_hosts','with_monitored_items'),
- 'web.tr_status.groupid','web.tr_status.hostid');
+ $options = array("allow_all_hosts","always_select_first_host","monitored_hosts","with_monitored_items");
+ if(!$ZBX_WITH_SUBNODES) array_push($options,"only_current_node");
+
+ validate_group_with_host(PERM_READ_ONLY,$options,"web.tr_status.groupid","web.tr_status.hostid");
update_profile('web.tr_status.show_triggers',$_REQUEST['show_triggers']);
update_profile('web.tr_status.show_events',$_REQUEST['show_events']);
@@ -154,7 +156,7 @@ include_once "include/page_header.php";
<?php
$r_form = new CForm();
$r_form->SetMethod('get');
-
+
$cmbGroup = new CComboBox('groupid',$_REQUEST['groupid'],'submit()');
$cmbHosts = new CComboBox('hostid',$_REQUEST['hostid'],'submit()');
@@ -166,9 +168,9 @@ include_once "include/page_header.php";
$result=DBselect("select distinct g.groupid,g.name from groups g, hosts_groups hg, hosts h, items i, functions f, triggers t ".
" where h.hostid in (".$availiable_hosts.") ".
- " 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.
- " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED.
+ " 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.
+ " AND i.itemid=f.itemid AND t.triggerid=f.triggerid AND t.status=".TRIGGER_STATUS_ENABLED.
" order by g.name");
while($row=DBfetch($result))
{
@@ -180,42 +182,59 @@ include_once "include/page_header.php";
}
$r_form->AddItem(array(S_GROUP.SPACE,$cmbGroup));
- if($_REQUEST["groupid"] > 0)
- {
- $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg, functions f, triggers t where h.status=".HOST_STATUS_MONITORED.
- " and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid".
- " and i.status=".ITEM_STATUS_ACTIVE.
- " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED.
- " and h.hostid in (".$availiable_hosts.") ".
- " group by h.hostid,h.host order by h.host";
+ if($_REQUEST["groupid"] > 0){
+
+ $sql='SELECT h.hostid,h.host '.
+ ' FROM hosts h,items i,hosts_groups hg, functions f, triggers t '.
+ ' WHERE h.status='.HOST_STATUS_MONITORED.
+ ' AND h.hostid=i.hostid '.
+ ' AND hg.groupid='.$_REQUEST["groupid"].
+ ' AND hg.hostid=h.hostid'.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ ' AND i.itemid=f.itemid '.
+ ' AND t.triggerid=f.triggerid '.
+ ' AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' AND h.hostid in ('.$availiable_hosts.') '.
+ ' GROUP BY h.hostid,h.host '.
+ ' ORDER BY h.host';
}
- else
- {
+ else{
+
$cmbHosts->AddItem(0,S_ALL_SMALL);
- $sql="select h.hostid,h.host from hosts h,items i, functions f, triggers t where h.status=".HOST_STATUS_MONITORED.
- " and i.status=".ITEM_STATUS_ACTIVE." and h.hostid=i.hostid".
- " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED.
- " and h.hostid in (".$availiable_hosts.") ".
- " group by h.hostid,h.host order by h.host";
+ $sql='SELECT h.hostid,h.host '.
+ ' FROM hosts h,items i, functions f, triggers t '.
+ ' WHERE h.status='.HOST_STATUS_MONITORED.
+ ' AND i.status='.ITEM_STATUS_ACTIVE.
+ ' AND h.hostid=i.hostid'.
+ ' AND i.itemid=f.itemid '.
+ ' AND t.triggerid=f.triggerid '.
+ ' AND t.status='.TRIGGER_STATUS_ENABLED.
+ ' AND h.hostid in ('.$availiable_hosts.') '.
+ ' GROUP BY h.hostid,h.host '.
+ ' ORDER BY h.host';
}
+
$result=DBselect($sql);
+ $flag = false;
while($row=DBfetch($result))
{
+ $flag |= $_REQUEST['hostid'] == $row['hostid'];
$cmbHosts->AddItem(
$row['hostid'],
get_node_name_by_elid($row['hostid']).$row['host']
);
}
+ if(!$flag) $_REQUEST['hostid'] = 0;
$r_form->AddItem(array(SPACE.S_HOST.SPACE,$cmbHosts));
$r_form->AddVar("compact",$compact);
$r_form->AddVar("show_triggers",$show_triggers);
$r_form->AddVar('show_events',$show_events);
- $r_form->AddVar("noactions",$noactions);
- $r_form->AddVar("select",$select);
- $r_form->AddVar("txt_select",$txt_select);
- $r_form->AddVar("sort",$sort);
- if(isset($_REQUEST['fullscreen'])) $r_form->AddVar("fullscreen",1);
+ $r_form->AddVar('noactions',$noactions);
+ $r_form->AddVar('select',$select);
+ $r_form->AddVar('txt_select',$txt_select);
+ $r_form->AddVar('sort',$sort);
+ if(isset($_REQUEST['fullscreen'])) $r_form->AddVar('fullscreen',1);
show_table_header(
new CLink(SPACE.S_STATUS_OF_TRIGGERS_BIG.SPACE.date("[H:i:s]",time()),"tr_status.php?show_triggers=$show_triggers".