summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/classes/graph.inc.php8
-rw-r--r--frontends/php/include/defines.inc.php4
-rw-r--r--frontends/php/include/httptest.inc.php15
3 files changed, 20 insertions, 7 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index 845be289..14d255fa 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -239,7 +239,7 @@
function ShowTriggers($value)
{
- $this->m_showTriggers = $value == 1 ? 1 : 0;;
+ $this->m_showTriggers = $value == 1 ? 1 : 0;
}
function AddItem($itemid, $axis=GRAPH_YAXIS_SIDE_RIGHT, $calc_fnc=CALC_FNC_AVG,
@@ -306,6 +306,7 @@
{
// Avoid sizeX==0, to prevent division by zero later
if($value <= 0) $value = NULL;
+ if($value > 1300) $value = 1300;
if(is_null($value)) $value = 900;
$this->sizeX = $value;
@@ -1218,7 +1219,7 @@
$this->fullSizeX = $this->sizeX+$this->shiftXleft+$this->shiftXright+1;
$this->fullSizeY = $this->sizeY+$this->shiftY+62+12*($this->num+ (($this->sizeY < 120) ? 0 : count($this->triggers)))+8;
-
+
if(function_exists("ImageColorExactAlpha")&&function_exists("ImageCreateTrueColor")&&@imagecreatetruecolor(1,1))
$this->im = ImageCreateTrueColor($this->fullSizeX,$this->fullSizeY);
else
@@ -1324,8 +1325,9 @@
$str=sprintf("%0.2f",($end_time-$start_time));
ImageString($this->im, 0,$this->fullSizeX-120,$this->fullSizeY-12,"Generated in $str sec", $this->GetColor("Gray"));
+ unset($this->items, $this->data);
+
ImageOut($this->im);
- ImageDestroy($this->im);
}
}
?>
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 3ddd3850..87c02f65 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -334,6 +334,10 @@
define('HTTPTEST_STATUS_ACTIVE', 0);
define('HTTPTEST_STATUS_DISABLED', 1);
+ define('HTTPTEST_STATE_IDLE', 0);
+ define('HTTPTEST_STATE_BUSY', 1);
+ define('HTTPTEST_STATE_UNKNOWN',3);
+
define('HTTPSTEP_ITEM_TYPE_RSPCODE', 0);
define('HTTPSTEP_ITEM_TYPE_TIME', 1);
define('HTTPSTEP_ITEM_TYPE_IN', 2);
diff --git a/frontends/php/include/httptest.inc.php b/frontends/php/include/httptest.inc.php
index 409d992a..2c03a4cf 100644
--- a/frontends/php/include/httptest.inc.php
+++ b/frontends/php/include/httptest.inc.php
@@ -47,6 +47,12 @@
function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $status_codes, $delay, $history, $trends)
{
+ if( $no <= 0 )
+ {
+ error('Scenario step number can\'t be less then 1');
+ return false;
+ }
+
if (!eregi('^([0-9a-zA-Z\_\.[.-.]\$ ]+)$', $name))
{
error("Scenario step name should contain '0-9a-zA-Z_ .$'- characters only");
@@ -175,7 +181,8 @@
{
$result = DBexecute('update httptest set '.
' applicationid='.$applicationid.', name='.zbx_dbstr($name).', delay='.$delay.','.
- ' status='.$status.', agent='.zbx_dbstr($agent).', macros='.zbx_dbstr($macros).
+ ' status='.$status.', agent='.zbx_dbstr($agent).', macros='.zbx_dbstr($macros).','.
+ ' error='.zbx_dbstr('').', curstate='.HTTPTEST_STATE_UNKNOWN.
' where httptestid='.$httptestid);
}
else
@@ -190,9 +197,9 @@
}
$result = DBexecute('insert into httptest'.
- ' (httptestid, applicationid, name, delay, status, agent, macros) '.
+ ' (httptestid, applicationid, name, delay, status, agent, macros, curstate) '.
' values ('.$httptestid.','.$applicationid.','.zbx_dbstr($name).','.
- $delay.','.$status.','.zbx_dbstr($agent).','.zbx_dbstr($macros).')'
+ $delay.','.$status.','.zbx_dbstr($agent).','.zbx_dbstr($macros).','.HTTPTEST_STATE_UNKNOWN.')'
);
$test_added = true;
@@ -211,7 +218,7 @@
if(!isset($s['status_codes'])) $s['status_codes'] = '';
$result = db_save_step($hostid, $applicationid, $httptestid,
- $name, $s['name'], $sid, $s['timeout'], $s['url'], $s['posts'], $s['required'],$s['status_codes'],
+ $name, $s['name'], $sid+1, $s['timeout'], $s['url'], $s['posts'], $s['required'],$s['status_codes'],
$delay, $history, $trends);
if(!$result) break;