summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-30 11:09:33 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-30 11:09:33 +0000
commit7fcb30f02c1dfae9caaab498c2269b6f2cd1ff25 (patch)
tree6da05f089e572f58207f7a3593af432e5e7b3d41 /frontends/php
parent13720ef034595b53f10251d8d9fada5fa8c8048e (diff)
downloadzabbix-7fcb30f02c1dfae9caaab498c2269b6f2cd1ff25.tar.gz
zabbix-7fcb30f02c1dfae9caaab498c2269b6f2cd1ff25.tar.xz
zabbix-7fcb30f02c1dfae9caaab498c2269b6f2cd1ff25.zip
More changes for trending
git-svn-id: svn://svn.zabbix.com/trunk@1075 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/charts.php4
-rw-r--r--frontends/php/include/classes.inc.php9
2 files changed, 12 insertions, 1 deletions
diff --git a/frontends/php/charts.php b/frontends/php/charts.php
index 0413e8ec..1aeab56b 100644
--- a/frontends/php/charts.php
+++ b/frontends/php/charts.php
@@ -177,6 +177,10 @@
echo($count."h</A>]&nbsp;");
}
+ echo("[<A HREF=\"charts.php?period=".(7*24*3600).url_param("graphid").url_param("from").url_param("keep").url_param("fullscreen")."\">week</A>]&nbsp;");
+ echo("[<A HREF=\"charts.php?period=".(30*24*3600).url_param("graphid").url_param("from").url_param("keep").url_param("fullscreen")."\">month</A>]&nbsp;");
+ echo("[<A HREF=\"charts.php?period=".(365*24*3600).url_param("graphid").url_param("from").url_param("keep").url_param("fullscreen")."\">year</A>]&nbsp;");
+
echo("or&nbsp;");
$tmp=$HTTP_GET_VARS["period"]+$hour;
echo("[<A HREF=\"charts.php?period=$tmp".url_param("graphid").url_param("from").url_param("keep").url_param("fullscreen")."\">");
diff --git a/frontends/php/include/classes.inc.php b/frontends/php/include/classes.inc.php
index 6c75f9e0..ae30ab6c 100644
--- a/frontends/php/include/classes.inc.php
+++ b/frontends/php/include/classes.inc.php
@@ -411,7 +411,14 @@
}
$str=substr($str,0,strlen($str)-1);
- $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
+ if($this->period<=24*3600)
+ {
+ $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
+ }
+ else
+ {
+ $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,sum(num) as count,avg(value_avg) as avg,min(value_min) as min,max(value_max) as max from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
+ }
// echo $sql;
$result=DBselect($sql);