2011-06-13 Sergio Martin <sergio.martin@artica.es>

* include/functions_graph.php
	include/graphs/functions_pchart.php
	include/graphs/functions_gd.php
	include/graphs/fgraph.php
	include/graphs/functions_utils.php
	include/functions_reporting.php
	include/functions_visual_map.php
	include/ajax/visual_console_builder.ajax.php
	include/config_process.php
	include/include_graph_dependencies.php
	operation/agentes/stat_win.php
	operation/reporting/reporting_xml.php: Fixed missed parameters
	in sparse graph functions.
	Fixed graph includes and bugs



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4432 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2011-06-13 11:12:32 +00:00
parent 8830ccdaf3
commit 718aaa5508
13 changed files with 61 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2011-06-13 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php
include/graphs/functions_pchart.php
include/graphs/functions_gd.php
include/graphs/fgraph.php
include/graphs/functions_utils.php
include/functions_reporting.php
include/functions_visual_map.php
include/ajax/visual_console_builder.ajax.php
include/config_process.php
include/include_graph_dependencies.php
operation/agentes/stat_win.php
operation/reporting/reporting_xml.php: Fixed missed parameters
in sparse graph functions.
Fixed graph includes and bugs
2011-06-10 Ramon Novoa <rnovoa@artica.es> 2011-06-10 Ramon Novoa <rnovoa@artica.es>
* include/functions_api.php, pandoradb.sql, * include/functions_api.php, pandoradb.sql,

View File

@ -69,7 +69,7 @@ switch ($action) {
break; break;
case 'get_image_sparse': case 'get_image_sparse':
$img = grafico_modulo_sparse2($id_agent_module, $img = grafico_modulo_sparse2($id_agent_module,
$period, false, $width, $height, '', null, false, 0, false, 0, 0, 0, $period, false, $width, $height, '', null, false, 0, false, 0, '', 0, 0,
true, true); true, true);
preg_match("/src='(.*)'/", $img, $matches); preg_match("/src='(.*)'/", $img, $matches);
@ -334,4 +334,4 @@ if ($get_image_path_status){
echo json_encode($result); echo json_encode($result);
} }
?> ?>

View File

@ -157,6 +157,6 @@ db_connect();
require_once("include_graph_dependencies.php"); require_once("include_graph_dependencies.php");
//require_once("include/fgraph.php"); //require_once("include/fgraph.php");
include_graphs_dependencies(); include_graphs_dependencies($config['homedir'].'/');
?> ?>

View File

@ -28,7 +28,7 @@ define("GRAPH_STACKED_LINE", 3);
function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
$width, $height , $title = '', $unit_name = null, $width, $height , $title = '', $unit_name = null,
$show_alerts = false, $avg_only = 0, $pure = false, $show_alerts = false, $avg_only = 0, $pure = false,
$date = 0, $unit, $baseline = 0, $return_data = 0, $show_title = true, $date = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true,
$only_image = false, $homeurl = '') { $only_image = false, $homeurl = '') {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -795,6 +795,10 @@ function progress_bar2($progress, $width, $height, $title = '', $mode = 1) {
$out_of_lim_str = __("Out of limits"); $out_of_lim_str = __("Out of limits");
$title = ""; $title = "";
require_once("include_graph_dependencies.php");
include_graphs_dependencies("/var/www/pandora/");
return "<img title='" . $title . "' alt='" . $title . "' src='include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&width=".$width."&height=".$height."&progress=".$progress. return "<img title='" . $title . "' alt='" . $title . "' src='include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str."&title=".$title."&font=".$config['fontpath']."' />"; "&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str."&title=".$title."&font=".$config['fontpath']."' />";
} }

View File

@ -2053,7 +2053,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[0] = grafico_modulo_sparse2($content['id_agent_module'], $content['period'], $data[0] = grafico_modulo_sparse2($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], 0, 0, true, true); $report["datetime"], '', 0, 0, true, true);
array_push ($table->data, $data); array_push ($table->data, $data);
@ -2079,7 +2079,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array (); $data = array ();
$data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'], $data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], true, 0, true, true); $report["datetime"], '', true, 0, true, true);
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;

View File

@ -123,7 +123,7 @@ function visual_map_print_item($layoutData) {
break; break;
case MODULE_GRAPH: case MODULE_GRAPH:
$img = grafico_modulo_sparse2($id_module, $period, 0, $width, $img = grafico_modulo_sparse2($id_module, $period, 0, $width,
$height, '', null, false, 0, false, 0, 0, 0, true, true); $height, '', null, false, 0, false, 0, '', 0, 0, true, true);
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img); $img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
echo '<div id="' . $id . '" class="item module_graph" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">'; echo '<div id="' . $id . '" class="item module_graph" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
@ -794,12 +794,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'], echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'],
false, ((integer)($proportion * $layout_data['width'])), ((integer)($proportion * $layout_data['height'])), false, ((integer)($proportion * $layout_data['width'])), ((integer)($proportion * $layout_data['height'])),
'', null, false, 0, false, 0, 0, 0, true, true); '', null, false, 0, false, 0, '', 0, 0, true, true);
} }
else { else {
echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'], echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'],
false, $layout_data['width'], $layout_data['height'], false, $layout_data['width'], $layout_data['height'],
'', null, false, 0, false, 0, 0, 0, true, true); '', null, false, 0, false, 0, '', 0, 0, true, true);
} }
echo "</a>"; echo "</a>";
echo "</div>"; echo "</div>";

View File

@ -47,7 +47,6 @@ include_once('functions_fsgraph.php');
include_once('functions_utils.php'); include_once('functions_utils.php');
*/ */
if (isset($_GET['homeurl'])) { if (isset($_GET['homeurl'])) {
$homeurl = $_GET['homeurl']; $homeurl = $_GET['homeurl'];
} }

View File

@ -21,14 +21,15 @@ if(file_exists('include/functions.php')) {
else if(file_exists('../functions.php')) { else if(file_exists('../functions.php')) {
include_once('../functions.php'); include_once('../functions.php');
include_once('../functions_html.php'); include_once('../functions_html.php');
include_once('../functions_html.php');
include_once('functions_utils.php'); include_once('functions_utils.php');
} }
$types = array('histogram', 'progressbar');
$id_graph = get_parameter('id_graph', false); $id_graph = get_parameter('id_graph', false);
$graph_type = get_parameter('graph_type', '');
if($id_graph) { if($id_graph && in_array($graph_type, $types)) {
if (!$id_graph) { if (!$id_graph) {
exit; exit;
@ -44,8 +45,6 @@ if($id_graph) {
$graph['fontsize'] = 6; $graph['fontsize'] = 6;
} }
$graph_type = get_parameter('graph_type', '');
switch($graph_type) { switch($graph_type) {
case 'histogram': case 'histogram':
gd_histogram ($graph['width'], gd_histogram ($graph['width'],

View File

@ -12,6 +12,7 @@
// GNU General Public License for more details. // GNU General Public License for more details.
include_once('functions_utils.php'); include_once('functions_utils.php');
include_once('../functions_io.php');
include_once('../functions.php'); include_once('../functions.php');
include_once('../functions_html.php'); include_once('../functions_html.php');
@ -48,7 +49,6 @@ $graph_type = get_parameter('graph_type', '');
$id_graph = get_parameter('id_graph', false); $id_graph = get_parameter('id_graph', false);
if (!$id_graph) { if (!$id_graph) {
exit; exit;
} }

View File

@ -10,15 +10,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
function serialize_in_temp($array = array(), $serial_id = null) { function serialize_in_temp($array = array(), $serial_id = null, $ttl = 1) {
$json = json_encode($array); $json = json_encode($array);
if ($serial_id === null) { if ($serial_id === null) {
$serial_id = uniqid(); $serial_id = uniqid();
} }
$file_path = sys_get_temp_dir()."/pandora_serialize_".$serial_id; $file_path = sys_get_temp_dir()."/pandora_serialize_".$serial_id."__1__".$ttl;
if (file_put_contents($file_path, $json) === false) { if (file_put_contents($file_path, $json) === false) {
return false; return false;
} }
@ -26,12 +26,21 @@ function serialize_in_temp($array = array(), $serial_id = null) {
return $serial_id; return $serial_id;
} }
function unserialize_in_temp($serial_id = null, $delete = true) { function unserialize_in_temp($serial_id = null, $delete = true, $ttl = 1) {
if ($serial_id === null) { if ($serial_id === null) {
return false; return false;
} }
$file_path = sys_get_temp_dir()."/pandora_serialize_".$serial_id; $volume = -1;
for($i = 1 ; $i <= $ttl ; $i++) {
$file_path = sys_get_temp_dir()."/pandora_serialize_".$serial_id."__".$i."__".$ttl;
if(file_exists($file_path)) {
$volume = $i;
break;
}
}
$content = file_get_contents($file_path); $content = file_get_contents($file_path);
@ -42,7 +51,13 @@ function unserialize_in_temp($serial_id = null, $delete = true) {
$array = json_decode($content, true); $array = json_decode($content, true);
if ($delete) { if ($delete) {
unlink($file_path); if($volume == $ttl) {
unlink($file_path);
}
else {
$next_volume = $volume++;
rename($file_path, sys_get_temp_dir()."/pandora_serialize_".$serial_id."__".$next_volume."__".$ttl);
}
} }
return $array; return $array;

View File

@ -21,7 +21,7 @@
$ttl = $serialize_ttl; $ttl = $serialize_ttl;
$homeurl = $home_url; $homeurl = $home_url;
include_once($homeurl . 'include/functions_io.php');
include_once($homeurl . 'include/functions.php'); include_once($homeurl . 'include/functions.php');
include_once($homeurl . 'include/functions_html.php'); include_once($homeurl . 'include/functions_html.php');

View File

@ -153,7 +153,7 @@ switch ($graph_type) {
break; break;
case 'sparse': case 'sparse':
echo grafico_modulo_sparse2 ($id, $period, $draw_events, $width, $height, echo grafico_modulo_sparse2 ($id, $period, $draw_events, $width, $height,
$label, null, $draw_alerts, $avg_only, false, $date, $baseline, $label, null, $draw_alerts, $avg_only, false, $date, '', $baseline,
0, true, false, $urlImage); 0, true, false, $urlImage);
break; break;
case 'string': case 'string':

View File

@ -194,7 +194,7 @@ foreach ($contents as $content) {
$img = grafico_modulo_sparse2($content['id_agent_module'], $img = grafico_modulo_sparse2($content['id_agent_module'],
$content['period'], 0, 720, $content['period'], 0, 720,
230, '', null, false, true, false, $datetime, 0, 0, true, true); 230, '', null, false, true, false, $datetime, '', 0, 0, true, true);
preg_match("/src='(.*)'/", $img, $matches); preg_match("/src='(.*)'/", $img, $matches);
$url = $matches[1]; $url = $matches[1];
@ -207,7 +207,7 @@ foreach ($contents as $content) {
$img = grafico_modulo_sparse2($content['id_agent_module'], $img = grafico_modulo_sparse2($content['id_agent_module'],
$content['period'], 0, 720, $content['period'], 0, 720,
230, '', null, false, true, false, ($datetime + $content['period']), true, 0, true, true); 230, '', null, false, true, false, ($datetime + $content['period']), '', true, 0, true, true);
preg_match("/src='(.*)'/", $img, $matches); preg_match("/src='(.*)'/", $img, $matches);
$url = $matches[1]; $url = $matches[1];