2010-10-22 Ramon Novoa <rnovoa@artica.es>
* include/styles/pandora_minimal.css, include/fgraph.php, include/functions_fsgraph.php, operation/agentes/stat_win.php: Added support for chart baseline (Enterprise). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3453 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b6f5e9996c
commit
d70abfb645
|
@ -1,3 +1,9 @@
|
||||||
|
2010-10-22 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/styles/pandora_minimal.css, include/fgraph.php,
|
||||||
|
include/functions_fsgraph.php, operation/agentes/stat_win.php: Added
|
||||||
|
support for chart baseline (Enterprise).
|
||||||
|
|
||||||
2010-10-22 Raúl Mateos <raulofpandora@gmail.com>
|
2010-10-22 Raúl Mateos <raulofpandora@gmail.com>
|
||||||
|
|
||||||
* godmode/db/db_refine.php, godmode/agentes/manage_config_remote.php,
|
* godmode/db/db_refine.php, godmode/agentes/manage_config_remote.php,
|
||||||
|
|
|
@ -38,8 +38,7 @@ else {
|
||||||
require_once ($config['homedir'].'/include/functions_reporting.php');
|
require_once ($config['homedir'].'/include/functions_reporting.php');
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
}
|
}
|
||||||
|
enterprise_include ('include/functions_reporting.php');
|
||||||
|
|
||||||
|
|
||||||
set_time_limit (0);
|
set_time_limit (0);
|
||||||
//error_reporting (0);
|
//error_reporting (0);
|
||||||
|
@ -1311,7 +1310,7 @@ function progress_bar ($progress, $width, $height, $mode = 1) {
|
||||||
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
$width, $height , $title, $unit_name,
|
$width, $height , $title, $unit_name,
|
||||||
$show_alerts, $avg_only = 0, $pure = false,
|
$show_alerts, $avg_only = 0, $pure = false,
|
||||||
$date = 0) {
|
$date = 0, $baseline = 0, $return_data = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
@ -1405,6 +1404,15 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get baseline data
|
||||||
|
$baseline_data = array ();
|
||||||
|
if ($baseline == 1) {
|
||||||
|
$baseline_data = enterprise_hook ('enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date));
|
||||||
|
if ($baseline_data === ENTERPRISE_NOT_HOOK) {
|
||||||
|
$baseline_data = array ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate chart data
|
// Calculate chart data
|
||||||
for ($i = 0; $i < $resolution; $i++) {
|
for ($i = 0; $i < $resolution; $i++) {
|
||||||
$timestamp = $datelimit + ($interval * $i);
|
$timestamp = $datelimit + ($interval * $i);
|
||||||
|
@ -1475,6 +1483,15 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
||||||
$chart[$timestamp]['event'] = $event_value;
|
$chart[$timestamp]['event'] = $event_value;
|
||||||
$chart[$timestamp]['alert'] = $alert_value;
|
$chart[$timestamp]['alert'] = $alert_value;
|
||||||
|
$chart[$timestamp]['baseline'] = array_shift ($baseline_data);
|
||||||
|
if ($chart[$timestamp]['baseline'] == NULL) {
|
||||||
|
$baseline = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return chart data and don't draw
|
||||||
|
if ($return_data == 1) {
|
||||||
|
return $chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get min, max and avg (less efficient but centralized for all modules and reports)
|
// Get min, max and avg (less efficient but centralized for all modules and reports)
|
||||||
|
@ -1518,7 +1535,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
// Flash chart
|
// Flash chart
|
||||||
$caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value;
|
$caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value;
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption);
|
return fs_module_chart ($chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
$engine = get_graph_engine ($period);
|
$engine = get_graph_engine ($period);
|
||||||
|
@ -2734,12 +2751,13 @@ $graphic_type = (string) get_parameter ('tipo');
|
||||||
$mode = get_parameter ("mode", 1);
|
$mode = get_parameter ("mode", 1);
|
||||||
$url = get_parameter ("url");
|
$url = get_parameter ("url");
|
||||||
$report_id = (int) get_parameter ("report_id", 0);
|
$report_id = (int) get_parameter ("report_id", 0);
|
||||||
|
$baseline = (int) get_parameter ('baseline', 0);
|
||||||
|
|
||||||
if ($graphic_type) {
|
if ($graphic_type) {
|
||||||
switch ($graphic_type) {
|
switch ($graphic_type) {
|
||||||
case 'sparse':
|
case 'sparse':
|
||||||
grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
||||||
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline);
|
||||||
break;
|
break;
|
||||||
case 'sparse_mobile':
|
case 'sparse_mobile':
|
||||||
grafico_modulo_sparse_mobile ($id, $period, $draw_events, $width, $height,
|
grafico_modulo_sparse_mobile ($id, $period, $draw_events, $width, $height,
|
||||||
|
|
|
@ -131,7 +131,7 @@ function fs_2d_area_chart ($data, $width, $height, $step = 1, $params = '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a Pandora FMS module chart
|
// Returns a Pandora FMS module chart
|
||||||
function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $time_format = 'G:i', $show_events = 0, $show_alerts = 0, $caption = '') {
|
function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $time_format = 'G:i', $show_events = 0, $show_alerts = 0, $caption = '', $baseline = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$graph_type = "MSArea2D"; //MSLine is possible also
|
$graph_type = "MSArea2D"; //MSLine is possible also
|
||||||
|
@ -223,6 +223,14 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Baseline chart
|
||||||
|
if ($baseline == 1) {
|
||||||
|
$chart->addDataSet(__('Baseline'), 'color=0097BD;alpha=10;showAreaBorder=0;');
|
||||||
|
foreach ($data as $value) {
|
||||||
|
$chart->addChartData($value['baseline']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
|
||||||
|
|
||||||
$random_number = rand ();
|
$random_number = rand ();
|
||||||
|
|
|
@ -87,7 +87,7 @@ table, img {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
margin:0;
|
margin:0;
|
||||||
width:400px;
|
width:400px;
|
||||||
height:240px;
|
height:260px;
|
||||||
visibility:hidden;
|
visibility:hidden;
|
||||||
filter:alpha(opacity=90);
|
filter:alpha(opacity=90);
|
||||||
-moz-opacity: 0.90;
|
-moz-opacity: 0.90;
|
||||||
|
|
|
@ -117,6 +117,7 @@ $start_date = get_parameter ("start_date", date("Y-m-d"));
|
||||||
$draw_events = get_parameter ("draw_events", 0);
|
$draw_events = get_parameter ("draw_events", 0);
|
||||||
$graph_type = get_parameter ("type", "sparse");
|
$graph_type = get_parameter ("type", "sparse");
|
||||||
$zoom = get_parameter ("zoom", 1);
|
$zoom = get_parameter ("zoom", 1);
|
||||||
|
$baseline = get_parameter ("baseline", 0);
|
||||||
|
|
||||||
if ($zoom > 1) {
|
if ($zoom > 1) {
|
||||||
$height = $height * ($zoom / 2.1);
|
$height = $height * ($zoom / 2.1);
|
||||||
|
@ -138,7 +139,7 @@ else
|
||||||
if ($config['flash_charts'] && $graph_type != "log4x") {
|
if ($config['flash_charts'] && $graph_type != "log4x") {
|
||||||
switch ($graph_type) {
|
switch ($graph_type) {
|
||||||
case 'sparse': echo grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
case 'sparse': echo grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
||||||
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline);
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height,
|
echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height,
|
||||||
|
@ -156,7 +157,7 @@ if ($config['flash_charts'] && $graph_type != "log4x") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$image = "../../include/fgraph.php?tipo=".$graph_type."&draw_alerts=".$draw_alerts."&draw_events=".$draw_events."&id=".$id."&zoom=".$zoom."&label=".$label."&height=".$height."&width=".$width."&period=".$period."&avg_only=".$avg_only;
|
$image = "../../include/fgraph.php?tipo=".$graph_type."&draw_alerts=".$draw_alerts."&draw_events=".$draw_events."&id=".$id."&zoom=".$zoom."&label=".$label."&height=".$height."&width=".$width."&period=".$period."&avg_only=".$avg_only."&baseline=".$baseline;
|
||||||
|
|
||||||
$image .= "&date=" . $date;
|
$image .= "&date=" . $date;
|
||||||
|
|
||||||
|
@ -227,6 +228,10 @@ echo '</td></tr><tr><td>'.__('Show alerts').'</td><td>';
|
||||||
|
|
||||||
print_checkbox ("draw_alerts", 1, (bool) $draw_alerts);
|
print_checkbox ("draw_alerts", 1, (bool) $draw_alerts);
|
||||||
|
|
||||||
|
echo '</td></tr><tr><td>'.__('Draw baseline').'</td><td>';
|
||||||
|
|
||||||
|
print_checkbox ("baseline", 1, (bool) $baseline);
|
||||||
|
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
|
|
||||||
print_submit_button ('GO', "submit", false, 'class="sub next"');
|
print_submit_button ('GO', "submit", false, 'class="sub next"');
|
||||||
|
|
Loading…
Reference in New Issue