mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
fixed errors in graph add phantom js
This commit is contained in:
parent
16dca6860f
commit
02a442a8db
@ -22,7 +22,7 @@ $get_graphs = (bool)get_parameter('get_graphs_container');
|
|||||||
|
|
||||||
if ($save_custom_graph) {
|
if ($save_custom_graph) {
|
||||||
$return = array();
|
$return = array();
|
||||||
|
|
||||||
$id_modules = (array)get_parameter('id_modules', array());
|
$id_modules = (array)get_parameter('id_modules', array());
|
||||||
$name = get_parameter('name', '');
|
$name = get_parameter('name', '');
|
||||||
$description = get_parameter('description', '');
|
$description = get_parameter('description', '');
|
||||||
@ -32,20 +32,19 @@ if ($save_custom_graph) {
|
|||||||
$events = get_parameter('events', 0);
|
$events = get_parameter('events', 0);
|
||||||
$period = get_parameter('period', 0);
|
$period = get_parameter('period', 0);
|
||||||
$fullscale = get_parameter('fullscale', 0);
|
$fullscale = get_parameter('fullscale', 0);
|
||||||
|
|
||||||
$result = (bool)custom_graphs_create($id_modules, $name,
|
$result = (bool)custom_graphs_create($id_modules, $name,
|
||||||
$description, $stacked, $width, $height, $events, $period, 0, 0, false, $fullscale);
|
$description, $stacked, $width, $height, $events, $period, 0, 0, false, $fullscale);
|
||||||
|
|
||||||
|
|
||||||
$return['correct'] = $result;
|
$return['correct'] = $result;
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($print_custom_graph) {
|
if ($print_custom_graph) {
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
|
||||||
$id_graph = (int) get_parameter('id_graph');
|
$id_graph = (int) get_parameter('id_graph');
|
||||||
$height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT);
|
$height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT);
|
||||||
$width = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
|
$width = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
|
||||||
@ -76,43 +75,41 @@ if ($print_custom_graph) {
|
|||||||
|
|
||||||
if ($print_sparse_graph) {
|
if ($print_sparse_graph) {
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
$params =array(
|
||||||
$agent_module_id = (int) get_parameter('agent_module_id');
|
'agent_module_id' => (int)get_parameter('agent_module_id'),
|
||||||
$period = (int) get_parameter('period', SECONDS_5MINUTES);
|
'period' => (int) get_parameter('period', SECONDS_5MINUTES),
|
||||||
$show_events = (bool) get_parameter('show_events');
|
'show_events' => (bool) get_parameter('show_events'),
|
||||||
$width = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
|
'title' => (string) get_parameter('title'),
|
||||||
$height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT);
|
'unit_name' => (string) get_parameter('unit_name'),
|
||||||
$title = (string) get_parameter('title');
|
'show_alerts' => (bool) get_parameter('show_alerts'),
|
||||||
$unit_name = (string) get_parameter('unit_name');
|
'avg_only' => (int) get_parameter('avg_only'),
|
||||||
$show_alerts = (bool) get_parameter('show_alerts');
|
'pure' => (bool) get_parameter('pure'),
|
||||||
$avg_only = (int) get_parameter('avg_only');
|
'date' => (int) get_parameter('date', time()),
|
||||||
$pure = (bool) get_parameter('pure');
|
'unit' => (string) get_parameter('unit'),
|
||||||
$date = (int) get_parameter('date', time());
|
'baseline' => (int) get_parameter('baseline'),
|
||||||
$unit = (string) get_parameter('unit');
|
'return_data' => (int) get_parameter('return_data'),
|
||||||
$baseline = (int) get_parameter('baseline');
|
'show_title' => (bool) get_parameter('show_title', true),
|
||||||
$return_data = (int) get_parameter('return_data');
|
'only_image' => (bool) get_parameter('only_image'),
|
||||||
$show_title = (bool) get_parameter('show_title', true);
|
'homeurl' => (string) get_parameter('homeurl'),
|
||||||
$only_image = (bool) get_parameter('only_image');
|
'ttl' => (int) get_parameter('ttl', 1),
|
||||||
$homeurl = (string) get_parameter('homeurl');
|
'projection' => (bool) get_parameter('projection'),
|
||||||
$ttl = (int) get_parameter('ttl', 1);
|
'adapt_key' => (string) get_parameter('adapt_key'),
|
||||||
$projection = (bool) get_parameter('projection');
|
'compare' => (bool) get_parameter('compare'),
|
||||||
$adapt_key = (string) get_parameter('adapt_key');
|
'show_unknown' => (bool) get_parameter('show_unknown'),
|
||||||
$compare = (bool) get_parameter('compare');
|
'menu' => (bool) get_parameter('menu', true),
|
||||||
$show_unknown = (bool) get_parameter('show_unknown');
|
'backgroundColor' => (string) get_parameter('background_color', 'white'),
|
||||||
$menu = (bool) get_parameter('menu', true);
|
'percentil' => get_parameter('percentil', null),
|
||||||
$background_color = (string) get_parameter('background_color', 'white');
|
'dashboard' => (bool) get_parameter('dashboard'),
|
||||||
$percentil = get_parameter('percentil', null);
|
'vconsole' => (bool) get_parameter('vconsole'),
|
||||||
$dashboard = (bool) get_parameter('dashboard');
|
'type_graph' => get_parameter('type_g', $config['type_module_charts']),
|
||||||
$vconsole = (bool) get_parameter('vconsole');
|
'fullscale' => get_parameter('fullscale', 0),
|
||||||
$type_g = get_parameter('type_g', $config['type_module_charts']);
|
'id_widget_dashboard' => false,
|
||||||
$fullscale = get_parameter('fullscale', 0);
|
'force_interval' => '',
|
||||||
|
'time_interval' => 300,
|
||||||
echo grafico_modulo_sparse($agent_module_id, $period, $show_events,
|
'array_data_create' => 0
|
||||||
$width, $height , $title, $unit_name, $show_alerts, $avg_only,
|
);
|
||||||
$pure, $date, $unit, $baseline, $return_data, $show_title,
|
|
||||||
$only_image, $homeurl, $ttl, $projection, $adapt_key, $compare,
|
echo grafico_modulo_sparse($params);
|
||||||
$show_unknown, $menu, $backgroundColor, $percentil,
|
|
||||||
$dashboard, $vconsole, $type_g, $fullscale);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +121,7 @@ if ($get_graphs){
|
|||||||
if (!empty($result_items)){
|
if (!empty($result_items)){
|
||||||
$hash = get_parameter('hash',0);
|
$hash = get_parameter('hash',0);
|
||||||
$period = get_parameter('time',0);
|
$period = get_parameter('time',0);
|
||||||
|
|
||||||
$periods = array ();
|
$periods = array ();
|
||||||
$periods[1] = __('none');
|
$periods[1] = __('none');
|
||||||
$periods[SECONDS_1HOUR] = __('1 hour');
|
$periods[SECONDS_1HOUR] = __('1 hour');
|
||||||
@ -137,7 +134,7 @@ if ($get_graphs){
|
|||||||
$periods[SECONDS_1WEEK] = __('1 week');
|
$periods[SECONDS_1WEEK] = __('1 week');
|
||||||
$periods[SECONDS_15DAYS] = __('15 days');
|
$periods[SECONDS_15DAYS] = __('15 days');
|
||||||
$periods[SECONDS_1MONTH] = __('1 month');
|
$periods[SECONDS_1MONTH] = __('1 month');
|
||||||
|
|
||||||
$table = '';
|
$table = '';
|
||||||
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
||||||
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
||||||
@ -151,7 +148,7 @@ if ($get_graphs){
|
|||||||
$single_table .= "</td>";
|
$single_table .= "</td>";
|
||||||
$single_table .= "</tr>";
|
$single_table .= "</tr>";
|
||||||
$single_table .= "</table>";
|
$single_table .= "</table>";
|
||||||
|
|
||||||
$table .= $single_table;
|
$table .= $single_table;
|
||||||
$contador = $config['max_graph_container'];
|
$contador = $config['max_graph_container'];
|
||||||
foreach ($result_items as $key => $value) {
|
foreach ($result_items as $key => $value) {
|
||||||
@ -159,9 +156,9 @@ if ($get_graphs){
|
|||||||
if($period > 1){
|
if($period > 1){
|
||||||
$value['time_lapse'] = $period;
|
$value['time_lapse'] = $period;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_graph = ($value['type_graph'])? "line" : "area";
|
$type_graph = ($value['type_graph'])? "line" : "area";
|
||||||
|
|
||||||
switch ($value['type']) {
|
switch ($value['type']) {
|
||||||
case 'simple_graph':
|
case 'simple_graph':
|
||||||
if ($contador > 0) {
|
if ($contador > 0) {
|
||||||
@ -170,36 +167,17 @@ if ($get_graphs){
|
|||||||
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente
|
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente
|
||||||
WHERE id_agente = ". $sql_modulo[0]['id_agente']);
|
WHERE id_agente = ". $sql_modulo[0]['id_agente']);
|
||||||
$table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>";
|
$table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>";
|
||||||
$table .= grafico_modulo_sparse(
|
|
||||||
$value['id_agent_module'],
|
$params =array(
|
||||||
$value['time_lapse'],
|
'agent_module_id' => $value['id_agent_module'],
|
||||||
0,
|
'period' => $value['time_lapse'],
|
||||||
1000,
|
'avg_only' => $value['only_average'],
|
||||||
300,
|
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||||
'',
|
'type_graph' => $type_graph,
|
||||||
'',
|
'fullscale' => $value['fullscale']
|
||||||
false,
|
);
|
||||||
$value['only_average'],
|
|
||||||
false,
|
$table .= grafico_modulo_sparse($params);
|
||||||
0,
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
1,
|
|
||||||
'white',
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$type_graph,
|
|
||||||
$value['fullscale']);
|
|
||||||
$contador --;
|
$contador --;
|
||||||
}
|
}
|
||||||
// $table .= "</br>";
|
// $table .= "</br>";
|
||||||
@ -207,7 +185,7 @@ if ($get_graphs){
|
|||||||
case 'custom_graph':
|
case 'custom_graph':
|
||||||
if ($contador > 0) {
|
if ($contador > 0) {
|
||||||
$graph = db_get_all_rows_field_filter('tgraph', 'id_graph',$value['id_graph']);
|
$graph = db_get_all_rows_field_filter('tgraph', 'id_graph',$value['id_graph']);
|
||||||
|
|
||||||
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',$value['id_graph']);
|
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',$value['id_graph']);
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
$weights = array ();
|
$weights = array ();
|
||||||
@ -222,7 +200,7 @@ if ($get_graphs){
|
|||||||
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
|
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$homeurl = ui_get_full_url(false, false, false, false);
|
$homeurl = ui_get_full_url(false, false, false, false);
|
||||||
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
|
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
|
||||||
|
|
||||||
@ -280,13 +258,13 @@ if ($get_graphs){
|
|||||||
} else {
|
} else {
|
||||||
$id_group = " AND id_grupo = ".$value['id_group'];
|
$id_group = " AND id_grupo = ".$value['id_group'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($value['id_module_group'] === '0'){
|
if($value['id_module_group'] === '0'){
|
||||||
$id_module_group = "";
|
$id_module_group = "";
|
||||||
} else {
|
} else {
|
||||||
$id_module_group = " AND id_module_group = ".$value['id_module_group'];
|
$id_module_group = " AND id_module_group = ".$value['id_module_group'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($value['id_tag'] === '0'){
|
if($value['id_tag'] === '0'){
|
||||||
$tag = "";
|
$tag = "";
|
||||||
$id_tag = "";
|
$id_tag = "";
|
||||||
@ -294,7 +272,7 @@ if ($get_graphs){
|
|||||||
$tag = " INNER JOIN ttag_module ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo ";
|
$tag = " INNER JOIN ttag_module ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo ";
|
||||||
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
|
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($value['module'] != ''){
|
if($value['module'] != ''){
|
||||||
$module_name = " AND nombre REGEXP '".$value['module']."'";
|
$module_name = " AND nombre REGEXP '".$value['module']."'";
|
||||||
}
|
}
|
||||||
@ -303,47 +281,27 @@ if ($get_graphs){
|
|||||||
". $tag . "WHERE 1=1" . $id_module_group . $module_name .
|
". $tag . "WHERE 1=1" . $id_module_group . $module_name .
|
||||||
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
|
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
|
||||||
. $id_tag);
|
. $id_tag);
|
||||||
|
|
||||||
foreach ($id_agent_module as $key2 => $value2) {
|
foreach ($id_agent_module as $key2 => $value2) {
|
||||||
if ($contador > 0) {
|
if ($contador > 0) {
|
||||||
$sql_modulo2 = db_get_all_rows_sql("SELECT nombre, id_agente FROM
|
$sql_modulo2 = db_get_all_rows_sql("SELECT nombre, id_agente FROM
|
||||||
tagente_modulo WHERE id_agente_modulo = ". $value2['id_agente_modulo']);
|
tagente_modulo WHERE id_agente_modulo = ". $value2['id_agente_modulo']);
|
||||||
|
|
||||||
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
|
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
|
||||||
WHERE id_agente = ". $sql_modulo2[0]['id_agente']);
|
WHERE id_agente = ". $sql_modulo2[0]['id_agente']);
|
||||||
|
|
||||||
$table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>";
|
$table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>";
|
||||||
|
|
||||||
$table .= grafico_modulo_sparse(
|
$params =array(
|
||||||
$value2['id_agente_modulo'],
|
'agent_module_id' => $value2['id_agente_modulo'],
|
||||||
$value['time_lapse'],
|
'period' => $value['time_lapse'],
|
||||||
0,
|
'avg_only' => $value['only_average'],
|
||||||
1000,
|
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||||
300,
|
'type_graph' => $type_graph,
|
||||||
'',
|
'fullscale' => $value['fullscale']
|
||||||
'',
|
);
|
||||||
false,
|
|
||||||
$value['only_average'],
|
$table .= grafico_modulo_sparse($params);
|
||||||
false,
|
|
||||||
0,
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
1,
|
|
||||||
'white',
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$type_graph,
|
|
||||||
$value['fullscale']);
|
|
||||||
$contador --;
|
$contador --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +311,6 @@ if ($get_graphs){
|
|||||||
$table .= "</br>";
|
$table .= "</br>";
|
||||||
echo $table;
|
echo $table;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
108
pandora_console/include/chart_generator.php
Normal file
108
pandora_console/include/chart_generator.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
// Pandora FMS - http://pandorafms.com
|
||||||
|
// ==================================================
|
||||||
|
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||||
|
// Please see http://pandorafms.org for full contribution list
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation for version 2.
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
/*
|
||||||
|
if (! isset($_SESSION['id_usuario'])) {
|
||||||
|
session_start();
|
||||||
|
session_write_close();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Global & session manageme
|
||||||
|
require_once ('config.php');
|
||||||
|
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_db.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_reporting.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_graph.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
//check_login();
|
||||||
|
|
||||||
|
/*
|
||||||
|
$params_json = base64_decode((string) get_parameter('params'));
|
||||||
|
$params = json_decode($params_json, true);
|
||||||
|
|
||||||
|
// Metaconsole connection to the node
|
||||||
|
$server_id = (int) (isset($params['server']) ? $params['server'] : 0);
|
||||||
|
|
||||||
|
if ($config["metaconsole"] && !empty($server_id)) {
|
||||||
|
$server = metaconsole_get_connection_by_id($server_id);
|
||||||
|
|
||||||
|
// Error connecting
|
||||||
|
if (metaconsole_connect($server) !== NOERR) {
|
||||||
|
echo "<html>";
|
||||||
|
echo "<body>";
|
||||||
|
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||||
|
echo "</body>";
|
||||||
|
echo "</html>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$user_language = get_user_language($config['id_user']);
|
||||||
|
if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||||
|
$l10n = new gettext_reader (new CachedFileReader ('languages/'.$user_language.'.mo'));
|
||||||
|
$l10n->load_tables();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<!DOCTYPE>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
|
||||||
|
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="styles/jquery-ui-1.10.0.custom.css" type="text/css" />
|
||||||
|
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||||
|
<script language="javascript" type='text/javascript' src='javascript/jquery-1.9.0.js'></script>
|
||||||
|
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
|
||||||
|
<script language="javascript" type='text/javascript' src='javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.pie.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.crosshair.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.stack.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.selection.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.resize.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.threshold.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.threshold.multiple.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.symbol.min.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$params = json_decode($_GET['data'], true);
|
||||||
|
//XXXXXX
|
||||||
|
$params['only_image'] = false;
|
||||||
|
$params['width'] = '1048';
|
||||||
|
|
||||||
|
echo '<p> Grafica molona para ' . $params['agent_module_id'] . '</p>';
|
||||||
|
echo '<div>';
|
||||||
|
echo grafico_modulo_sparse ($params);
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3005,108 +3005,125 @@ function color_graph_array($series_suffix, $compare = false){
|
|||||||
|
|
||||||
function series_type_graph_array($data, $show_elements_graph){
|
function series_type_graph_array($data, $show_elements_graph){
|
||||||
global $config;
|
global $config;
|
||||||
foreach ($data as $key => $value) {
|
if(isset($data) && is_array($data)){
|
||||||
if(strpos($key, 'summatory') !== false){
|
foreach ($data as $key => $value) {
|
||||||
$data_return['series_type'][$key] = 'area';
|
if(strpos($key, 'summatory') !== false){
|
||||||
$data_return['legend'][$key] = __('Summatory series') . ' ' . $series_suffix_str;
|
$data_return['series_type'][$key] = 'area';
|
||||||
}
|
$data_return['legend'][$key] = __('Summatory series') . ' ' . $series_suffix_str;
|
||||||
elseif(strpos($key, 'average') !== false){
|
|
||||||
$data_return['series_type'][$key] = 'area';
|
|
||||||
$data_return['legend'][$key] = __('Average series') . ' ' . $series_suffix_str;
|
|
||||||
}
|
|
||||||
elseif(strpos($key, 'sum') !== false || strpos($key, 'baseline') !== false){
|
|
||||||
switch ($value['id_module_type']) {
|
|
||||||
case 21: case 2: case 6:
|
|
||||||
case 18: case 9: case 31:
|
|
||||||
$data_return['series_type'][$key] = 'boolean';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$data_return['series_type'][$key] = 'area';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
elseif(strpos($key, 'average') !== false){
|
||||||
|
$data_return['series_type'][$key] = 'area';
|
||||||
|
$data_return['legend'][$key] = __('Average series') . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
|
elseif(strpos($key, 'sum') !== false || strpos($key, 'baseline') !== false){
|
||||||
|
switch ($value['id_module_type']) {
|
||||||
|
case 21: case 2: case 6:
|
||||||
|
case 18: case 9: case 31:
|
||||||
|
$data_return['series_type'][$key] = 'boolean';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$data_return['series_type'][$key] = 'area';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($show_elements_graph['labels']) &&
|
if (isset($show_elements_graph['labels']) &&
|
||||||
is_array($show_elements_graph['labels']) &&
|
is_array($show_elements_graph['labels']) &&
|
||||||
(count($show_elements_graph['labels']) > 0)){
|
(count($show_elements_graph['labels']) > 0)){
|
||||||
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['id_module_type']] . ' ' ;
|
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['id_module_type']] . ' ' ;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(strpos($key, 'baseline') !== false){
|
||||||
|
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
|
||||||
|
$value['module_name'] . ' Baseline ';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
|
||||||
|
$value['module_name'] . ': ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strpos($key, 'baseline') === false){
|
||||||
|
$data_return['legend'][$key] .=
|
||||||
|
__('Min:') . remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$value['min'],
|
||||||
|
$config['graph_precision']
|
||||||
|
)
|
||||||
|
) . ' ' .
|
||||||
|
__('Max:') . remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$value['max'],
|
||||||
|
$config['graph_precision']
|
||||||
|
)
|
||||||
|
) . ' ' .
|
||||||
|
_('Avg:') . remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$value['avg'],
|
||||||
|
$config['graph_precision']
|
||||||
|
)
|
||||||
|
) . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(strpos($key, 'event') !== false){
|
||||||
|
$data_return['series_type'][$key] = 'points';
|
||||||
|
if($show_elements_graph['show_events']){
|
||||||
|
$data_return['legend'][$key] = __('Events') . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(strpos($key, 'alert') !== false){
|
||||||
|
$data_return['series_type'][$key] = 'points';
|
||||||
|
if($show_elements_graph['show_alerts']){
|
||||||
|
$data_return['legend'][$key] = __('Alert') . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(strpos($key, 'unknown') !== false){
|
||||||
|
$data_return['series_type'][$key] = 'unknown';
|
||||||
|
if($show_elements_graph['show_unknown']){
|
||||||
|
$data_return['legend'][$key] = __('Unknown') . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(strpos($key, 'percentil') !== false){
|
||||||
|
$data_return['series_type'][$key] = 'percentil';
|
||||||
|
if($show_elements_graph['percentil']){
|
||||||
|
$data_return['legend'][$key] =
|
||||||
|
__('Percentil') . ' ' .
|
||||||
|
$config['percentil'] .
|
||||||
|
'º ' . __('of module') . ' ';
|
||||||
|
if (isset($show_elements_graph['labels']) && is_array($show_elements_graph['labels'])){
|
||||||
|
$data_return['legend'][$key] .= $show_elements_graph['labels'][$value['id_module_type']] . ' ' ;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data_return['legend'][$key] .= $value['agent_name'] . ' / ' .
|
||||||
|
$value['module_name'] . ': ' . ' Value: ';
|
||||||
|
}
|
||||||
|
$data_return['legend'][$key] .= remove_right_zeros(
|
||||||
|
number_format(
|
||||||
|
$value['data'][0][1],
|
||||||
|
$config['graph_precision']
|
||||||
|
)
|
||||||
|
) . ' ' . $series_suffix_str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(strpos($key, 'baseline') !== false){
|
$data_return['series_type'][$key] = 'area';
|
||||||
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
|
|
||||||
$value['module_name'] . ' Baseline ';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
|
|
||||||
$value['module_name'] . ': ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strpos($key, 'baseline') === false){
|
|
||||||
$data_return['legend'][$key] .=
|
|
||||||
__('Min:') . remove_right_zeros(
|
|
||||||
number_format(
|
|
||||||
$value['min'],
|
|
||||||
$config['graph_precision']
|
|
||||||
)
|
|
||||||
) . ' ' .
|
|
||||||
__('Max:') . remove_right_zeros(
|
|
||||||
number_format(
|
|
||||||
$value['max'],
|
|
||||||
$config['graph_precision']
|
|
||||||
)
|
|
||||||
) . ' ' .
|
|
||||||
_('Avg:') . remove_right_zeros(
|
|
||||||
number_format(
|
|
||||||
$value['avg'],
|
|
||||||
$config['graph_precision']
|
|
||||||
)
|
|
||||||
) . ' ' . $series_suffix_str;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif(strpos($key, 'event') !== false){
|
return $data_return;
|
||||||
$data_return['series_type'][$key] = 'points';
|
|
||||||
if($show_elements_graph['show_events']){
|
|
||||||
$data_return['legend'][$key] = __('Events') . ' ' . $series_suffix_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif(strpos($key, 'alert') !== false){
|
|
||||||
$data_return['series_type'][$key] = 'points';
|
|
||||||
if($show_elements_graph['show_alerts']){
|
|
||||||
$data_return['legend'][$key] = __('Alert') . ' ' . $series_suffix_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif(strpos($key, 'unknown') !== false){
|
|
||||||
$data_return['series_type'][$key] = 'unknown';
|
|
||||||
if($show_elements_graph['show_unknown']){
|
|
||||||
$data_return['legend'][$key] = __('Unknown') . ' ' . $series_suffix_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif(strpos($key, 'percentil') !== false){
|
|
||||||
$data_return['series_type'][$key] = 'percentil';
|
|
||||||
if($show_elements_graph['percentil']){
|
|
||||||
$data_return['legend'][$key] =
|
|
||||||
__('Percentil') . ' ' .
|
|
||||||
$config['percentil'] .
|
|
||||||
'º ' . __('of module') . ' ';
|
|
||||||
if (isset($show_elements_graph['labels']) && is_array($show_elements_graph['labels'])){
|
|
||||||
$data_return['legend'][$key] .= $show_elements_graph['labels'][$value['id_module_type']] . ' ' ;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$data_return['legend'][$key] .= $value['agent_name'] . ' / ' .
|
|
||||||
$value['module_name'] . ': ' . ' Value: ';
|
|
||||||
}
|
|
||||||
$data_return['legend'][$key] .= remove_right_zeros(
|
|
||||||
number_format(
|
|
||||||
$value['data'][0][1],
|
|
||||||
$config['graph_precision']
|
|
||||||
)
|
|
||||||
) . ' ' . $series_suffix_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$data_return['series_type'][$key] = 'area';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $data_return;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generator_chart_to_pdf($params){
|
||||||
|
global $config;
|
||||||
|
$params_encode_json = urlencode(json_encode($params));
|
||||||
|
$file_js = "/var/www/html/pandora_console/include/web2image.js";
|
||||||
|
$url = "http://localhost/pandora_console/include/chart_generator.php";
|
||||||
|
$img_destination = "/var/www/html/pandora_console/attachment/imagen_". $params['agent_module_id'] .".png";
|
||||||
|
$width_img = 1048;
|
||||||
|
$height_img = 568;
|
||||||
|
html_debug_print("entra con: " . $params['agent_module_id'] ." en el tiempo " . date("Y-m-d H:i:s"), true);
|
||||||
|
exec("phantomjs " . $file_js . " " . $url . " '" . $params_encode_json . "' " . $img_destination . " " . $width_img . " " . $height_img);
|
||||||
|
html_debug_print("sale con: " . $params['agent_module_id'] ." en el tiempo " . date("Y-m-d H:i:s"), true);
|
||||||
|
return "<img src='/var/www/html/pandora_console/attachment/imagen_". $params['agent_module_id'] .".png' alt='la imagen bonica'>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -228,8 +228,7 @@ function grafico_modulo_sparse_data_chart (
|
|||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$params,
|
||||||
$format_graph,
|
|
||||||
$series_suffix
|
$series_suffix
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -294,7 +293,7 @@ function grafico_modulo_sparse_data_chart (
|
|||||||
|
|
||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
//convert array
|
//convert array
|
||||||
if($show_elements_graph['flag_overlapped']){
|
if($params['flag_overlapped']){
|
||||||
$array_data["sum" . $series_suffix]['data'][$k] = array(
|
$array_data["sum" . $series_suffix]['data'][$k] = array(
|
||||||
($v['utimestamp'] + $date_array['period'] )* 1000,
|
($v['utimestamp'] + $date_array['period'] )* 1000,
|
||||||
$v['datos']
|
$v['datos']
|
||||||
@ -322,7 +321,7 @@ function grafico_modulo_sparse_data_chart (
|
|||||||
$count_data++;
|
$count_data++;
|
||||||
|
|
||||||
//percentil
|
//percentil
|
||||||
if (!is_null($show_elements_graph['percentil']) && $show_elements_graph['percentil']) {
|
if (!is_null($params['percentil']) && $params['percentil']) {
|
||||||
$array_percentil[] = $v['datos'];
|
$array_percentil[] = $v['datos'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,10 +333,10 @@ function grafico_modulo_sparse_data_chart (
|
|||||||
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||||
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
|
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||||
|
|
||||||
if (!is_null($show_elements_graph['percentil']) &&
|
if (!is_null($params['percentil']) &&
|
||||||
$show_elements_graph['percentil'] &&
|
$params['percentil'] &&
|
||||||
!$show_elements_graph['flag_overlapped']) {
|
!$params['flag_overlapped']) {
|
||||||
$percentil_result = get_percentile($show_elements_graph['percentil'], $array_percentil);
|
$percentil_result = get_percentile($params['percentil'], $array_percentil);
|
||||||
$array_data["percentil" . $series_suffix]['data'][0] = array(
|
$array_data["percentil" . $series_suffix]['data'][0] = array(
|
||||||
$date_array['start_date'] * 1000,
|
$date_array['start_date'] * 1000,
|
||||||
$percentil_result
|
$percentil_result
|
||||||
@ -352,22 +351,21 @@ function grafico_modulo_sparse_data_chart (
|
|||||||
|
|
||||||
function grafico_modulo_sparse_data(
|
function grafico_modulo_sparse_data(
|
||||||
$agent_module_id, $date_array,
|
$agent_module_id, $date_array,
|
||||||
$data_module_graph, $show_elements_graph,
|
$data_module_graph, $params,
|
||||||
$format_graph, $exception_interval_graph,
|
|
||||||
$series_suffix, $str_series_suffix) {
|
$series_suffix, $str_series_suffix) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
global $array_events_alerts;
|
global $array_events_alerts;
|
||||||
|
|
||||||
if($show_elements_graph['fullscale']){
|
if($params['fullscale']){
|
||||||
$array_data = fullscale_data(
|
$array_data = fullscale_data(
|
||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
$date_array,
|
$date_array,
|
||||||
$show_elements_graph['show_unknown'],
|
$params['show_unknown'],
|
||||||
$show_elements_graph['percentil'],
|
$params['percentil'],
|
||||||
$series_suffix,
|
$series_suffix,
|
||||||
$str_series_suffix,
|
$str_series_suffix,
|
||||||
$show_elements_graph['flag_overlapped']
|
$params['flag_overlapped']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -375,8 +373,7 @@ function grafico_modulo_sparse_data(
|
|||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$params,
|
||||||
$format_graph,
|
|
||||||
$series_suffix
|
$series_suffix
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -385,7 +382,71 @@ function grafico_modulo_sparse_data(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($show_elements_graph['percentil']){
|
//XXX Para un tipo de reports en concreto habria que optimizar que la tabla que crea coincida con los datos documentar
|
||||||
|
if($params['force_interval'] != ''){
|
||||||
|
$period_time_interval = $date_array['period'] * 1000;
|
||||||
|
$start_period = $date_array['start_date'] * 1000;
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$sum_data = 0;
|
||||||
|
$count_data = 0;
|
||||||
|
$data_last_acum = $array_data['sum1']['data'][0][1];
|
||||||
|
|
||||||
|
while($period_time_interval > 0) {
|
||||||
|
foreach ($array_data['sum1']['data'] as $key => $value) {
|
||||||
|
if($value[0] >= $start_period && $value[0] < $start_period + $params['time_interval'] * 1000){
|
||||||
|
$sum_data = $value[1];
|
||||||
|
$array_data_only[] = $value[1];
|
||||||
|
$count_data++;
|
||||||
|
unset($array_data['sum1']['data'][$key]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if($params['force_interval'] == 'max_only'){
|
||||||
|
$acum_array_data[$i][0] = $start_period;
|
||||||
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
||||||
|
$acum_array_data[$i][1] = max($array_data_only);
|
||||||
|
$data_last_acum = $array_data_only[count($array_data_only) - 1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$acum_array_data[$i][1] = $data_last_acum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($params['force_interval'] == 'min_only'){
|
||||||
|
$acum_array_data[$i][0] = $start_period;
|
||||||
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
||||||
|
$acum_array_data[$i][1] = min($array_data_only);
|
||||||
|
$data_last_acum = $array_data_only[count($array_data_only) - 1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$acum_array_data[$i][1] = $data_last_acum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($params['force_interval'] == 'avg_only'){
|
||||||
|
$acum_array_data[$i][0] = $start_period;
|
||||||
|
if(is_array($array_data_only) && count($array_data_only) > 0){
|
||||||
|
$acum_array_data[$i][1] = $sum_data / $count_data;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$acum_array_data[$i][1] = $data_last_acum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_period = $start_period + $params['time_interval'] * 1000;
|
||||||
|
$array_data_only = array();
|
||||||
|
$sum_data = 0;
|
||||||
|
$count_data = 0;
|
||||||
|
$i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$period_time_interval = $period_time_interval - $params['time_interval'];
|
||||||
|
}
|
||||||
|
$array_data['sum1']['data'] = $acum_array_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($params['percentil']){
|
||||||
$percentil_value = $array_data['percentil' . $series_suffix]['data'][0][1];
|
$percentil_value = $array_data['percentil' . $series_suffix]['data'][0][1];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -399,9 +460,9 @@ function grafico_modulo_sparse_data(
|
|||||||
$avg = $array_data['sum'. $series_suffix]['avg'];
|
$avg = $array_data['sum'. $series_suffix]['avg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$show_elements_graph['flag_overlapped']){
|
if(!$params['flag_overlapped']){
|
||||||
if($show_elements_graph['fullscale']){
|
if($params['fullscale']){
|
||||||
if( $show_elements_graph['show_unknown'] &&
|
if( $params['show_unknown'] &&
|
||||||
isset($array_data['unknown' . $series_suffix]) &&
|
isset($array_data['unknown' . $series_suffix]) &&
|
||||||
is_array($array_data['unknown' . $series_suffix]['data']) ){
|
is_array($array_data['unknown' . $series_suffix]['data']) ){
|
||||||
foreach ($array_data['unknown' . $series_suffix]['data'] as $key => $s_date) {
|
foreach ($array_data['unknown' . $series_suffix]['data'] as $key => $s_date) {
|
||||||
@ -412,7 +473,7 @@ function grafico_modulo_sparse_data(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if( $show_elements_graph['show_unknown'] ) {
|
if( $params['show_unknown'] ) {
|
||||||
$unknown_events = db_get_module_ranges_unknown(
|
$unknown_events = db_get_module_ranges_unknown(
|
||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
$date_array['start_date'],
|
$date_array['start_date'],
|
||||||
@ -463,8 +524,8 @@ function grafico_modulo_sparse_data(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_elements_graph['show_events'] ||
|
if ($params['show_events'] ||
|
||||||
$show_elements_graph['show_alerts'] ) {
|
$params['show_alerts'] ) {
|
||||||
|
|
||||||
$events = db_get_all_rows_filter (
|
$events = db_get_all_rows_filter (
|
||||||
'tevento',
|
'tevento',
|
||||||
@ -486,7 +547,7 @@ function grafico_modulo_sparse_data(
|
|||||||
$count_alerts=0;
|
$count_alerts=0;
|
||||||
foreach ($events as $k => $v) {
|
foreach ($events as $k => $v) {
|
||||||
if (strpos($v["event_type"], "alert") !== false){
|
if (strpos($v["event_type"], "alert") !== false){
|
||||||
if($show_elements_graph['flag_overlapped']){
|
if($params['flag_overlapped']){
|
||||||
$alerts_array['data'][$count_alerts] = array(
|
$alerts_array['data'][$count_alerts] = array(
|
||||||
($v['utimestamp'] + $date_array['period'] *1000),
|
($v['utimestamp'] + $date_array['period'] *1000),
|
||||||
$max * 1.10
|
$max * 1.10
|
||||||
@ -501,7 +562,7 @@ function grafico_modulo_sparse_data(
|
|||||||
$count_alerts++;
|
$count_alerts++;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if($show_elements_graph['flag_overlapped']){
|
if($params['flag_overlapped']){
|
||||||
if( ( strstr($v['event_type'], 'going_up') ) ||
|
if( ( strstr($v['event_type'], 'going_up') ) ||
|
||||||
( strstr($v['event_type'], 'going_down') ) ){
|
( strstr($v['event_type'], 'going_down') ) ){
|
||||||
$events_array['data'][$count_events] = array(
|
$events_array['data'][$count_events] = array(
|
||||||
@ -537,22 +598,22 @@ function grafico_modulo_sparse_data(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($show_elements_graph['show_events']){
|
if($params['show_events']){
|
||||||
$array_data['event' . $series_suffix] = $events_array;
|
$array_data['event' . $series_suffix] = $events_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($show_elements_graph['show_alerts']){
|
if($params['show_alerts']){
|
||||||
$array_data['alert' . $series_suffix] = $alerts_array;
|
$array_data['alert' . $series_suffix] = $alerts_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_elements_graph['return_data'] == 1) {
|
if ($params['return_data'] == 1) {
|
||||||
return $array_data;
|
return $array_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = color_graph_array(
|
$color = color_graph_array(
|
||||||
$series_suffix,
|
$series_suffix,
|
||||||
$show_elements_graph['flag_overlapped']
|
$params['flag_overlapped']
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($color as $k => $v) {
|
foreach ($color as $k => $v) {
|
||||||
@ -566,36 +627,215 @@ function grafico_modulo_sparse_data(
|
|||||||
return $array_data;
|
return $array_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
/*
|
||||||
$width, $height , $title = '', $unit_name = null,
|
$params =array(
|
||||||
$show_alerts = false, $avg_only = 0, $pure = false, $date = 0,
|
'agent_module_id' => $agent_module_id,
|
||||||
$unit = '', $baseline = 0, $return_data = 0, $show_title = true,
|
'period' => $period,
|
||||||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
'show_events' => false,
|
||||||
$adapt_key = '', $compare = false, $show_unknown = false,
|
'width' => $width,
|
||||||
$menu = true, $backgroundColor = 'white', $percentil = null,
|
'height' => $height,
|
||||||
$dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false,
|
'title' => '',
|
||||||
$id_widget_dashboard = false,$force_interval = 0,$time_interval = 300,
|
'unit_name' => null,
|
||||||
$max_only = 0, $min_only = 0, $array_data_create = 0) {
|
'show_alerts' => false,
|
||||||
|
'avg_only' => 0,
|
||||||
|
'pure' => false,
|
||||||
|
'date' => 0,
|
||||||
|
'unit' => '',
|
||||||
|
'baseline' => 0,
|
||||||
|
'return_data' => 0,
|
||||||
|
'show_title' => true,
|
||||||
|
'only_image' => false,
|
||||||
|
'homeurl' => '',
|
||||||
|
'ttl' => 1,
|
||||||
|
'projection' => false,
|
||||||
|
'adapt_key' => '',
|
||||||
|
'compare' => false,
|
||||||
|
'show_unknown' => false,
|
||||||
|
'menu' => true,
|
||||||
|
'backgroundColor' => 'white',
|
||||||
|
'percentil' => null,
|
||||||
|
'dashboard' => false,
|
||||||
|
'vconsole' => false,
|
||||||
|
'type_graph' => 'area',
|
||||||
|
'fullscale' => false,
|
||||||
|
'id_widget_dashboard' => false,
|
||||||
|
'force_interval' => '',
|
||||||
|
'time_interval' => 300,
|
||||||
|
'array_data_create' => 0
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
function grafico_modulo_sparse ($params) {
|
||||||
|
html_debug_print('entra por este sitio', true);
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
/*XXXXXXXXXXXX Documnetar
|
||||||
|
*Set all variable
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!isset($params) || !is_array($params)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['agent_module_id'])){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$agent_module_id = $params['agent_module_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['period'])){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['show_events'])){
|
||||||
|
$params['show_events'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ATTENTION: The min size is in constants.php
|
||||||
|
// It's not the same minsize for all graphs, but we are choosed a prudent minsize for all
|
||||||
|
if(!isset($params['width'])){
|
||||||
|
$params['width'] = '90%';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['height'])){
|
||||||
|
$params['height'] = 450;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['title'])){
|
||||||
|
$params['title'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['unit_name'])){
|
||||||
|
$params['unit_name'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['show_alerts'])){
|
||||||
|
$params['show_alerts'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['avg_only'])){
|
||||||
|
$params['avg_only'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['pure'])){
|
||||||
|
$params['pure'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['date']) || !$params['date']){
|
||||||
|
$params['date'] = get_system_time();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['unit'])){
|
||||||
|
$params['unit'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['baseline'])){
|
||||||
|
$params['baseline'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['return_data'])){
|
||||||
|
$params['return_data'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['show_title'])){
|
||||||
|
$show_title = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['only_image'])){
|
||||||
|
$params['only_image'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['homeurl'])){
|
||||||
|
$params['homeurl'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['ttl'])){
|
||||||
|
$params['ttl'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['projection'])){
|
||||||
|
$params['projection'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['adapt_key'])){
|
||||||
|
$params['adapt_key'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['compare'])){
|
||||||
|
$params['compare'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['show_unknown'])){
|
||||||
|
$params['show_unknown'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['menu'])){
|
||||||
|
$params['menu'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['backgroundColor'])){
|
||||||
|
$params['backgroundColor'] = 'white';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['percentil'])){
|
||||||
|
$params['percentil'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['dashboard'])){
|
||||||
|
$params['dashboard'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['vconsole'])){
|
||||||
|
$params['vconsole'] = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$params['menu'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['type_graph'])){
|
||||||
|
$params['type_graph'] = $config['type_module_charts'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['fullscale'])){
|
||||||
|
$params['fullscale'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['id_widget_dashboard'])){
|
||||||
|
$params['id_widget_dashboard'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['force_interval'])){
|
||||||
|
$params['force_interval'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['time_interval'])){
|
||||||
|
$params['time_interval'] = 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($params['array_data_create'])){
|
||||||
|
$params['array_data_create'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['font'] = $config['fontpath'];
|
||||||
|
$params['font-size'] = $config['font_size'];
|
||||||
|
|
||||||
|
//XXXXXXXXXXXX se devuelve phantom.js
|
||||||
|
if($params['only_image']){
|
||||||
|
return generator_chart_to_pdf($params);
|
||||||
|
}
|
||||||
|
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
global $array_events_alerts;
|
global $array_events_alerts;
|
||||||
|
|
||||||
|
|
||||||
$array_data = array();
|
$array_data = array();
|
||||||
$legend = array();
|
$legend = array();
|
||||||
$array_events_alerts = array();
|
$array_events_alerts = array();
|
||||||
|
|
||||||
//date start final period
|
|
||||||
if($date == 0){
|
|
||||||
$date = get_system_time();
|
|
||||||
}
|
|
||||||
|
|
||||||
$date_array = array();
|
$date_array = array();
|
||||||
$date_array["period"] = $period;
|
$date_array["period"] = $params['period'];
|
||||||
$date_array["final_date"] = $date;
|
$date_array["final_date"] = $params['date'];
|
||||||
$date_array["start_date"] = $date - $period;
|
$date_array["start_date"] = $params['date'] - $params['period'];
|
||||||
|
|
||||||
$module_data = db_get_row_sql (
|
$module_data = db_get_row_sql (
|
||||||
'SELECT * FROM tagente_modulo
|
'SELECT * FROM tagente_modulo
|
||||||
@ -618,72 +858,16 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$data_module_graph['c_max'] = $module_data['max_critical'];
|
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||||
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||||
|
|
||||||
//show elements in the graph
|
|
||||||
if ($vconsole){
|
|
||||||
$menu = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$show_elements_graph = array();
|
|
||||||
$show_elements_graph['show_events'] = $show_events;
|
|
||||||
$show_elements_graph['show_alerts'] = $show_alerts;
|
|
||||||
$show_elements_graph['show_unknown'] = $show_unknown;
|
|
||||||
$show_elements_graph['avg_only'] = $avg_only;
|
|
||||||
$show_elements_graph['fullscale'] = $fullscale;
|
|
||||||
$show_elements_graph['show_title'] = $show_title;
|
|
||||||
$show_elements_graph['menu'] = $menu;
|
|
||||||
$show_elements_graph['percentil'] = $percentil;
|
|
||||||
$show_elements_graph['projection'] = $projection;
|
|
||||||
$show_elements_graph['adapt_key'] = $adapt_key;
|
|
||||||
$show_elements_graph['compare'] = $compare;
|
|
||||||
$show_elements_graph['dashboard'] = $dashboard;
|
|
||||||
$show_elements_graph['vconsole'] = $vconsole;
|
|
||||||
$show_elements_graph['pure'] = $pure;
|
|
||||||
$show_elements_graph['baseline'] = $baseline;
|
|
||||||
$show_elements_graph['only_image'] = $only_image;
|
|
||||||
$show_elements_graph['return_data'] = $return_data;
|
|
||||||
$show_elements_graph['id_widget'] = $id_widget_dashboard;
|
|
||||||
|
|
||||||
//format of the graph
|
//format of the graph
|
||||||
if (empty($unit)) {
|
if (empty($params['unit'])) {
|
||||||
$unit = $module_data['unit'];
|
$params['unit'] = $module_data['unit'];
|
||||||
if(modules_is_unit_macro($unit)){
|
if(modules_is_unit_macro($params['unit'])){
|
||||||
$unit = "";
|
$params['unit'] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ATTENTION: The min size is in constants.php
|
if(!$params['array_data_create']){
|
||||||
// It's not the same minsize for all graphs, but we are choosed a prudent minsize for all
|
if ($params['compare'] !== false) {
|
||||||
/*
|
|
||||||
if ($height <= CHART_DEFAULT_HEIGHT) {
|
|
||||||
$height = CHART_DEFAULT_HEIGHT;
|
|
||||||
}
|
|
||||||
if ($width < CHART_DEFAULT_WIDTH) {
|
|
||||||
$width = CHART_DEFAULT_WIDTH;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$format_graph = array();
|
|
||||||
$format_graph['width'] = $width;
|
|
||||||
$format_graph['height'] = $height;
|
|
||||||
$format_graph['type_graph'] = $type_graph;
|
|
||||||
$format_graph['unit_name'] = $unit_name;
|
|
||||||
$format_graph['unit'] = $unit;
|
|
||||||
$format_graph['title'] = $title;
|
|
||||||
$format_graph['homeurl'] = $homeurl;
|
|
||||||
$format_graph['ttl'] = $ttl;
|
|
||||||
$format_graph['background'] = $backgroundColor;
|
|
||||||
$format_graph['font'] = $config['fontpath'];
|
|
||||||
$format_graph['font-size'] = $config['font_size'];
|
|
||||||
|
|
||||||
//exception to change the interval of the graph and show media min max @enriquecd
|
|
||||||
$exception_interval_graph['force_interval'] = $force_interval;
|
|
||||||
$exception_interval_graph['time_interval'] = $time_interval;
|
|
||||||
$exception_interval_graph['max_only'] = $max_only;
|
|
||||||
$exception_interval_graph['min_only'] = $min_only;
|
|
||||||
|
|
||||||
$type_graph = $config['type_module_charts'];
|
|
||||||
|
|
||||||
if(!$array_data_create){
|
|
||||||
if ($show_elements_graph['compare'] !== false) {
|
|
||||||
$series_suffix = 2;
|
$series_suffix = 2;
|
||||||
$series_suffix_str = ' (' . __('Previous') . ')';
|
$series_suffix_str = ' (' . __('Previous') . ')';
|
||||||
|
|
||||||
@ -691,21 +875,20 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$date_array_prev['start_date'] = $date_array['start_date'] - $date_array['period'];
|
$date_array_prev['start_date'] = $date_array['start_date'] - $date_array['period'];
|
||||||
$date_array_prev['period'] = $date_array['period'];
|
$date_array_prev['period'] = $date_array['period'];
|
||||||
|
|
||||||
if ($show_elements_graph['compare'] === 'overlapped') {
|
if ($params['compare'] === 'overlapped') {
|
||||||
$show_elements_graph['flag_overlapped'] = 1;
|
$params['flag_overlapped'] = 1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$show_elements_graph['flag_overlapped'] = 0;
|
$params['flag_overlapped'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$array_data = grafico_modulo_sparse_data(
|
$array_data = grafico_modulo_sparse_data(
|
||||||
$agent_module_id, $date_array_prev,
|
$agent_module_id, $date_array_prev,
|
||||||
$data_module_graph, $show_elements_graph,
|
$data_module_graph, $params,
|
||||||
$format_graph, $exception_interval_graph,
|
|
||||||
$series_suffix, $series_suffix_str
|
$series_suffix, $series_suffix_str
|
||||||
);
|
);
|
||||||
|
|
||||||
switch ($show_elements_graph['compare']) {
|
switch ($params['compare']) {
|
||||||
case 'separated':
|
case 'separated':
|
||||||
case 'overlapped':
|
case 'overlapped':
|
||||||
// Store the chart calculated
|
// Store the chart calculated
|
||||||
@ -717,27 +900,26 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
$series_suffix = 1;
|
$series_suffix = 1;
|
||||||
$series_suffix_str = '';
|
$series_suffix_str = '';
|
||||||
$show_elements_graph['flag_overlapped'] = 0;
|
$params['flag_overlapped'] = 0;
|
||||||
|
|
||||||
$array_data = grafico_modulo_sparse_data(
|
$array_data = grafico_modulo_sparse_data(
|
||||||
$agent_module_id, $date_array,
|
$agent_module_id, $date_array,
|
||||||
$data_module_graph, $show_elements_graph,
|
$data_module_graph, $params,
|
||||||
$format_graph, $exception_interval_graph,
|
|
||||||
$series_suffix, $str_series_suffix
|
$series_suffix, $str_series_suffix
|
||||||
);
|
);
|
||||||
|
|
||||||
if($show_elements_graph['compare']){
|
if($params['compare']){
|
||||||
if ($show_elements_graph['compare'] === 'overlapped') {
|
if ($params['compare'] === 'overlapped') {
|
||||||
$array_data = array_merge($array_data, $array_data_prev);
|
$array_data = array_merge($array_data, $array_data_prev);
|
||||||
$legend = array_merge($legend, $legend_prev);
|
$legend = array_merge($legend, $legend_prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$array_data = $array_data_create;
|
$array_data = $params['array_data_create'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($show_elements_graph['return_data']){
|
if($params['return_data']){
|
||||||
return $array_data;
|
return $array_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +937,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
$series_type_array = series_type_graph_array(
|
$series_type_array = series_type_graph_array(
|
||||||
$array_data,
|
$array_data,
|
||||||
$show_elements_graph
|
$params
|
||||||
);
|
);
|
||||||
|
|
||||||
$series_type = $series_type_array['series_type'];
|
$series_type = $series_type_array['series_type'];
|
||||||
@ -767,7 +949,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$data_module_graph['series_suffix'] = $series_suffix;
|
$data_module_graph['series_suffix'] = $series_suffix;
|
||||||
|
|
||||||
// Check available data
|
// Check available data
|
||||||
if ($show_elements_graph['compare'] === 'separated') {
|
if ($params['compare'] === 'separated') {
|
||||||
if (!empty($array_data)) {
|
if (!empty($array_data)) {
|
||||||
$return = area_graph(
|
$return = area_graph(
|
||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
@ -776,22 +958,21 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$series_type,
|
$series_type,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$params,
|
||||||
$format_graph,
|
|
||||||
$water_mark,
|
$water_mark,
|
||||||
$series_suffix_str,
|
$series_suffix_str,
|
||||||
$array_events_alerts
|
$array_events_alerts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$return = graph_nodata_image($width, $height);
|
$return = graph_nodata_image($params['width'], $params['height']);
|
||||||
}
|
}
|
||||||
$return .= '<br>';
|
$return .= '<br>';
|
||||||
if (!empty($array_data_prev)) {
|
if (!empty($array_data_prev)) {
|
||||||
|
|
||||||
$series_type_array = series_type_graph_array(
|
$series_type_array = series_type_graph_array(
|
||||||
$array_data_prev,
|
$array_data_prev,
|
||||||
$show_elements_graph
|
$params
|
||||||
);
|
);
|
||||||
|
|
||||||
$series_type = $series_type_array['series_type'];
|
$series_type = $series_type_array['series_type'];
|
||||||
@ -804,15 +985,14 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$series_type,
|
$series_type,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$params,
|
||||||
$format_graph,
|
|
||||||
$water_mark,
|
$water_mark,
|
||||||
$series_suffix_str,
|
$series_suffix_str,
|
||||||
$array_events_alerts
|
$array_events_alerts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$return .= graph_nodata_image($width, $height);
|
$return .= graph_nodata_image($params['width'], $params['height']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -824,21 +1004,22 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$series_type,
|
$series_type,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$params,
|
||||||
$format_graph,
|
|
||||||
$water_mark,
|
$water_mark,
|
||||||
$series_suffix_str,
|
$series_suffix_str,
|
||||||
$array_events_alerts
|
$array_events_alerts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$return = graph_nodata_image($width, $height);
|
$return = graph_nodata_image($params['width'], $params['height']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function graph_get_formatted_date($timestamp, $format1, $format2) {
|
function graph_get_formatted_date($timestamp, $format1, $format2) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -950,43 +1131,33 @@ function graphic_combined_module (
|
|||||||
$menu = false;
|
$menu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$show_elements_graph = array();
|
$params = array();
|
||||||
$show_elements_graph['show_events'] = $show_events;
|
$params['show_events'] = $show_events;
|
||||||
$show_elements_graph['show_alerts'] = $show_alerts;
|
$params['show_alerts'] = $show_alerts;
|
||||||
$show_elements_graph['show_unknown'] = false; // dont use
|
$params['show_unknown'] = false; // dont use
|
||||||
$show_elements_graph['avg_only'] = false; // dont use
|
$params['avg_only'] = false; // dont use
|
||||||
$show_elements_graph['fullscale'] = $fullscale;
|
$params['fullscale'] = $fullscale;
|
||||||
$show_elements_graph['show_title'] = ''; // dont use
|
$params['show_title'] = ''; // dont use
|
||||||
$show_elements_graph['menu'] = $menu; // dont use
|
$params['menu'] = $menu; // dont use
|
||||||
$show_elements_graph['adapt_key'] = ''; // dont use
|
$params['adapt_key'] = ''; // dont use
|
||||||
$show_elements_graph['percentil'] = $percentil;
|
$params['percentil'] = $percentil;
|
||||||
$show_elements_graph['projection'] = $projection;
|
$params['projection'] = $projection;
|
||||||
$show_elements_graph['compare'] = false; //dont use
|
$params['compare'] = false; //dont use
|
||||||
$show_elements_graph['dashboard'] = $dashboard;
|
$params['dashboard'] = $dashboard;
|
||||||
$show_elements_graph['vconsole'] = $vconsole;
|
$params['vconsole'] = $vconsole;
|
||||||
$show_elements_graph['pure'] = $pure;
|
$params['pure'] = $pure;
|
||||||
$show_elements_graph['baseline'] = false; //dont use
|
$params['baseline'] = false; //dont use
|
||||||
$show_elements_graph['only_image'] = $only_image;
|
$params['only_image'] = $only_image;
|
||||||
$show_elements_graph['return_data'] = false; //dont use
|
$params['return_data'] = false; //dont use
|
||||||
$show_elements_graph['id_widget'] = $id_widget_dashboard;
|
$params['id_widget'] = $id_widget_dashboard;
|
||||||
$show_elements_graph['labels'] = $labels;
|
$params['labels'] = $labels;
|
||||||
$show_elements_graph['stacked'] = $stacked;
|
$params['stacked'] = $stacked;
|
||||||
$show_elements_graph['combined'] = true;
|
$params['combined'] = true;
|
||||||
$show_elements_graph['from_interface'] = $from_interface;
|
$params['from_interface'] = $from_interface;
|
||||||
|
$params['font'] = $config['fontpath'];
|
||||||
$format_graph = array();
|
$params['font-size'] = $config['font_size'];
|
||||||
$format_graph['width'] = "90%";
|
$params['width'] ='90%';
|
||||||
$format_graph['height'] = "450";
|
$params['height'] = $height;
|
||||||
$format_graph['type_graph'] = ''; //dont use
|
|
||||||
$format_graph['unit_name'] = $unit_name;
|
|
||||||
$format_graph['unit'] = ''; //dont use
|
|
||||||
$format_graph['title'] = $title;
|
|
||||||
$format_graph['homeurl'] = $homeurl;
|
|
||||||
$format_graph['ttl'] = $ttl;
|
|
||||||
$format_graph['background'] = $backgroundColor;
|
|
||||||
$format_graph['font'] = $config['fontpath'];
|
|
||||||
$format_graph['font-size'] = $config['font_size'];
|
|
||||||
|
|
||||||
//for flash_charts
|
//for flash_charts
|
||||||
$user = users_get_user_by_id($config['id_user']);
|
$user = users_get_user_by_id($config['id_user']);
|
||||||
$user_flash_charts = $user['flash_chart'];
|
$user_flash_charts = $user['flash_chart'];
|
||||||
@ -1032,9 +1203,7 @@ function graphic_combined_module (
|
|||||||
$agent_module_id,
|
$agent_module_id,
|
||||||
$date_array,
|
$date_array,
|
||||||
$data_module_graph,
|
$data_module_graph,
|
||||||
$show_elements_graph,
|
$param,
|
||||||
$format_graph,
|
|
||||||
array(),
|
|
||||||
$i,
|
$i,
|
||||||
$data_module_graph['agent_name']
|
$data_module_graph['agent_name']
|
||||||
);
|
);
|
||||||
@ -1581,9 +1750,8 @@ function graphic_combined_module (
|
|||||||
case CUSTOM_GRAPH_AREA:
|
case CUSTOM_GRAPH_AREA:
|
||||||
case CUSTOM_GRAPH_LINE:
|
case CUSTOM_GRAPH_LINE:
|
||||||
return area_graph($agent_module_id, $array_data,
|
return area_graph($agent_module_id, $array_data,
|
||||||
$legend, $series_type, $date_array,
|
$legend, $series_type, $date_array, $data_module_graph,
|
||||||
$data_module_graph, $show_elements_graph,
|
$params, $water_mark, $series_suffix_str,
|
||||||
$format_graph, $water_mark, $series_suffix_str,
|
|
||||||
$array_events_alerts);
|
$array_events_alerts);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||||
|
@ -3507,18 +3507,6 @@ function reporting_simple_baseline_graph($report, $content,
|
|||||||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||||
$content, $ttl);
|
$content, $ttl);
|
||||||
|
|
||||||
if (!empty($force_width_chart)) {
|
|
||||||
$width = $force_width_chart;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($force_height_chart)) {
|
|
||||||
$height = $force_height_chart;
|
|
||||||
}
|
|
||||||
|
|
||||||
//XXXXXXXX
|
|
||||||
$width = '90%';
|
|
||||||
$height = 300;
|
|
||||||
|
|
||||||
$baseline_data = enterprise_hook(
|
$baseline_data = enterprise_hook(
|
||||||
'reporting_enterprise_get_baseline',
|
'reporting_enterprise_get_baseline',
|
||||||
array (
|
array (
|
||||||
@ -3535,43 +3523,17 @@ function reporting_simple_baseline_graph($report, $content,
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'dinamic':
|
case 'dinamic':
|
||||||
case 'static':
|
case 'static':
|
||||||
$return['chart'] = grafico_modulo_sparse (
|
$params =array(
|
||||||
$content['id_agent_module'],
|
'agent_module_id' => $content['id_agent_module'],
|
||||||
$content['period'],
|
'period' => $content['period'],
|
||||||
false,
|
'date' => $report["datetime"],
|
||||||
$width,
|
'only_image' => $only_image,
|
||||||
$height,
|
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||||
'',
|
'ttl' => $ttl,
|
||||||
null,
|
'array_data_create' => $baseline_data
|
||||||
false,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
$report["datetime"],
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$only_image,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
$ttl,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
'white',
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'area',
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
300,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
$baseline_data
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$return['chart'] = grafico_modulo_sparse ($params);
|
||||||
break;
|
break;
|
||||||
case 'data':
|
case 'data':
|
||||||
break;
|
break;
|
||||||
@ -3934,7 +3896,6 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'max':
|
case 'max':
|
||||||
if($content['lapse_calc'] == 0){
|
if($content['lapse_calc'] == 0){
|
||||||
|
|
||||||
$value = reporting_get_agentmodule_data_max(
|
$value = reporting_get_agentmodule_data_max(
|
||||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||||
if (!$config['simple_module_value']) {
|
if (!$config['simple_module_value']) {
|
||||||
@ -3943,17 +3904,27 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
else {
|
else {
|
||||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
$params =array(
|
||||||
|
'agent_module_id' => $content['id_agent_module'],
|
||||||
|
'period' => $content['period'],
|
||||||
|
'width' => '600px',
|
||||||
|
'pure' => false,///true
|
||||||
|
'date' => $report["datetime"],
|
||||||
|
'only_image' => $only_image,
|
||||||
|
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||||
|
'ttl' => 1,///2
|
||||||
|
'type_graph' => $config['type_module_charts'],
|
||||||
|
'time_interval' => $content['lapse']
|
||||||
|
);
|
||||||
|
|
||||||
$value = '
|
$value = '
|
||||||
<table border="0" style="margin:0 auto;text-align:center;">
|
<table border="0" style="margin:0 auto;text-align:center;">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="400px;" height="20%;">';
|
<td width="400px;" height="20%;">';
|
||||||
|
|
||||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -3979,62 +3950,28 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" width="150px">
|
<td rowspan="2" width="150px">
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2">';
|
<td rowspan="2">';
|
||||||
|
|
||||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||||
$value .=
|
$params['force_interval'] = 'max_only';
|
||||||
grafico_modulo_sparse(
|
$value .= grafico_modulo_sparse($params);
|
||||||
$content['id_agent_module'],
|
|
||||||
$content['period'],
|
|
||||||
false,
|
|
||||||
600,
|
|
||||||
300,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$report["datetime"],
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$only_image,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
2,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$time_compare_overlapped,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
'white',
|
|
||||||
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$config['type_module_charts'],
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$content['lapse_calc'],
|
|
||||||
$content['lapse'],
|
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>';
|
<td>';
|
||||||
|
|
||||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -4048,11 +3985,11 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
<tr>';
|
<tr>';
|
||||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||||
$date_reference = getdate();
|
$date_reference = getdate();
|
||||||
|
|
||||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||||
|
|
||||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||||
|
|
||||||
if($i>$time_begin['utimestamp']){
|
if($i>$time_begin['utimestamp']){
|
||||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||||
@ -4060,37 +3997,35 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
else{
|
else{
|
||||||
$value .= 'N/A</td></tr>';
|
$value .= 'N/A</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .='</table>';
|
$value .='</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
$formated_value = $value;
|
$formated_value = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'min':
|
case 'min':
|
||||||
if($content['lapse_calc'] == 0){
|
if($content['lapse_calc'] == 0){
|
||||||
$value = reporting_get_agentmodule_data_min(
|
$value = reporting_get_agentmodule_data_min(
|
||||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||||
|
|
||||||
if (!$config['simple_module_value']) {
|
if (!$config['simple_module_value']) {
|
||||||
$formated_value = $value;
|
$formated_value = $value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
$value = '
|
$value = '
|
||||||
<table border="0" style="margin:0 auto;text-align:center;">
|
<table border="0" style="margin:0 auto;text-align:center;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -4123,57 +4058,21 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" width="150px">
|
<td rowspan="2" width="150px">
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2">';
|
<td rowspan="2">';
|
||||||
|
|
||||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||||
$value .=
|
$params['force_interval'] = 'min_only';
|
||||||
grafico_modulo_sparse(
|
$value .= grafico_modulo_sparse($params);
|
||||||
$content['id_agent_module'],
|
|
||||||
$content['period'],
|
|
||||||
false,
|
|
||||||
600,
|
|
||||||
300,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$report["datetime"],
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$only_image,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
2,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$time_compare_overlapped,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
'white',
|
|
||||||
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$config['type_module_charts'],
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$content['lapse_calc'],
|
|
||||||
$content['lapse'],
|
|
||||||
0,
|
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
|
</td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>';
|
<td>';
|
||||||
@ -4239,7 +4138,6 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
<td width="400px;" height="20%;">';
|
<td width="400px;" height="20%;">';
|
||||||
|
|
||||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -4275,41 +4173,8 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||||||
<td rowspan="2">';
|
<td rowspan="2">';
|
||||||
|
|
||||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||||
$value .=
|
$params['force_interval'] = 'avg_only';
|
||||||
grafico_modulo_sparse(
|
$value .= grafico_modulo_sparse($params);
|
||||||
$content['id_agent_module'],
|
|
||||||
$content['period'],
|
|
||||||
false,
|
|
||||||
600,
|
|
||||||
300,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
1,
|
|
||||||
true,
|
|
||||||
$report["datetime"],
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
true,
|
|
||||||
$only_image,
|
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
2,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$time_compare_overlapped,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
'white',
|
|
||||||
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$config['type_module_charts'],
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$content['lapse_calc'],
|
|
||||||
$content['lapse']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$value .= '
|
$value .= '
|
||||||
@ -6635,6 +6500,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||||||
case 'static':
|
case 'static':
|
||||||
if (preg_match ("/string/", $moduletype_name)) {
|
if (preg_match ("/string/", $moduletype_name)) {
|
||||||
$urlImage = ui_get_full_url(false, false, false, false);
|
$urlImage = ui_get_full_url(false, false, false, false);
|
||||||
|
/*
|
||||||
$return['chart'] = grafico_modulo_string(
|
$return['chart'] = grafico_modulo_string(
|
||||||
$content['id_agent_module'],
|
$content['id_agent_module'],
|
||||||
$content['period'],
|
$content['period'],
|
||||||
@ -6651,6 +6517,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||||||
$urlImage,
|
$urlImage,
|
||||||
"",
|
"",
|
||||||
$ttl);
|
$ttl);
|
||||||
|
*/
|
||||||
|
$return['chart'] = 'arreglar la grafica de string de una vez por todassssssssss';
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -6660,36 +6528,23 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||||||
$time_compare_overlapped = 'overlapped';
|
$time_compare_overlapped = 'overlapped';
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['chart'] = grafico_modulo_sparse(
|
$params =array(
|
||||||
$content['id_agent_module'],
|
'agent_module_id' => $content['id_agent_module'],
|
||||||
$content['period'],
|
'period' => $content['period'],
|
||||||
false,
|
'title' => $label,
|
||||||
'90%',
|
'avg_only' => $only_avg,
|
||||||
400,
|
'pure' => false, //XXX
|
||||||
$label,
|
'date' => $report["datetime"],
|
||||||
'',
|
'only_image' => $only_image,
|
||||||
false,
|
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||||
$only_avg,
|
'ttl' => $ttl,
|
||||||
true,
|
'compare' => $time_compare_overlapped,
|
||||||
$report["datetime"],
|
'show_unknown' => true,
|
||||||
'',
|
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
||||||
0,
|
'fullscale' => $fullscale
|
||||||
0,
|
);
|
||||||
true,
|
|
||||||
$only_image,
|
$return['chart'] = grafico_modulo_sparse($params);
|
||||||
ui_get_full_url(false, false, false, false),
|
|
||||||
$ttl,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
$time_compare_overlapped,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
'white',
|
|
||||||
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
$config['type_module_charts'],
|
|
||||||
$fullscale);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'data':
|
case 'data':
|
||||||
@ -6708,7 +6563,6 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,61 +223,25 @@ function vbar_graph(
|
|||||||
function area_graph(
|
function area_graph(
|
||||||
$agent_module_id, $array_data,
|
$agent_module_id, $array_data,
|
||||||
$legend, $series_type, $date_array,
|
$legend, $series_type, $date_array,
|
||||||
$data_module_graph, $show_elements_graph,
|
$data_module_graph, $params, $water_mark, $series_suffix_str,
|
||||||
$format_graph, $water_mark, $series_suffix_str,
|
|
||||||
$array_events_alerts
|
$array_events_alerts
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
include_once('functions_flot.php');
|
include_once('functions_flot.php');
|
||||||
if ($config['flash_charts']) {
|
|
||||||
return flot_area_graph(
|
|
||||||
$agent_module_id,
|
|
||||||
$array_data,
|
|
||||||
$legend,
|
|
||||||
$series_type,
|
|
||||||
$date_array,
|
|
||||||
$data_module_graph,
|
|
||||||
$show_elements_graph,
|
|
||||||
$format_graph,
|
|
||||||
$water_mark,
|
|
||||||
$series_suffix_str,
|
|
||||||
$array_events_alerts
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//XXXXX
|
|
||||||
//Corregir este problema
|
|
||||||
//tener en cuenta stacked, area, line
|
|
||||||
|
|
||||||
$graph = array();
|
return flot_area_graph(
|
||||||
$graph['data'] = $array_data;
|
$agent_module_id,
|
||||||
$graph['width'] = 900;
|
$array_data,
|
||||||
$graph['height'] = 400;
|
$legend,
|
||||||
// $graph['color'] = $color;
|
$series_type,
|
||||||
$graph['legend'] = $legend;
|
$date_array,
|
||||||
$graph['xaxisname'] = 'me la pela';
|
$data_module_graph,
|
||||||
$graph['yaxisname'] = 'borja es gay';
|
$params,
|
||||||
// $graph['water_mark'] = $water_mark_file;
|
$water_mark,
|
||||||
$graph['font'] = $format_graph['font'];
|
$series_suffix_str,
|
||||||
$graph['font_size'] = $format_graph['font_size'];
|
$array_events_alerts
|
||||||
$graph['backgroundColor'] = 'white';
|
);
|
||||||
$graph['unit'] = '';
|
|
||||||
$graph['series_type'] = array();
|
|
||||||
$graph['percentil'] = false;
|
|
||||||
|
|
||||||
//XXX $ttl tercer parametro
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, 1);
|
|
||||||
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
|
||||||
return "<img src='" .
|
|
||||||
ui_get_full_url (false, false, false, false) .
|
|
||||||
"include/graphs/functions_pchart.php?" .
|
|
||||||
"static_graph=1&" .
|
|
||||||
"graph_type=area&" .
|
|
||||||
"ttl=" . $ttl . "&" .
|
|
||||||
"id_graph=" . $id_graph . "'>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stacked_bullet_chart($flash_chart, $chart_data, $width, $height,
|
function stacked_bullet_chart($flash_chart, $chart_data, $width, $height,
|
||||||
|
@ -858,28 +858,28 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
function pandoraFlotArea(
|
function pandoraFlotArea(
|
||||||
graph_id, values, legend, agent_module_id,
|
graph_id, values, legend, agent_module_id,
|
||||||
series_type, watermark, date_array,
|
series_type, watermark, date_array,
|
||||||
data_module_graph, show_elements_graph,
|
data_module_graph, params,
|
||||||
format_graph, force_integer, series_suffix_str,
|
force_integer, series_suffix_str,
|
||||||
background_color, legend_color, short_data,
|
background_color, legend_color, short_data,
|
||||||
events_array
|
events_array
|
||||||
) {
|
) {
|
||||||
|
|
||||||
//diferents vars
|
//diferents vars
|
||||||
var unit = format_graph.unit ? format_graph.unit : '';
|
var unit = params.unit ? params.unit : '';
|
||||||
var homeurl = format_graph.homeurl;
|
var homeurl = params.homeurl;
|
||||||
var font_size = format_graph.font_size;
|
var font_size = params.font_size;
|
||||||
var font = format_graph.font;
|
var font = params.font;
|
||||||
var width = format_graph.width;
|
var width = params.width;
|
||||||
var height = format_graph.height;
|
var height = params.height;
|
||||||
var vconsole = show_elements_graph.vconsole;
|
var vconsole = params.vconsole;
|
||||||
var dashboard = show_elements_graph.dashboard;
|
var dashboard = params.dashboard;
|
||||||
var menu = show_elements_graph.menu;
|
var menu = params.menu;
|
||||||
var min_x = date_array['start_date'] *1000;
|
var min_x = date_array['start_date'] *1000;
|
||||||
var max_x = date_array['final_date'] *1000;
|
var max_x = date_array['final_date'] *1000;
|
||||||
var type = show_elements_graph.stacked;
|
var type = params.stacked;
|
||||||
|
|
||||||
if(typeof type === 'undefined' || type == ''){
|
if(typeof type === 'undefined' || type == ''){
|
||||||
type = format_graph.type_graph;
|
type = params.type_graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
//for threshold
|
//for threshold
|
||||||
@ -2125,7 +2125,7 @@ console.log(legend);
|
|||||||
|
|
||||||
// Get only two decimals
|
// Get only two decimals
|
||||||
//XXXXXXXXXX
|
//XXXXXXXXXX
|
||||||
formatted = round_with_decimals(formatted, 100);
|
//formatted = round_with_decimals(formatted, 100);
|
||||||
return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
|
return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +103,7 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||||||
function flot_area_graph (
|
function flot_area_graph (
|
||||||
$agent_module_id, $array_data,
|
$agent_module_id, $array_data,
|
||||||
$legend, $series_type, $date_array,
|
$legend, $series_type, $date_array,
|
||||||
$data_module_graph, $show_elements_graph,
|
$data_module_graph, $params, $water_mark, $series_suffix_str,
|
||||||
$format_graph, $water_mark, $series_suffix_str,
|
|
||||||
$array_events_alerts ) {
|
$array_events_alerts ) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
@ -115,7 +114,7 @@ function flot_area_graph (
|
|||||||
$graph_id = uniqid('graph_');
|
$graph_id = uniqid('graph_');
|
||||||
|
|
||||||
$background_style = '';
|
$background_style = '';
|
||||||
switch ($format_graph['background']) {
|
switch ($params['background']) {
|
||||||
default:
|
default:
|
||||||
case 'white':
|
case 'white':
|
||||||
$background_style = ' background: #fff; ';
|
$background_style = ' background: #fff; ';
|
||||||
@ -130,10 +129,10 @@ function flot_area_graph (
|
|||||||
|
|
||||||
///XXXXXXX los px caca
|
///XXXXXXX los px caca
|
||||||
// Parent layer
|
// Parent layer
|
||||||
$return = "<div class='parent_graph' style='width: " . ($format_graph['width']) . "; " . $background_style . "'>";
|
$return = "<div class='parent_graph' style='width: " . ($params['width']) . "; " . $background_style . "'>";
|
||||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $format_graph['font_size'] ."pt !important;'></p>";
|
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $params['font_size'] ."pt !important;'></p>";
|
||||||
if(!isset($show_elements_graph['combined']) || !$show_elements_graph['combined']){
|
if(!isset($params['combined']) || !$params['combined']){
|
||||||
$yellow_threshold = $data_module_graph['w_min'];
|
$yellow_threshold = $data_module_graph['w_min'];
|
||||||
$red_threshold = $data_module_graph['c_min'];
|
$red_threshold = $data_module_graph['c_min'];
|
||||||
// Get other required module datas to draw warning and critical
|
// Get other required module datas to draw warning and critical
|
||||||
@ -149,12 +148,12 @@ function flot_area_graph (
|
|||||||
$red_inverse = !($data_module_graph['c_inv'] == 0);
|
$red_inverse = !($data_module_graph['c_inv'] == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif(isset($show_elements_graph['from_interface']) && $show_elements_graph['from_interface']){
|
elseif(isset($params['from_interface']) && $params['from_interface']){
|
||||||
if( isset($show_elements_graph['threshold_data']) && is_array($show_elements_graph['threshold_data'])){
|
if( isset($params['threshold_data']) && is_array($params['threshold_data'])){
|
||||||
$yellow_up = $show_elements_graph['threshold_data']['yellow_up'];
|
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||||
$red_up = $show_elements_graph['threshold_data']['red_up'];
|
$red_up = $params['threshold_data']['red_up'];
|
||||||
$yellow_inverse = $show_elements_graph['threshold_data']['yellow_inverse'];
|
$yellow_inverse = $params['threshold_data']['yellow_inverse'];
|
||||||
$red_inverse = $show_elements_graph['threshold_data']['red_inverse'];
|
$red_inverse = $params['threshold_data']['red_inverse'];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$yellow_up = 0;
|
$yellow_up = 0;
|
||||||
@ -170,44 +169,44 @@ function flot_area_graph (
|
|||||||
$red_inverse = false;
|
$red_inverse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_elements_graph['menu']) {
|
if ($params['menu']) {
|
||||||
$return .= menu_graph(
|
$return .= menu_graph(
|
||||||
$yellow_threshold, $red_threshold,
|
$yellow_threshold, $red_threshold,
|
||||||
$yellow_up, $red_up, $yellow_inverse,
|
$yellow_up, $red_up, $yellow_inverse,
|
||||||
$red_inverse, $show_elements_graph['dashboard'],
|
$red_inverse, $params['dashboard'],
|
||||||
$show_elements_graph['vconsole'],
|
$params['vconsole'],
|
||||||
$graph_id, $format_graph['width'],
|
$graph_id, $params['width'],
|
||||||
$format_graph['homeurl']
|
$params['homeurl']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
||||||
$return .= "<div id='timestamp_$graph_id'
|
$return .= "<div id='timestamp_$graph_id'
|
||||||
class='timestamp_graph'
|
class='timestamp_graph'
|
||||||
style=' font-size:".$format_graph['font_size']."pt;
|
style=' font-size:".$params['font_size']."pt;
|
||||||
display:none; position:absolute;
|
display:none; position:absolute;
|
||||||
background:#fff; border: solid 1px #aaa;
|
background:#fff; border: solid 1px #aaa;
|
||||||
padding: 2px; z-index:1000;'></div>";
|
padding: 2px; z-index:1000;'></div>";
|
||||||
$return .= "<div id='$graph_id' class='";
|
$return .= "<div id='$graph_id' class='";
|
||||||
|
|
||||||
if($format_graph['type'] == 'area_simple'){
|
if($params['type'] == 'area_simple'){
|
||||||
$return .= "noresizevc ";
|
$return .= "noresizevc ";
|
||||||
}
|
}
|
||||||
//XXXXXX height: ".$format_graph['height']."px;'
|
//XXXXXX height: ".$params['height']."px;'
|
||||||
$return .= "graph" .$format_graph['adapt_key'] ."'
|
$return .= "graph" .$params['adapt_key'] ."'
|
||||||
style=' width: ".$format_graph['width']."px;
|
style=' width: ".$params['width']."px;
|
||||||
height: ".$format_graph['height']."px;'></div>";
|
height: ".$params['height']."px;'></div>";
|
||||||
|
|
||||||
if ($show_elements_graph['menu']) {
|
if ($params['menu']) {
|
||||||
$format_graph['height'] = 100;
|
$params['height'] = 100;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$format_graph['height'] = 1;
|
$params['height'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$vconsole){
|
if (!$vconsole){
|
||||||
$return .= "<div id='overview_$graph_id' class='overview_graph'
|
$return .= "<div id='overview_$graph_id' class='overview_graph'
|
||||||
style='margin:0px; margin-top:30px; margin-bottom:50px; display:none; width: ".$format_graph['width']."; height: 200px;'></div>";
|
style='margin:0px; margin-top:30px; margin-bottom:50px; display:none; width: ".$params['width']."; height: 200px;'></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXXXTODO
|
//XXXXTODO
|
||||||
@ -225,11 +224,11 @@ function flot_area_graph (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store data series in javascript format
|
// Store data series in javascript format
|
||||||
$extra_width = (int)($format_graph['width'] / 3);
|
$extra_width = (int)($params['width'] / 3);
|
||||||
$return .= "<div id='extra_$graph_id'
|
$return .= "<div id='extra_$graph_id'
|
||||||
style='font-size: " . $format_graph['font_size'] . "pt;
|
style='font-size: " . $params['font_size'] . "pt;
|
||||||
display:none; position:absolute; overflow: auto;
|
display:none; position:absolute; overflow: auto;
|
||||||
max-height: ".($format_graph['height']+50)."px;
|
max-height: ".($params['height']+50)."px;
|
||||||
width: ".$extra_width."px;
|
width: ".$extra_width."px;
|
||||||
background:#fff; padding: 2px 2px 2px 2px;
|
background:#fff; padding: 2px 2px 2px 2px;
|
||||||
border: solid #000 1px;'></div>";
|
border: solid #000 1px;'></div>";
|
||||||
@ -264,8 +263,7 @@ function flot_area_graph (
|
|||||||
$series_type = json_encode($series_type);
|
$series_type = json_encode($series_type);
|
||||||
$date_array = json_encode($date_array);
|
$date_array = json_encode($date_array);
|
||||||
$data_module_graph = json_encode($data_module_graph);
|
$data_module_graph = json_encode($data_module_graph);
|
||||||
$show_elements_graph = json_encode($show_elements_graph);
|
$params = json_encode($params);
|
||||||
$format_graph = json_encode($format_graph);
|
|
||||||
$array_events_alerts = json_encode($array_events_alerts);
|
$array_events_alerts = json_encode($array_events_alerts);
|
||||||
|
|
||||||
// Javascript code
|
// Javascript code
|
||||||
@ -281,8 +279,7 @@ function flot_area_graph (
|
|||||||
"'$watermark', \n" .
|
"'$watermark', \n" .
|
||||||
"JSON.parse('$date_array'), \n" .
|
"JSON.parse('$date_array'), \n" .
|
||||||
"JSON.parse('$data_module_graph'), \n" .
|
"JSON.parse('$data_module_graph'), \n" .
|
||||||
"JSON.parse('$show_elements_graph'), \n" .
|
"JSON.parse('$params'), \n" .
|
||||||
"JSON.parse('$format_graph'), \n" .
|
|
||||||
"$force_integer, \n" .
|
"$force_integer, \n" .
|
||||||
"'$series_suffix_str', \n" .
|
"'$series_suffix_str', \n" .
|
||||||
"'$background_color', \n" .
|
"'$background_color', \n" .
|
||||||
|
26
pandora_console/include/test.js
Normal file
26
pandora_console/include/test.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
var webPage = require('webpage');
|
||||||
|
var page = webPage.create();
|
||||||
|
var url = "http://nova/pandora_console/operation/agentes/stat_win.php?type=sparse&period=86400&id=136574&label=QXJ0aWNhJiN4MjA7d2ViJiN4MjA7cGFnZSYjeDIwO2V4YW1wbGU%3D&refresh=600&draw_events=0";
|
||||||
|
|
||||||
|
var r = page.addCookie({
|
||||||
|
'name' : 'PHPSESSID', /* required property */
|
||||||
|
'value' : '23qu7l1sgb3iq3bkaedr724hp3', /* required property */
|
||||||
|
'path' : '/pandora_console',
|
||||||
|
'domain' : 'nova',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(r);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
page.viewportSize = { width: 750, height: 350 };
|
||||||
|
page.open(url, function start(status) {
|
||||||
|
page.render('output.jpeg', {format: 'jpeg', quality: '100'});
|
||||||
|
phantom.exit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
34
pandora_console/include/web2image.js
Normal file
34
pandora_console/include/web2image.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
var system = require('system');
|
||||||
|
|
||||||
|
if (system.args.length < 2 || system.args.length > 6) {
|
||||||
|
//console.log('Usage web2image.js url url_parameters output_filename width height');
|
||||||
|
phantom.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var webPage = require('webpage');
|
||||||
|
var page = webPage.create();
|
||||||
|
var url = system.args[1];
|
||||||
|
var url_params = system.args[2];
|
||||||
|
var output_filename = system.args[3];
|
||||||
|
var _width = system.args[4];
|
||||||
|
var _height = system.args[5];
|
||||||
|
|
||||||
|
if (!_width) {
|
||||||
|
_width = 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_height) {
|
||||||
|
_height = 350;
|
||||||
|
}
|
||||||
|
|
||||||
|
page.viewportSize = { width: _width, height: _height };
|
||||||
|
|
||||||
|
//console.log("Pagina: " + url);
|
||||||
|
//console.log("parametros: " + url_params);
|
||||||
|
//console.log("Archivo salida: " + output_filename);
|
||||||
|
page.open(url + "?" + "data=" + url_params, function start(status) {
|
||||||
|
page.render(output_filename, {format: 'png'}); //, 'quality': 100});
|
||||||
|
phantom.exit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
@ -136,29 +136,26 @@ class ModuleGraph {
|
|||||||
switch ($this->graph_type) {
|
switch ($this->graph_type) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
case 'sparse':
|
case 'sparse':
|
||||||
$graph = grafico_modulo_sparse(
|
$params =array(
|
||||||
$this->id,
|
'agent_module_id' => $this->id,
|
||||||
$this->period,
|
'period' => $this->period,
|
||||||
$this->draw_events,
|
'show_events' => $this->draw_events,
|
||||||
$this->width,
|
'width' => $this->width,
|
||||||
$this->height,
|
'height' => $this->height,
|
||||||
false,
|
'show_alerts' => $this->draw_alerts,
|
||||||
null,
|
'avg_only' => $this->avg_only,
|
||||||
$this->draw_alerts,
|
'date' => $date,
|
||||||
$this->avg_only,
|
'unit' => $unit,
|
||||||
false,
|
'baseline' => $this->baseline,
|
||||||
$date,
|
'homeurl' => $urlImage,
|
||||||
$unit,
|
'adapt_key' => 'adapter_' . $this->graph_type,
|
||||||
$this->baseline,
|
'compare' => $time_compare,
|
||||||
0,
|
'show_unknown' => $this->unknown_graph,
|
||||||
true,
|
'menu' => false,
|
||||||
false,
|
'type_graph' => $config['type_module_charts']
|
||||||
$urlImage,
|
);
|
||||||
1,
|
|
||||||
false,
|
$graph = grafico_modulo_sparse($params);
|
||||||
'adapter_' . $this->graph_type,
|
|
||||||
$time_compare, $this->unknown_graph, false,
|
|
||||||
'white', null, false, false, $config['type_module_charts']);
|
|
||||||
if ($this->draw_events) {
|
if ($this->draw_events) {
|
||||||
$graph .= '<br>';
|
$graph .= '<br>';
|
||||||
$graph .= graphic_module_events($this->id,
|
$graph .= graphic_module_events($this->id,
|
||||||
|
@ -235,14 +235,27 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||||||
switch ($graph_type) {
|
switch ($graph_type) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
case 'sparse':
|
case 'sparse':
|
||||||
echo grafico_modulo_sparse ($id, $period, $draw_events,
|
$params =array(
|
||||||
$width, $height, $label_graph, $unit, $draw_alerts,
|
'agent_module_id' => $id,
|
||||||
$avg_only, false, $date, $unit, $baseline, 0, true,
|
'period' => $period,
|
||||||
false, $urlImage, 1, false,
|
'show_events' => $draw_events,
|
||||||
'adapter_' . $graph_type, $time_compare,
|
'title' => $label_graph,
|
||||||
$unknown_graph, true, 'white',
|
'unit_name' => $unit,
|
||||||
(($show_percentil)? $config['percentil'] : null),
|
'show_alerts' => $draw_alerts,
|
||||||
false, false, $config['type_module_charts'], $fullscale);
|
'avg_only' => $avg_only,
|
||||||
|
'date' => $date,
|
||||||
|
'unit' => $unit,
|
||||||
|
'baseline' => $baseline,
|
||||||
|
'homeurl' => $urlImage,
|
||||||
|
'adapt_key' => 'adapter_' . $graph_type,
|
||||||
|
'compare' => $time_compare,
|
||||||
|
'show_unknown' => $unknown_graph,
|
||||||
|
'percentil' => (($show_percentil)? $config['percentil'] : null),
|
||||||
|
'type_graph' => $config['type_module_charts'],
|
||||||
|
'fullscale' => $fullscale
|
||||||
|
);
|
||||||
|
|
||||||
|
echo grafico_modulo_sparse ($params);
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
if ($show_events_graph){
|
if ($show_events_graph){
|
||||||
$width = '500';
|
$width = '500';
|
||||||
|
@ -168,9 +168,23 @@ function main_intel_dcm_agent_view () {
|
|||||||
|
|
||||||
$module = modules_get_agentmodule_id (io_safe_input("Avg. Power"), $id_agent);
|
$module = modules_get_agentmodule_id (io_safe_input("Avg. Power"), $id_agent);
|
||||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||||
|
|
||||||
$data[1] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
$params_1 =array(
|
||||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
'agent_module_id' => $module['id_agente_modulo'],
|
||||||
|
'period' => 7200,
|
||||||
|
'show_events' => $draw_events,
|
||||||
|
'width' => 400,
|
||||||
|
'height' => 250,
|
||||||
|
'title' => $module['nombre'],
|
||||||
|
'unit_name' => null,
|
||||||
|
'show_alerts' => $draw_alerts,
|
||||||
|
'avg_only' => $avg_only,
|
||||||
|
'pure' => false,
|
||||||
|
'date' => $date,
|
||||||
|
'unit' => $unit
|
||||||
|
);
|
||||||
|
|
||||||
|
$data[1] = grafico_modulo_sparse($params_1);
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
@ -190,19 +204,44 @@ function main_intel_dcm_agent_view () {
|
|||||||
|
|
||||||
$module = modules_get_agentmodule_id (io_safe_input("Avg. Inlet Temperature"), $id_agent);
|
$module = modules_get_agentmodule_id (io_safe_input("Avg. Inlet Temperature"), $id_agent);
|
||||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||||
|
$params_2 =array(
|
||||||
$data[0] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
'agent_module_id' => $module['id_agente_modulo'],
|
||||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
'period' => 7200,
|
||||||
|
'show_events' => $draw_events,
|
||||||
|
'width' => 400,
|
||||||
|
'height' => 250,
|
||||||
|
'title' => $module['nombre'],
|
||||||
|
'unit_name' => null,
|
||||||
|
'show_alerts' => $draw_alerts,
|
||||||
|
'avg_only' => $avg_only,
|
||||||
|
'pure' => false,
|
||||||
|
'date' => $date,
|
||||||
|
'unit' => $unit
|
||||||
|
);
|
||||||
|
$data[0] = grafico_modulo_sparse($params_2);
|
||||||
|
|
||||||
$module = modules_get_agentmodule_id (io_safe_input("Calculated Cooling Power"), $id_agent);
|
$module = modules_get_agentmodule_id (io_safe_input("Calculated Cooling Power"), $id_agent);
|
||||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||||
|
|
||||||
$data[1] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
$params_3 =array(
|
||||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
'agent_module_id' => $module['id_agente_modulo'],
|
||||||
|
'period' => 7200,
|
||||||
|
'show_events' => $draw_events,
|
||||||
|
'width' => 400,
|
||||||
|
'height' => 250,
|
||||||
|
'title' => $module['nombre'],
|
||||||
|
'unit_name' => null,
|
||||||
|
'show_alerts' => $draw_alerts,
|
||||||
|
'avg_only' => $avg_only,
|
||||||
|
'pure' => false,
|
||||||
|
'date' => $date,
|
||||||
|
'unit' => $unit
|
||||||
|
);
|
||||||
|
|
||||||
|
$data[1] = grafico_modulo_sparse($params_3);
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
echo "<center>";
|
echo "<center>";
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo "</center>";
|
echo "</center>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user