summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-09-02 19:26:14 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-09-02 19:26:14 +0000
commit3f486ab35bc86902abbc008cf1c6940450c375c3 (patch)
treeadb97c2c3de842b86f9067276cf3e41dfc4cfc7f /frontends/php/include
parent48375205798765ce28cf46494656a4516e03b8b5 (diff)
downloadzabbix-3f486ab35bc86902abbc008cf1c6940450c375c3.tar.gz
zabbix-3f486ab35bc86902abbc008cf1c6940450c375c3.tar.xz
zabbix-3f486ab35bc86902abbc008cf1c6940450c375c3.zip
Improvements for availability graph.
git-svn-id: svn://svn.zabbix.com/trunk@478 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/config.inc.php39
1 files changed, 34 insertions, 5 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 8aeed420..1088e113 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -3347,9 +3347,21 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return $stat;
}
- function calculate_availability($triggerid)
+ // If $period_start=$period_end=0, then take maximum period
+ function calculate_availability($triggerid,$period_start,$period_end)
{
- $result=DBselect("select count(*),min(clock),max(clock) from alarms where triggerid=$triggerid");
+ if(($period_start==0)&&($period_end==0))
+ {
+ $sql="select count(*),min(clock),max(clock) from alarms where triggerid=$triggerid";
+ }
+ else
+ {
+ $sql="select count(*),min(clock),max(clock) from alarms where triggerid=$triggerid and clock>=$period_start and clock<=$period_end";
+ }
+// echo $sql,"<br>";
+
+
+ $result=DBselect($sql);
if(DBget_field($result,0,0)>0)
{
$min=DBget_field($result,0,1);
@@ -3357,11 +3369,25 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
}
else
{
- $max=time();
- $min=$max-24*3600;
+ if(($period_start==0)&&($period_end==0))
+ {
+ $max=time();
+ $min=$max-24*3600;
+ }
+ else
+ {
+ $ret["true_time"]=0;
+ $ret["false_time"]=0;
+ $ret["unknown_time"]=0;
+ $ret["true"]=0;
+ $ret["false"]=0;
+ $ret["unknown"]=100;
+ return $ret;
+ }
}
$sql="select clock,value from alarms where triggerid=$triggerid and clock>=$min and clock<=$max";
+// echo " $sql<br>";
$result=DBselect($sql);
// echo $sql,"<br>";
@@ -3372,7 +3398,10 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$false_time=0;
$unknown_time=0;
$time=$min;
- $max=time();
+ if(($period_start==0)&&($period_end==0))
+ {
+ $max=time();
+ }
for($i=0;$i<DBnum_rows($result);$i++)
{
$clock=DBget_field($result,$i,0);