summaryrefslogtreecommitdiffstats
path: root/frontends/php/trend.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 16:53:24 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 16:53:24 +0000
commit2f691b3628c4589fe258def9564d78cd134d3ebb (patch)
tree278a676e3e5540977348c86b9d7a96ccc105902d /frontends/php/trend.php
parent89d810024288866e72586c1774dec254db9aa884 (diff)
- added upgrades/dbpatches/1.0beta4_to_1.0beta5/ with patches (Alexei)
- added support for disktotal[*] (Alexei) - added support for inodetotal[*] (Alexei) - added support for *,/,+, and - in trigger expressions (Alexei) - removed frontends/php/chart4.php (Alexei) - update item status to UNSUPPORTED in case if SNMP support was not included into zabbix_suckerd (Alexei) - added mysql_init() to DBconnect() (Alexei) - fixed Next100 and Prev100 for case if some hosts are hidden (Alexei) - added select for latest values (Alexei) - delete related services if trigger is deleted (Alexei) - fixed problem with substitution of macros for messages (Alexei) - eliminated DBis_empty() by replacing to DBnum_rows() (Alexei) - MAX_STRING_LEN increased to 4096 (Alexei) - fixed zabbix_log(). Possible coredump if data contains %s, etc (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@445 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/trend.php')
-rw-r--r--frontends/php/trend.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/frontends/php/trend.php b/frontends/php/trend.php
index 97fec832..12e3468d 100644
--- a/frontends/php/trend.php
+++ b/frontends/php/trend.php
@@ -7,6 +7,8 @@
# type
# trendavg
+ $start_time=time(NULL);
+
if(!isset($type))
{
$type="15min";
@@ -79,6 +81,26 @@
$min=array();
$max=array();
$avg=array();
+#if($DB_TYPE!="MYSQL")
+if(0)
+{
+// $sql="select round(900*((clock+3*3600)%(24*3600))/(24*3600)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=$itemid and clock>$from_time and clock<$to_time group by round(900*((clock+3*3600)%(24*3600))/(24*3600))";
+ $p=$to_time-$from_time;
+ $z=$from_time%$p;
+ $sql="select round(900*((clock+$z)%($p))/($p)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=$itemid and clock>$from_time and clock<$to_time group by round(900*((clock+$z)%($p))/($p))";
+ $result=DBselect($sql);
+ while($row=DBfetch($result))
+ {
+ $i=$row["i"];
+ $count[$i]=$row["count"];
+ $min[$i]=$row["min"];
+ $max[$i]=$row["max"];
+ $avg[$i]=$row["avg"];
+ $nodata=0;
+ }
+}
+else
+{
for($i=0;$i<900;$i++)
{
$result=DBselect("select count(value),min(value),max(value),avg(value) from history where itemid=$itemid and clock>$from_time+$i*($to_time-$from_time)/(900-50) and clock<$from_time+($i+1)*($to_time-$from_time)/(900-50)");
@@ -91,6 +113,8 @@
$nodata=0;
}
}
+}
+
for($i=0;$i<=$sizeY;$i+=$sizeY/5)
{
@@ -212,7 +236,10 @@
ImageString($im, 1,$shiftX+20, $sizeY+$shiftY+15, "AVG" , $darkyellow);
ImageString($im, 1,$shiftX+40, $sizeY+$shiftY+15, "MAX" , $darkred);
- ImageStringUp($im,0,2*$shiftX+$sizeX+40,$sizeY+2*$shiftY, "http://zabbix.sourceforge.net", $gray);
+ ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://zabbix.sourceforge.net", $gray);
+
+ $end_time=time(NULL);
+ ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
ImagePng($im);
ImageDestroy($im);