diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-19 13:34:49 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-19 13:34:49 +0000 |
| commit | 3ba88e45481ee0af76505daf3b914239c8872aff (patch) | |
| tree | 8d715ac4543f12597e60f16955b1eaa614bdbc87 /frontends/php/include/classes/graph.inc.php | |
| parent | cc152b0897491d4efa0a5ef2e1b1dab6e90fb33e (diff) | |
| download | zabbix-3ba88e45481ee0af76505daf3b914239c8872aff.tar.gz zabbix-3ba88e45481ee0af76505daf3b914239c8872aff.tar.xz zabbix-3ba88e45481ee0af76505daf3b914239c8872aff.zip | |
- cleaned SQL statements to have mod() instead of % (Alexei)
- fixed displaying of graphs for periods more than 24h (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2862 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes/graph.inc.php')
| -rw-r--r-- | frontends/php/include/classes/graph.inc.php | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php index 4fbd5086..efdcc0ee 100644 --- a/frontends/php/include/classes/graph.inc.php +++ b/frontends/php/include/classes/graph.inc.php @@ -741,20 +741,14 @@ $sql_arr = array(); 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,max(clock) as clock 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($DB_TYPE == "ORACLE") - { - array_push($sql_arr, - "select itemid,round(900*(mod((clock+$z),($p)))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*(mod((clock+$z),($p)))/($p),0)", - "select itemid,round(900*(mod((clock+$z),($p)))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history_uint where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*(mod((clock+$z),($p)))/($p),0)"); - } - else - { - array_push($sql_arr, - "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,max(clock) as clock 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)", - "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,max(clock) as clock from history_uint where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"); - } + array_push($sql_arr, + "select itemid,round(900*(mod(clock+$z,$p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*(mod(clock+$z,$p))/($p),0)", + "select itemid,round(900*(mod(clock+$z,$p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history_uint where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*(mod(clock+$z,$p))/($p),0)"); + } + else + { + array_push($sql_arr, + "select itemid,round(900*(mod(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,max(clock) as clock from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*(mod(clock+$z,$p))/($p),0)"); } // echo "<br>",$sql,"<br>"; |
