diff options
| author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-11 20:17:42 +0000 |
|---|---|---|
| committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-11 20:17:42 +0000 |
| commit | 3fa60cc03b6abbeeb4cd0342df8d6f672b3e2b6d (patch) | |
| tree | 6ea7cdefff873c7d24b98f4d3968c739ad38fea6 /frontends/php | |
| parent | f8bfbc1f123c48c09c93a01a5e831c577cbf68fd (diff) | |
| download | zabbix-3fa60cc03b6abbeeb4cd0342df8d6f672b3e2b6d.tar.gz zabbix-3fa60cc03b6abbeeb4cd0342df8d6f672b3e2b6d.tar.xz zabbix-3fa60cc03b6abbeeb4cd0342df8d6f672b3e2b6d.zip | |
- [DEV-108] GUI
git-svn-id: svn://svn.zabbix.com/trunk@5475 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/hosts.php | 30 | ||||
| -rw-r--r-- | frontends/php/httpconf.php | 8 | ||||
| -rw-r--r-- | frontends/php/include/hosts.inc.php | 5 | ||||
| -rw-r--r-- | frontends/php/items.php | 16 | ||||
| -rw-r--r-- | frontends/php/popup.php | 70 |
5 files changed, 64 insertions, 65 deletions
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index 3e4d7b6c..5ff9b211 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -425,8 +425,8 @@ include_once "include/page_header.php"; $status = isset($_REQUEST["activate"]) ? HOST_STATUS_MONITORED : HOST_STATUS_NOT_MONITORED; $groups = get_request("groups",array()); - $db_hosts=DBselect("select h.hostid, hg.groupid from hosts_groups hg, hosts h". - " where h.hostid=hg.hostid and h.status<>".HOST_STATUS_DELETED. + $db_hosts=DBselect('select h.hostid, hg.groupid from hosts_groups hg, hosts h'. + ' where h.hostid=hg.hostid and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')'. ' and '.DBin_node('h.hostid')); while($db_host=DBfetch($db_hosts)) { @@ -974,7 +974,8 @@ include_once "include/page_header.php"; $style = $db_host["status"]==HOST_STATUS_MONITORED ? NULL: ( $db_host["status"]==HOST_STATUS_TEMPLATE ? "unknown" : "on"); - array_push($hosts,empty($hosts)?'':',',new CSpan($db_host["host"],$style)); + + array_push($hosts, empty($hosts) ? '' : ', ', new CSpan($db_host["host"], $style)); $count++; } @@ -989,7 +990,6 @@ include_once "include/page_header.php"; ), $count, $hosts -// implode(', ',$hosts) )); } $table->SetFooter(new CCol(array( @@ -1024,24 +1024,19 @@ include_once "include/page_header.php"; ' FROM hosts h, hosts_templates ht '. ' WHERE ht.templateid='.$template['hostid']. ' AND ht.hostid=h.hostid '. - ' AND h.status not in ('.HOST_STATUS_TEMPLATE.') '. + ' AND h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.') '. ' AND h.hostid in ('.$available_hosts.') '. ' ORDER BY host'); $host_list = array(); while($host = DBfetch($hosts)) { - if($host["status"] == HOST_STATUS_NOT_MONITORED) - { - array_push($host_list, unpack_object(new CSpan($host["host"],"on"))); - } - else - { - array_push($host_list, $host["host"]); - } + $style = $host["status"] == HOST_STATUS_MONITORED ? NULL : 'on'; + + array_push($host_list, empty($host_list) ? '' : ', ', new CSpan($host["host"], $style)); } $table->AddRow(array( new CSpan($template["host"],"unknown"), - implode(', ',$host_list) + $host_list )); } @@ -1075,12 +1070,13 @@ include_once "include/page_header.php"; $sql="select distinct h.hostid,h.host from hosts h,hosts_groups hg". " where hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid ". " and h.hostid in (".$available_hosts.") ". - " and h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"; + ' and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')'. + ' group by h.hostid,h.host order by h.host'; } else { $sql="select distinct h.hostid,h.host from hosts h ". - " where h.status<>".HOST_STATUS_DELETED. + ' where h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')'. " and h.hostid in (".$available_hosts.") ". " group by h.hostid,h.host order by h.host"; } @@ -1192,7 +1188,7 @@ include_once "include/page_header.php"; ' FROM hosts'. ' WHERE proxy_hostid='.$db_proxy['hostid']. ' AND hostid in ('.$available_hosts.')'. - ' AND status not in ('.HOST_STATUS_DELETED.') '. + ' and status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')'. ' order by host' ); diff --git a/frontends/php/httpconf.php b/frontends/php/httpconf.php index b116ba65..da39a8a3 100644 --- a/frontends/php/httpconf.php +++ b/frontends/php/httpconf.php @@ -377,13 +377,15 @@ include_once "include/page_header.php"; { $sql="select distinct h.hostid,h.host from hosts h,hosts_groups hg". " where hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid ". + ' and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. " and h.hostid in (".$accessible_hosts.") ". - " and h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"; + " group by h.hostid,h.host order by h.host"; } else { - $sql="select distinct h.hostid,h.host from hosts h where h.status<>".HOST_STATUS_DELETED. - " and h.hostid in (".$accessible_hosts.") ". + $sql="select distinct h.hostid,h.host from hosts h". + ' where h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. + " and h.hostid in (".$accessible_hosts.")". " group by h.hostid,h.host order by h.host"; } diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php index f97eb553..acdabed1 100644 --- a/frontends/php/include/hosts.inc.php +++ b/frontends/php/include/hosts.inc.php @@ -606,8 +606,9 @@ require_once "include/items.inc.php"; { update_trigger_value_to_unknown_by_hostid($hostid); info("Updated status of host ".$row["host"]); - return DBexecute("update hosts set status=$status". - " where hostid=$hostid and status!=".HOST_STATUS_DELETED); + return DBexecute('update hosts set status='.$status.' where hostid='.$hostid. + ' and status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.')' + ); } else { diff --git a/frontends/php/items.php b/frontends/php/items.php index 8f76da79..23d2b408 100644 --- a/frontends/php/items.php +++ b/frontends/php/items.php @@ -682,16 +682,18 @@ include_once "include/page_header.php"; if(isset($_REQUEST["groupid"]) && $_REQUEST["groupid"]>0) { - $sql="select distinct h.hostid,h.host from hosts h,hosts_groups hg". - " where hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid ". - " and h.hostid in (".$accessible_hosts.") ". - " and h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"; + $sql='select distinct h.hostid,h.host from hosts h,hosts_groups hg'. + ' where hg.groupid='.$_REQUEST['groupid'].' and hg.hostid=h.hostid '. + ' and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. + ' and h.hostid in ('.$accessible_hosts.') '. + ' group by h.hostid,h.host order by h.host'; } else { - $sql="select distinct h.hostid,h.host from hosts h where h.status<>".HOST_STATUS_DELETED. - " and h.hostid in (".$accessible_hosts.") ". - " group by h.hostid,h.host order by h.host"; + $sql='select distinct h.hostid,h.host from hosts h'. + ' where h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. + ' and h.hostid in ('.$accessible_hosts.') '. + ' group by h.hostid,h.host order by h.host'; } $result=DBselect($sql); diff --git a/frontends/php/popup.php b/frontends/php/popup.php index 78d145a2..a1b3046a 100644 --- a/frontends/php/popup.php +++ b/frontends/php/popup.php @@ -174,9 +174,17 @@ include_once "include/page_header.php"; $srcfld1 = get_request("srcfld1", ''); // source table field [can be different from fields of source table] $srcfld2 = get_request("srcfld2", null); // second source table field [can be different from fields of source table] - $monitored_hosts = get_request("monitored_hosts", 0); - $real_hosts = get_request("real_hosts", 0); - $only_hostid = get_request("only_hostid", null); + $monitored_hosts = get_request("monitored_hosts", 0); + $real_hosts = get_request("real_hosts", 0); + $only_hostid = get_request("only_hostid", null); + + $host_status = array(); + if ($monitored_hosts) + array_push($host_status, HOST_STATUS_MONITORED); + else if ($real_hosts) + array_push($host_status, HOST_STATUS_MONITORED, HOST_STATUS_NOT_MONITORED); + else + array_push($host_status, HOST_STATUS_MONITORED, HOST_STATUS_NOT_MONITORED, HOST_STATUS_TEMPLATE); ?> <?php global $USER_DETAILS; @@ -275,15 +283,14 @@ include_once "include/page_header.php"; if(str_in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates','graphs','simple_graph','plain_text'))) { $groupid = get_request('groupid',get_profile('web.popup.groupid',0)); - + $cmbGroups = new CComboBox('groupid',$groupid,'submit()'); $cmbGroups->AddItem(0,S_ALL_SMALL); $db_groups = DBselect('SELECT DISTINCT g.groupid,g.name from groups g, hosts_groups hg, hosts h '. ' where '.DBin_node('g.groupid', $nodeid). - ' AND g.groupid=hg.groupid AND hg.hostid in ('.$accessible_hosts.') '. - ' AND hg.hostid = h.hostid '. - ($monitored_hosts ? ' AND h.status='.HOST_STATUS_MONITORED : ''). - ($real_hosts ? ' AND h.status<>'.HOST_STATUS_TEMPLATE : ''). + ' AND g.groupid=hg.groupid AND hg.hostid=h.hostid'. + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'. ' order by name'); while($group = DBfetch($db_groups)) { @@ -321,9 +328,8 @@ include_once "include/page_header.php"; } $sql .= DBin_node('h.hostid', $nodeid). - " AND h.hostid in (".$accessible_hosts.")". - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ""). - ($real_hosts ? ' AND h.status<>'.HOST_STATUS_TEMPLATE : ''). + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'. ' order by host,h.hostid'; $db_hosts = DBselect($sql); @@ -366,9 +372,8 @@ include_once "include/page_header.php"; $sql .= " where "; $sql .= DBin_node('h.hostid', $nodeid). - " AND h.hostid in (".$accessible_hosts.") ". - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ""). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ""). + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'. " order by h.host,h.hostid"; @@ -569,7 +574,7 @@ include_once "include/page_header.php"; else $sql .= ' WHERE '; - $sql .= DBin_node('h.hostid',$nodeid).' AND status='.HOST_STATUS_TEMPLATE. + $sql .= DBin_node('h.hostid',$nodeid).' AND h.status='.HOST_STATUS_TEMPLATE. ' AND h.hostid in ('.$accessible_hosts.') '. ' ORDER BY h.host,h.hostid'; $db_hosts = DBselect($sql); @@ -688,16 +693,16 @@ include_once "include/page_header.php"; S_SEVERITY, S_STATUS)); - - $sql = 'SELECT h.host,t.triggerid,t.description,t.expression,t.priority,t.status,count(d.triggerid_up) as dep_count '. - ' FROM hosts h,items i,functions f, triggers t left join trigger_depends d on d.triggerid_down=t.triggerid '. + $sql = 'SELECT h.host,t.triggerid,t.description,t.expression,t.priority,t.status,'. + 'count(d.triggerid_up) as dep_count '. + ' FROM hosts h,items i,functions f, triggers t'. + ' left join trigger_depends d on d.triggerid_down=t.triggerid '. ' WHERE f.itemid=i.itemid '. ' AND h.hostid=i.hostid '. ' AND t.triggerid=f.triggerid'. ' AND '.DBin_node('t.triggerid', $nodeid). - ' AND h.hostid in ('.$accessible_hosts.')'. - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ""). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ""); + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'; if(isset($hostid)) $sql .= ' AND h.hostid='.$hostid; @@ -779,9 +784,8 @@ include_once "include/page_header.php"; " where i.value_type=".ITEM_VALUE_TYPE_LOG." AND h.hostid=i.hostid". ' AND '.DBin_node('i.itemid', $nodeid). (isset($hostid) ? " AND ".$hostid."=i.hostid " : ""). - " AND i.hostid in (".$accessible_hosts.")". - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ""). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ""). + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'. " order by h.host,i.description, i.key_, i.itemid"); while($db_item = DBfetch($db_items)) @@ -822,9 +826,8 @@ include_once "include/page_header.php"; $sql = 'SELECT DISTINCT h.host,i.* from hosts h,items i '. ' WHERE h.hostid=i.hostid '. ' AND '.DBin_node('i.itemid', $nodeid). - ' AND h.hostid IN ('.$accessible_hosts.')'. - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ''). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ''); + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'; if(isset($hostid)) $sql .= ' AND h.hostid='.$hostid; @@ -873,9 +876,8 @@ include_once "include/page_header.php"; ' FROM hosts h,applications a '. ' WHERE h.hostid=a.hostid '. ' AND '.DBin_node('a.applicationid', $nodeid). - ' AND h.hostid IN ('.$accessible_hosts.')'. - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ""). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ""); + ' and h.hostid in ('.$accessible_hosts.')'. + ' and h.status in ('.implode(',', $host_status).')'; if(isset($hostid)) $sql .= ' AND h.hostid='.$hostid; @@ -1010,9 +1012,7 @@ include_once "include/page_header.php"; ' AND h.status='.HOST_STATUS_MONITORED. ' AND i.status='.ITEM_STATUS_ACTIVE. ' AND '.DBin_node('i.itemid', $nodeid). - ' AND h.hostid not in ('.$denyed_hosts.')'. - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ''). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ''); + ' AND h.hostid not in ('.$denyed_hosts.')'; if(isset($hostid)) $sql .= ' AND h.hostid='.$hostid; @@ -1108,9 +1108,7 @@ include_once "include/page_header.php"; ' AND h.status='.HOST_STATUS_MONITORED. ' AND i.status='.ITEM_STATUS_ACTIVE. ' AND '.DBin_node('i.itemid', $nodeid). - ' AND h.hostid not in ('.$denyed_hosts.')'. - ($monitored_hosts ? " AND h.status=".HOST_STATUS_MONITORED : ''). - ($real_hosts ? " AND h.status<>".HOST_STATUS_TEMPLATE : ''); + ' AND h.hostid not in ('.$denyed_hosts.')'; if(isset($hostid)) $sql .= ' AND h.hostid='.$hostid; |
