diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-22 14:12:44 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-22 14:12:44 +0000 |
commit | 6a552162aec2f5792283711b4045b2a46eb51cd0 (patch) | |
tree | 6aa24787e5f4e11455d494b2b79ddc2493793419 /frontends | |
parent | d25027cf11279e91edd6658f4c5f9e7a35231b43 (diff) | |
download | zabbix-6a552162aec2f5792283711b4045b2a46eb51cd0.tar.gz zabbix-6a552162aec2f5792283711b4045b2a46eb51cd0.tar.xz zabbix-6a552162aec2f5792283711b4045b2a46eb51cd0.zip |
- fixed graph duplication (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2878 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/php/charts.php | 10 | ||||
-rw-r--r-- | frontends/php/graphs.php | 8 | ||||
-rw-r--r-- | frontends/php/include/graphs.inc.php | 10 |
3 files changed, 18 insertions, 10 deletions
diff --git a/frontends/php/charts.php b/frontends/php/charts.php index 26fe7252..2b665b1d 100644 --- a/frontends/php/charts.php +++ b/frontends/php/charts.php @@ -170,13 +170,17 @@ } elseif ($_REQUEST["groupid"] > 0) { - $sql = "select distinct g.graphid,g.name from graphs g,graphs_items gi,items i,hosts_groups hg". - " where i.itemid=gi.itemid and g.graphid=gi.graphid and i.hostid=gh.hostid and gh.groupid=".$_REQUEST["groupid"]. + $sql = "select distinct g.graphid,g.name from graphs g,graphs_items gi,items i,hosts_groups hg,hosts h". + " where i.itemid=gi.itemid and g.graphid=gi.graphid and i.hostid=hg.hostid and hg.groupid=".$_REQUEST["groupid"]. + " and i.hostid=h.hostid and h.status=".HOST_STATUS_MONITORED. " order by g.name"; } else { - $sql = "select distinct g.graphid,g.name from graphs g"; + $sql = "select distinct g.graphid,g.name from graphs g,graphs_items gi,items i,hosts h". + " where i.itemid=gi.itemid and g.graphid=gi.graphid ". + " and i.hostid=h.hostid and h.status=".HOST_STATUS_MONITORED. + " order by g.name"; } $result=DBselect($sql); diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index 133ddb9a..92a735d2 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -32,7 +32,7 @@ "groupid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), "hostid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), - "graphid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '{form}=="update"'), + "graphid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '{form}=="update"'), "name"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), "width"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), 'isset({save})'), "height"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), 'isset({save})'), @@ -147,7 +147,7 @@ // Check if at least one host with read permission exists for this group $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg". " where h.hostid=i.hostid and hg.groupid=".$row["groupid"]. - " and hg.hostid=h.hostid and h.status not in (".HOST_STATUS_DELETED.")". + " and hg.hostid=h.hostid and h.status=".HOST_STATUS_MONITORED. " group by h.hostid,h.host order by h.host"); while($row2=DBfetch($result2)) { @@ -169,13 +169,13 @@ { $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg". " where h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]. - " and hg.hostid=h.hostid"." and h.status not in (".HOST_STATUS_DELETED.")". + " and hg.hostid=h.hostid"." and h.status=".HOST_STATUS_MONITORED. " group by h.hostid,h.host order by h.host"; } else { $sql="select h.hostid,h.host from hosts h,items i where h.hostid=i.hostid". - " and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host". + " and h.status=".HOST_STATUS_MONITORED." group by h.hostid,h.host". " order by h.host"; } diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index 9abdf176..552a47a4 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -215,8 +215,12 @@ $host = get_host_by_itemid($itemid); if($gitemid && $host["status"]==HOST_STATUS_TEMPLATE) {// add to child graphs - $gitems = get_graphitems_by_graphid($graphid); - if(DBfetch($gitems)) + $item_num = DBfetch(DBselect( + 'select count(*) as num from graphs_items where graphid='.$graphid. + ' order by itemid,drawtype,sortorder,color,yaxisside' + )); + + if($item_num['num'] == 1) {// create graphs for childs with item $chd_hosts = get_hosts_by_templateid($host["hostid"]); while($chd_host = DBfetch($chd_hosts)) @@ -253,7 +257,7 @@ $childs = get_graphs_by_templateid($graphid); while($child = DBfetch($childs)) { - $chd_hosts = get_hosts_by_graphid($child["graphid"]); + ! $chd_hosts = get_hosts_by_graphid($child["graphid"]); $chd_host = DBfetch($chd_hosts); $db_items = DBselect("select itemid from items". " where key_=".zbx_dbstr($item["key_"]). |