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) {
|
||||
$return = array();
|
||||
|
||||
|
||||
$id_modules = (array)get_parameter('id_modules', array());
|
||||
$name = get_parameter('name', '');
|
||||
$description = get_parameter('description', '');
|
||||
|
@ -32,20 +32,19 @@ if ($save_custom_graph) {
|
|||
$events = get_parameter('events', 0);
|
||||
$period = get_parameter('period', 0);
|
||||
$fullscale = get_parameter('fullscale', 0);
|
||||
|
||||
|
||||
$result = (bool)custom_graphs_create($id_modules, $name,
|
||||
$description, $stacked, $width, $height, $events, $period, 0, 0, false, $fullscale);
|
||||
|
||||
|
||||
|
||||
$return['correct'] = $result;
|
||||
|
||||
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($print_custom_graph) {
|
||||
ob_clean();
|
||||
|
||||
|
||||
$id_graph = (int) get_parameter('id_graph');
|
||||
$height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT);
|
||||
$width = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
|
||||
|
@ -76,43 +75,41 @@ if ($print_custom_graph) {
|
|||
|
||||
if ($print_sparse_graph) {
|
||||
ob_clean();
|
||||
|
||||
$agent_module_id = (int) get_parameter('agent_module_id');
|
||||
$period = (int) get_parameter('period', SECONDS_5MINUTES);
|
||||
$show_events = (bool) get_parameter('show_events');
|
||||
$width = (int) get_parameter('width', CHART_DEFAULT_WIDTH);
|
||||
$height = (int) get_parameter('height', CHART_DEFAULT_HEIGHT);
|
||||
$title = (string) get_parameter('title');
|
||||
$unit_name = (string) get_parameter('unit_name');
|
||||
$show_alerts = (bool) get_parameter('show_alerts');
|
||||
$avg_only = (int) get_parameter('avg_only');
|
||||
$pure = (bool) get_parameter('pure');
|
||||
$date = (int) get_parameter('date', time());
|
||||
$unit = (string) get_parameter('unit');
|
||||
$baseline = (int) get_parameter('baseline');
|
||||
$return_data = (int) get_parameter('return_data');
|
||||
$show_title = (bool) get_parameter('show_title', true);
|
||||
$only_image = (bool) get_parameter('only_image');
|
||||
$homeurl = (string) get_parameter('homeurl');
|
||||
$ttl = (int) get_parameter('ttl', 1);
|
||||
$projection = (bool) get_parameter('projection');
|
||||
$adapt_key = (string) get_parameter('adapt_key');
|
||||
$compare = (bool) get_parameter('compare');
|
||||
$show_unknown = (bool) get_parameter('show_unknown');
|
||||
$menu = (bool) get_parameter('menu', true);
|
||||
$background_color = (string) get_parameter('background_color', 'white');
|
||||
$percentil = get_parameter('percentil', null);
|
||||
$dashboard = (bool) get_parameter('dashboard');
|
||||
$vconsole = (bool) get_parameter('vconsole');
|
||||
$type_g = get_parameter('type_g', $config['type_module_charts']);
|
||||
$fullscale = get_parameter('fullscale', 0);
|
||||
|
||||
echo grafico_modulo_sparse($agent_module_id, $period, $show_events,
|
||||
$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,
|
||||
$show_unknown, $menu, $backgroundColor, $percentil,
|
||||
$dashboard, $vconsole, $type_g, $fullscale);
|
||||
$params =array(
|
||||
'agent_module_id' => (int)get_parameter('agent_module_id'),
|
||||
'period' => (int) get_parameter('period', SECONDS_5MINUTES),
|
||||
'show_events' => (bool) get_parameter('show_events'),
|
||||
'title' => (string) get_parameter('title'),
|
||||
'unit_name' => (string) get_parameter('unit_name'),
|
||||
'show_alerts' => (bool) get_parameter('show_alerts'),
|
||||
'avg_only' => (int) get_parameter('avg_only'),
|
||||
'pure' => (bool) get_parameter('pure'),
|
||||
'date' => (int) get_parameter('date', time()),
|
||||
'unit' => (string) get_parameter('unit'),
|
||||
'baseline' => (int) get_parameter('baseline'),
|
||||
'return_data' => (int) get_parameter('return_data'),
|
||||
'show_title' => (bool) get_parameter('show_title', true),
|
||||
'only_image' => (bool) get_parameter('only_image'),
|
||||
'homeurl' => (string) get_parameter('homeurl'),
|
||||
'ttl' => (int) get_parameter('ttl', 1),
|
||||
'projection' => (bool) get_parameter('projection'),
|
||||
'adapt_key' => (string) get_parameter('adapt_key'),
|
||||
'compare' => (bool) get_parameter('compare'),
|
||||
'show_unknown' => (bool) get_parameter('show_unknown'),
|
||||
'menu' => (bool) get_parameter('menu', true),
|
||||
'backgroundColor' => (string) get_parameter('background_color', 'white'),
|
||||
'percentil' => get_parameter('percentil', null),
|
||||
'dashboard' => (bool) get_parameter('dashboard'),
|
||||
'vconsole' => (bool) get_parameter('vconsole'),
|
||||
'type_graph' => get_parameter('type_g', $config['type_module_charts']),
|
||||
'fullscale' => get_parameter('fullscale', 0),
|
||||
'id_widget_dashboard' => false,
|
||||
'force_interval' => '',
|
||||
'time_interval' => 300,
|
||||
'array_data_create' => 0
|
||||
);
|
||||
|
||||
echo grafico_modulo_sparse($params);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -124,7 +121,7 @@ if ($get_graphs){
|
|||
if (!empty($result_items)){
|
||||
$hash = get_parameter('hash',0);
|
||||
$period = get_parameter('time',0);
|
||||
|
||||
|
||||
$periods = array ();
|
||||
$periods[1] = __('none');
|
||||
$periods[SECONDS_1HOUR] = __('1 hour');
|
||||
|
@ -137,7 +134,7 @@ if ($get_graphs){
|
|||
$periods[SECONDS_1WEEK] = __('1 week');
|
||||
$periods[SECONDS_15DAYS] = __('15 days');
|
||||
$periods[SECONDS_1MONTH] = __('1 month');
|
||||
|
||||
|
||||
$table = '';
|
||||
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
|
||||
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
|
||||
|
@ -151,7 +148,7 @@ if ($get_graphs){
|
|||
$single_table .= "</td>";
|
||||
$single_table .= "</tr>";
|
||||
$single_table .= "</table>";
|
||||
|
||||
|
||||
$table .= $single_table;
|
||||
$contador = $config['max_graph_container'];
|
||||
foreach ($result_items as $key => $value) {
|
||||
|
@ -159,9 +156,9 @@ if ($get_graphs){
|
|||
if($period > 1){
|
||||
$value['time_lapse'] = $period;
|
||||
}
|
||||
|
||||
|
||||
$type_graph = ($value['type_graph'])? "line" : "area";
|
||||
|
||||
|
||||
switch ($value['type']) {
|
||||
case 'simple_graph':
|
||||
if ($contador > 0) {
|
||||
|
@ -170,36 +167,17 @@ if ($get_graphs){
|
|||
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente
|
||||
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 .= grafico_modulo_sparse(
|
||||
$value['id_agent_module'],
|
||||
$value['time_lapse'],
|
||||
0,
|
||||
1000,
|
||||
300,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$value['only_average'],
|
||||
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']);
|
||||
|
||||
$params =array(
|
||||
'agent_module_id' => $value['id_agent_module'],
|
||||
'period' => $value['time_lapse'],
|
||||
'avg_only' => $value['only_average'],
|
||||
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||
'type_graph' => $type_graph,
|
||||
'fullscale' => $value['fullscale']
|
||||
);
|
||||
|
||||
$table .= grafico_modulo_sparse($params);
|
||||
$contador --;
|
||||
}
|
||||
// $table .= "</br>";
|
||||
|
@ -207,7 +185,7 @@ if ($get_graphs){
|
|||
case 'custom_graph':
|
||||
if ($contador > 0) {
|
||||
$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']);
|
||||
$modules = array ();
|
||||
$weights = array ();
|
||||
|
@ -222,7 +200,7 @@ if ($get_graphs){
|
|||
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$homeurl = ui_get_full_url(false, false, false, false);
|
||||
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
|
||||
|
||||
|
@ -280,13 +258,13 @@ if ($get_graphs){
|
|||
} else {
|
||||
$id_group = " AND id_grupo = ".$value['id_group'];
|
||||
}
|
||||
|
||||
|
||||
if($value['id_module_group'] === '0'){
|
||||
$id_module_group = "";
|
||||
} else {
|
||||
$id_module_group = " AND id_module_group = ".$value['id_module_group'];
|
||||
}
|
||||
|
||||
|
||||
if($value['id_tag'] === '0'){
|
||||
$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 ";
|
||||
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
|
||||
}
|
||||
|
||||
|
||||
if($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 .
|
||||
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
|
||||
. $id_tag);
|
||||
|
||||
|
||||
foreach ($id_agent_module as $key2 => $value2) {
|
||||
if ($contador > 0) {
|
||||
$sql_modulo2 = db_get_all_rows_sql("SELECT nombre, id_agente FROM
|
||||
tagente_modulo WHERE id_agente_modulo = ". $value2['id_agente_modulo']);
|
||||
|
||||
|
||||
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
|
||||
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 .= grafico_modulo_sparse(
|
||||
$value2['id_agente_modulo'],
|
||||
$value['time_lapse'],
|
||||
0,
|
||||
1000,
|
||||
300,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$value['only_average'],
|
||||
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']);
|
||||
|
||||
$params =array(
|
||||
'agent_module_id' => $value2['id_agente_modulo'],
|
||||
'period' => $value['time_lapse'],
|
||||
'avg_only' => $value['only_average'],
|
||||
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||
'type_graph' => $type_graph,
|
||||
'fullscale' => $value['fullscale']
|
||||
);
|
||||
|
||||
$table .= grafico_modulo_sparse($params);
|
||||
$contador --;
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +311,6 @@ if ($get_graphs){
|
|||
$table .= "</br>";
|
||||
echo $table;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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){
|
||||
global $config;
|
||||
foreach ($data as $key => $value) {
|
||||
if(strpos($key, 'summatory') !== false){
|
||||
$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;
|
||||
if(isset($data) && is_array($data)){
|
||||
foreach ($data as $key => $value) {
|
||||
if(strpos($key, 'summatory') !== false){
|
||||
$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;
|
||||
}
|
||||
|
||||
if (isset($show_elements_graph['labels']) &&
|
||||
is_array($show_elements_graph['labels']) &&
|
||||
(count($show_elements_graph['labels']) > 0)){
|
||||
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['id_module_type']] . ' ' ;
|
||||
if (isset($show_elements_graph['labels']) &&
|
||||
is_array($show_elements_graph['labels']) &&
|
||||
(count($show_elements_graph['labels']) > 0)){
|
||||
$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{
|
||||
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;
|
||||
$data_return['series_type'][$key] = 'area';
|
||||
}
|
||||
}
|
||||
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{
|
||||
$data_return['series_type'][$key] = 'area';
|
||||
}
|
||||
return $data_return;
|
||||
}
|
||||
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,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$params,
|
||||
$series_suffix
|
||||
) {
|
||||
|
||||
|
@ -294,7 +293,7 @@ function grafico_modulo_sparse_data_chart (
|
|||
|
||||
foreach ($data as $k => $v) {
|
||||
//convert array
|
||||
if($show_elements_graph['flag_overlapped']){
|
||||
if($params['flag_overlapped']){
|
||||
$array_data["sum" . $series_suffix]['data'][$k] = array(
|
||||
($v['utimestamp'] + $date_array['period'] )* 1000,
|
||||
$v['datos']
|
||||
|
@ -322,7 +321,7 @@ function grafico_modulo_sparse_data_chart (
|
|||
$count_data++;
|
||||
|
||||
//percentil
|
||||
if (!is_null($show_elements_graph['percentil']) && $show_elements_graph['percentil']) {
|
||||
if (!is_null($params['percentil']) && $params['percentil']) {
|
||||
$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]['module_name'] = $data_module_graph['module_name'];
|
||||
|
||||
if (!is_null($show_elements_graph['percentil']) &&
|
||||
$show_elements_graph['percentil'] &&
|
||||
!$show_elements_graph['flag_overlapped']) {
|
||||
$percentil_result = get_percentile($show_elements_graph['percentil'], $array_percentil);
|
||||
if (!is_null($params['percentil']) &&
|
||||
$params['percentil'] &&
|
||||
!$params['flag_overlapped']) {
|
||||
$percentil_result = get_percentile($params['percentil'], $array_percentil);
|
||||
$array_data["percentil" . $series_suffix]['data'][0] = array(
|
||||
$date_array['start_date'] * 1000,
|
||||
$percentil_result
|
||||
|
@ -352,22 +351,21 @@ function grafico_modulo_sparse_data_chart (
|
|||
|
||||
function grafico_modulo_sparse_data(
|
||||
$agent_module_id, $date_array,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $exception_interval_graph,
|
||||
$data_module_graph, $params,
|
||||
$series_suffix, $str_series_suffix) {
|
||||
|
||||
global $config;
|
||||
global $array_events_alerts;
|
||||
|
||||
if($show_elements_graph['fullscale']){
|
||||
if($params['fullscale']){
|
||||
$array_data = fullscale_data(
|
||||
$agent_module_id,
|
||||
$date_array,
|
||||
$show_elements_graph['show_unknown'],
|
||||
$show_elements_graph['percentil'],
|
||||
$params['show_unknown'],
|
||||
$params['percentil'],
|
||||
$series_suffix,
|
||||
$str_series_suffix,
|
||||
$show_elements_graph['flag_overlapped']
|
||||
$params['flag_overlapped']
|
||||
);
|
||||
}
|
||||
else{
|
||||
|
@ -375,8 +373,7 @@ function grafico_modulo_sparse_data(
|
|||
$agent_module_id,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$params,
|
||||
$series_suffix
|
||||
);
|
||||
}
|
||||
|
@ -385,7 +382,71 @@ function grafico_modulo_sparse_data(
|
|||
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];
|
||||
}
|
||||
else{
|
||||
|
@ -399,9 +460,9 @@ function grafico_modulo_sparse_data(
|
|||
$avg = $array_data['sum'. $series_suffix]['avg'];
|
||||
}
|
||||
|
||||
if(!$show_elements_graph['flag_overlapped']){
|
||||
if($show_elements_graph['fullscale']){
|
||||
if( $show_elements_graph['show_unknown'] &&
|
||||
if(!$params['flag_overlapped']){
|
||||
if($params['fullscale']){
|
||||
if( $params['show_unknown'] &&
|
||||
isset($array_data['unknown' . $series_suffix]) &&
|
||||
is_array($array_data['unknown' . $series_suffix]['data']) ){
|
||||
foreach ($array_data['unknown' . $series_suffix]['data'] as $key => $s_date) {
|
||||
|
@ -412,7 +473,7 @@ function grafico_modulo_sparse_data(
|
|||
}
|
||||
}
|
||||
else{
|
||||
if( $show_elements_graph['show_unknown'] ) {
|
||||
if( $params['show_unknown'] ) {
|
||||
$unknown_events = db_get_module_ranges_unknown(
|
||||
$agent_module_id,
|
||||
$date_array['start_date'],
|
||||
|
@ -463,8 +524,8 @@ function grafico_modulo_sparse_data(
|
|||
}
|
||||
}
|
||||
|
||||
if ($show_elements_graph['show_events'] ||
|
||||
$show_elements_graph['show_alerts'] ) {
|
||||
if ($params['show_events'] ||
|
||||
$params['show_alerts'] ) {
|
||||
|
||||
$events = db_get_all_rows_filter (
|
||||
'tevento',
|
||||
|
@ -486,7 +547,7 @@ function grafico_modulo_sparse_data(
|
|||
$count_alerts=0;
|
||||
foreach ($events as $k => $v) {
|
||||
if (strpos($v["event_type"], "alert") !== false){
|
||||
if($show_elements_graph['flag_overlapped']){
|
||||
if($params['flag_overlapped']){
|
||||
$alerts_array['data'][$count_alerts] = array(
|
||||
($v['utimestamp'] + $date_array['period'] *1000),
|
||||
$max * 1.10
|
||||
|
@ -501,7 +562,7 @@ function grafico_modulo_sparse_data(
|
|||
$count_alerts++;
|
||||
}
|
||||
else{
|
||||
if($show_elements_graph['flag_overlapped']){
|
||||
if($params['flag_overlapped']){
|
||||
if( ( strstr($v['event_type'], 'going_up') ) ||
|
||||
( strstr($v['event_type'], 'going_down') ) ){
|
||||
$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;
|
||||
}
|
||||
|
||||
if($show_elements_graph['show_alerts']){
|
||||
if($params['show_alerts']){
|
||||
$array_data['alert' . $series_suffix] = $alerts_array;
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_elements_graph['return_data'] == 1) {
|
||||
if ($params['return_data'] == 1) {
|
||||
return $array_data;
|
||||
}
|
||||
|
||||
$color = color_graph_array(
|
||||
$series_suffix,
|
||||
$show_elements_graph['flag_overlapped']
|
||||
$params['flag_overlapped']
|
||||
);
|
||||
|
||||
foreach ($color as $k => $v) {
|
||||
|
@ -566,36 +627,215 @@ function grafico_modulo_sparse_data(
|
|||
return $array_data;
|
||||
}
|
||||
|
||||
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
$width, $height , $title = '', $unit_name = null,
|
||||
$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 = 0,$time_interval = 300,
|
||||
$max_only = 0, $min_only = 0, $array_data_create = 0) {
|
||||
|
||||
/*
|
||||
$params =array(
|
||||
'agent_module_id' => $agent_module_id,
|
||||
'period' => $period,
|
||||
'show_events' => false,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => '',
|
||||
'unit_name' => null,
|
||||
'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;
|
||||
|
||||
/*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 $array_events_alerts;
|
||||
|
||||
|
||||
$array_data = array();
|
||||
$legend = array();
|
||||
$array_events_alerts = array();
|
||||
|
||||
//date start final period
|
||||
if($date == 0){
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
||||
$date_array = array();
|
||||
$date_array["period"] = $period;
|
||||
$date_array["final_date"] = $date;
|
||||
$date_array["start_date"] = $date - $period;
|
||||
$date_array["period"] = $params['period'];
|
||||
$date_array["final_date"] = $params['date'];
|
||||
$date_array["start_date"] = $params['date'] - $params['period'];
|
||||
|
||||
$module_data = db_get_row_sql (
|
||||
'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_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
|
||||
if (empty($unit)) {
|
||||
$unit = $module_data['unit'];
|
||||
if(modules_is_unit_macro($unit)){
|
||||
$unit = "";
|
||||
if (empty($params['unit'])) {
|
||||
$params['unit'] = $module_data['unit'];
|
||||
if(modules_is_unit_macro($params['unit'])){
|
||||
$params['unit'] = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 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 ($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) {
|
||||
if(!$params['array_data_create']){
|
||||
if ($params['compare'] !== false) {
|
||||
$series_suffix = 2;
|
||||
$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['period'] = $date_array['period'];
|
||||
|
||||
if ($show_elements_graph['compare'] === 'overlapped') {
|
||||
$show_elements_graph['flag_overlapped'] = 1;
|
||||
if ($params['compare'] === 'overlapped') {
|
||||
$params['flag_overlapped'] = 1;
|
||||
}
|
||||
else{
|
||||
$show_elements_graph['flag_overlapped'] = 0;
|
||||
$params['flag_overlapped'] = 0;
|
||||
}
|
||||
|
||||
$array_data = grafico_modulo_sparse_data(
|
||||
$agent_module_id, $date_array_prev,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $exception_interval_graph,
|
||||
$data_module_graph, $params,
|
||||
$series_suffix, $series_suffix_str
|
||||
);
|
||||
|
||||
switch ($show_elements_graph['compare']) {
|
||||
switch ($params['compare']) {
|
||||
case 'separated':
|
||||
case 'overlapped':
|
||||
// Store the chart calculated
|
||||
|
@ -717,27 +900,26 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
|
||||
$series_suffix = 1;
|
||||
$series_suffix_str = '';
|
||||
$show_elements_graph['flag_overlapped'] = 0;
|
||||
$params['flag_overlapped'] = 0;
|
||||
|
||||
$array_data = grafico_modulo_sparse_data(
|
||||
$agent_module_id, $date_array,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $exception_interval_graph,
|
||||
$data_module_graph, $params,
|
||||
$series_suffix, $str_series_suffix
|
||||
);
|
||||
|
||||
if($show_elements_graph['compare']){
|
||||
if ($show_elements_graph['compare'] === 'overlapped') {
|
||||
if($params['compare']){
|
||||
if ($params['compare'] === 'overlapped') {
|
||||
$array_data = array_merge($array_data, $array_data_prev);
|
||||
$legend = array_merge($legend, $legend_prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -755,7 +937,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
|
||||
$series_type_array = series_type_graph_array(
|
||||
$array_data,
|
||||
$show_elements_graph
|
||||
$params
|
||||
);
|
||||
|
||||
$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;
|
||||
|
||||
// Check available data
|
||||
if ($show_elements_graph['compare'] === 'separated') {
|
||||
if ($params['compare'] === 'separated') {
|
||||
if (!empty($array_data)) {
|
||||
$return = area_graph(
|
||||
$agent_module_id,
|
||||
|
@ -776,22 +958,21 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$series_type,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$params,
|
||||
$water_mark,
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
$return = graph_nodata_image($width, $height);
|
||||
$return = graph_nodata_image($params['width'], $params['height']);
|
||||
}
|
||||
$return .= '<br>';
|
||||
if (!empty($array_data_prev)) {
|
||||
|
||||
$series_type_array = series_type_graph_array(
|
||||
$array_data_prev,
|
||||
$show_elements_graph
|
||||
$params
|
||||
);
|
||||
|
||||
$series_type = $series_type_array['series_type'];
|
||||
|
@ -804,15 +985,14 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$series_type,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$params,
|
||||
$water_mark,
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
$return .= graph_nodata_image($width, $height);
|
||||
$return .= graph_nodata_image($params['width'], $params['height']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
@ -824,21 +1004,22 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$series_type,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$params,
|
||||
$water_mark,
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
$return = graph_nodata_image($width, $height);
|
||||
$return = graph_nodata_image($params['width'], $params['height']);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function graph_get_formatted_date($timestamp, $format1, $format2) {
|
||||
global $config;
|
||||
|
||||
|
@ -950,43 +1131,33 @@ function graphic_combined_module (
|
|||
$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'] = false; // dont use
|
||||
$show_elements_graph['avg_only'] = false; // dont use
|
||||
$show_elements_graph['fullscale'] = $fullscale;
|
||||
$show_elements_graph['show_title'] = ''; // dont use
|
||||
$show_elements_graph['menu'] = $menu; // dont use
|
||||
$show_elements_graph['adapt_key'] = ''; // dont use
|
||||
$show_elements_graph['percentil'] = $percentil;
|
||||
$show_elements_graph['projection'] = $projection;
|
||||
$show_elements_graph['compare'] = false; //dont use
|
||||
$show_elements_graph['dashboard'] = $dashboard;
|
||||
$show_elements_graph['vconsole'] = $vconsole;
|
||||
$show_elements_graph['pure'] = $pure;
|
||||
$show_elements_graph['baseline'] = false; //dont use
|
||||
$show_elements_graph['only_image'] = $only_image;
|
||||
$show_elements_graph['return_data'] = false; //dont use
|
||||
$show_elements_graph['id_widget'] = $id_widget_dashboard;
|
||||
$show_elements_graph['labels'] = $labels;
|
||||
$show_elements_graph['stacked'] = $stacked;
|
||||
$show_elements_graph['combined'] = true;
|
||||
$show_elements_graph['from_interface'] = $from_interface;
|
||||
|
||||
$format_graph = array();
|
||||
$format_graph['width'] = "90%";
|
||||
$format_graph['height'] = "450";
|
||||
$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'];
|
||||
|
||||
$params = array();
|
||||
$params['show_events'] = $show_events;
|
||||
$params['show_alerts'] = $show_alerts;
|
||||
$params['show_unknown'] = false; // dont use
|
||||
$params['avg_only'] = false; // dont use
|
||||
$params['fullscale'] = $fullscale;
|
||||
$params['show_title'] = ''; // dont use
|
||||
$params['menu'] = $menu; // dont use
|
||||
$params['adapt_key'] = ''; // dont use
|
||||
$params['percentil'] = $percentil;
|
||||
$params['projection'] = $projection;
|
||||
$params['compare'] = false; //dont use
|
||||
$params['dashboard'] = $dashboard;
|
||||
$params['vconsole'] = $vconsole;
|
||||
$params['pure'] = $pure;
|
||||
$params['baseline'] = false; //dont use
|
||||
$params['only_image'] = $only_image;
|
||||
$params['return_data'] = false; //dont use
|
||||
$params['id_widget'] = $id_widget_dashboard;
|
||||
$params['labels'] = $labels;
|
||||
$params['stacked'] = $stacked;
|
||||
$params['combined'] = true;
|
||||
$params['from_interface'] = $from_interface;
|
||||
$params['font'] = $config['fontpath'];
|
||||
$params['font-size'] = $config['font_size'];
|
||||
$params['width'] ='90%';
|
||||
$params['height'] = $height;
|
||||
//for flash_charts
|
||||
$user = users_get_user_by_id($config['id_user']);
|
||||
$user_flash_charts = $user['flash_chart'];
|
||||
|
@ -1032,9 +1203,7 @@ function graphic_combined_module (
|
|||
$agent_module_id,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
array(),
|
||||
$param,
|
||||
$i,
|
||||
$data_module_graph['agent_name']
|
||||
);
|
||||
|
@ -1581,9 +1750,8 @@ function graphic_combined_module (
|
|||
case CUSTOM_GRAPH_AREA:
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return 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,
|
||||
$legend, $series_type, $date_array, $data_module_graph,
|
||||
$params, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts);
|
||||
break;
|
||||
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,
|
||||
$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(
|
||||
'reporting_enterprise_get_baseline',
|
||||
array (
|
||||
|
@ -3535,43 +3523,17 @@ function reporting_simple_baseline_graph($report, $content,
|
|||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
$return['chart'] = grafico_modulo_sparse (
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
false,
|
||||
$width,
|
||||
$height,
|
||||
'',
|
||||
null,
|
||||
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
|
||||
$params =array(
|
||||
'agent_module_id' => $content['id_agent_module'],
|
||||
'period' => $content['period'],
|
||||
'date' => $report["datetime"],
|
||||
'only_image' => $only_image,
|
||||
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||
'ttl' => $ttl,
|
||||
'array_data_create' => $baseline_data
|
||||
);
|
||||
|
||||
$return['chart'] = grafico_modulo_sparse ($params);
|
||||
break;
|
||||
case 'data':
|
||||
break;
|
||||
|
@ -3934,7 +3896,6 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
switch ($type) {
|
||||
case 'max':
|
||||
if($content['lapse_calc'] == 0){
|
||||
|
||||
$value = reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
|
@ -3943,17 +3904,27 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
|
||||
}
|
||||
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 = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
|
@ -3979,62 +3950,28 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .=
|
||||
grafico_modulo_sparse(
|
||||
$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);
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
|
@ -4048,11 +3985,11 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
|
||||
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>';
|
||||
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$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{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
|
||||
$formated_value = $value;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'min':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_min(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
|
||||
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
|
@ -4123,57 +4058,21 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .=
|
||||
grafico_modulo_sparse(
|
||||
$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);
|
||||
$params['force_interval'] = 'min_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
@ -4239,7 +4138,6 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
<td width="400px;" height="20%;">';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
|
@ -4275,41 +4173,8 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
<td rowspan="2">';
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .=
|
||||
grafico_modulo_sparse(
|
||||
$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']
|
||||
);
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
@ -6635,6 +6500,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
case 'static':
|
||||
if (preg_match ("/string/", $moduletype_name)) {
|
||||
$urlImage = ui_get_full_url(false, false, false, false);
|
||||
/*
|
||||
$return['chart'] = grafico_modulo_string(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
|
@ -6651,6 +6517,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
$urlImage,
|
||||
"",
|
||||
$ttl);
|
||||
*/
|
||||
$return['chart'] = 'arreglar la grafica de string de una vez por todassssssssss';
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -6660,36 +6528,23 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
$time_compare_overlapped = 'overlapped';
|
||||
}
|
||||
|
||||
$return['chart'] = grafico_modulo_sparse(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
false,
|
||||
'90%',
|
||||
400,
|
||||
$label,
|
||||
'',
|
||||
false,
|
||||
$only_avg,
|
||||
true,
|
||||
$report["datetime"],
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
$only_image,
|
||||
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);
|
||||
$params =array(
|
||||
'agent_module_id' => $content['id_agent_module'],
|
||||
'period' => $content['period'],
|
||||
'title' => $label,
|
||||
'avg_only' => $only_avg,
|
||||
'pure' => false, //XXX
|
||||
'date' => $report["datetime"],
|
||||
'only_image' => $only_image,
|
||||
'homeurl' => ui_get_full_url(false, false, false, false),
|
||||
'ttl' => $ttl,
|
||||
'compare' => $time_compare_overlapped,
|
||||
'show_unknown' => true,
|
||||
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
||||
'fullscale' => $fullscale
|
||||
);
|
||||
|
||||
$return['chart'] = grafico_modulo_sparse($params);
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
|
@ -6708,7 +6563,6 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,61 +223,25 @@ function vbar_graph(
|
|||
function 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,
|
||||
$data_module_graph, $params, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts
|
||||
) {
|
||||
global $config;
|
||||
|
||||
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();
|
||||
$graph['data'] = $array_data;
|
||||
$graph['width'] = 900;
|
||||
$graph['height'] = 400;
|
||||
// $graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = 'me la pela';
|
||||
$graph['yaxisname'] = 'borja es gay';
|
||||
// $graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $format_graph['font'];
|
||||
$graph['font_size'] = $format_graph['font_size'];
|
||||
$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 . "'>";
|
||||
}
|
||||
return flot_area_graph(
|
||||
$agent_module_id,
|
||||
$array_data,
|
||||
$legend,
|
||||
$series_type,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$params,
|
||||
$water_mark,
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
graph_id, values, legend, agent_module_id,
|
||||
series_type, watermark, date_array,
|
||||
data_module_graph, show_elements_graph,
|
||||
format_graph, force_integer, series_suffix_str,
|
||||
data_module_graph, params,
|
||||
force_integer, series_suffix_str,
|
||||
background_color, legend_color, short_data,
|
||||
events_array
|
||||
) {
|
||||
|
||||
//diferents vars
|
||||
var unit = format_graph.unit ? format_graph.unit : '';
|
||||
var homeurl = format_graph.homeurl;
|
||||
var font_size = format_graph.font_size;
|
||||
var font = format_graph.font;
|
||||
var width = format_graph.width;
|
||||
var height = format_graph.height;
|
||||
var vconsole = show_elements_graph.vconsole;
|
||||
var dashboard = show_elements_graph.dashboard;
|
||||
var menu = show_elements_graph.menu;
|
||||
var unit = params.unit ? params.unit : '';
|
||||
var homeurl = params.homeurl;
|
||||
var font_size = params.font_size;
|
||||
var font = params.font;
|
||||
var width = params.width;
|
||||
var height = params.height;
|
||||
var vconsole = params.vconsole;
|
||||
var dashboard = params.dashboard;
|
||||
var menu = params.menu;
|
||||
var min_x = date_array['start_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 == ''){
|
||||
type = format_graph.type_graph;
|
||||
type = params.type_graph;
|
||||
}
|
||||
|
||||
//for threshold
|
||||
|
@ -2125,7 +2125,7 @@ console.log(legend);
|
|||
|
||||
// Get only two decimals
|
||||
//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>';
|
||||
}
|
||||
|
||||
|
|
|
@ -103,8 +103,7 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||
function 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,
|
||||
$data_module_graph, $params, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts ) {
|
||||
|
||||
global $config;
|
||||
|
@ -115,7 +114,7 @@ function flot_area_graph (
|
|||
$graph_id = uniqid('graph_');
|
||||
|
||||
$background_style = '';
|
||||
switch ($format_graph['background']) {
|
||||
switch ($params['background']) {
|
||||
default:
|
||||
case 'white':
|
||||
$background_style = ' background: #fff; ';
|
||||
|
@ -130,10 +129,10 @@ function flot_area_graph (
|
|||
|
||||
///XXXXXXX los px caca
|
||||
// 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.
|
||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $format_graph['font_size'] ."pt !important;'></p>";
|
||||
if(!isset($show_elements_graph['combined']) || !$show_elements_graph['combined']){
|
||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $params['font_size'] ."pt !important;'></p>";
|
||||
if(!isset($params['combined']) || !$params['combined']){
|
||||
$yellow_threshold = $data_module_graph['w_min'];
|
||||
$red_threshold = $data_module_graph['c_min'];
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
elseif(isset($show_elements_graph['from_interface']) && $show_elements_graph['from_interface']){
|
||||
if( isset($show_elements_graph['threshold_data']) && is_array($show_elements_graph['threshold_data'])){
|
||||
$yellow_up = $show_elements_graph['threshold_data']['yellow_up'];
|
||||
$red_up = $show_elements_graph['threshold_data']['red_up'];
|
||||
$yellow_inverse = $show_elements_graph['threshold_data']['yellow_inverse'];
|
||||
$red_inverse = $show_elements_graph['threshold_data']['red_inverse'];
|
||||
elseif(isset($params['from_interface']) && $params['from_interface']){
|
||||
if( isset($params['threshold_data']) && is_array($params['threshold_data'])){
|
||||
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||
$red_up = $params['threshold_data']['red_up'];
|
||||
$yellow_inverse = $params['threshold_data']['yellow_inverse'];
|
||||
$red_inverse = $params['threshold_data']['red_inverse'];
|
||||
}
|
||||
else{
|
||||
$yellow_up = 0;
|
||||
|
@ -170,44 +169,44 @@ function flot_area_graph (
|
|||
$red_inverse = false;
|
||||
}
|
||||
|
||||
if ($show_elements_graph['menu']) {
|
||||
if ($params['menu']) {
|
||||
$return .= menu_graph(
|
||||
$yellow_threshold, $red_threshold,
|
||||
$yellow_up, $red_up, $yellow_inverse,
|
||||
$red_inverse, $show_elements_graph['dashboard'],
|
||||
$show_elements_graph['vconsole'],
|
||||
$graph_id, $format_graph['width'],
|
||||
$format_graph['homeurl']
|
||||
$red_inverse, $params['dashboard'],
|
||||
$params['vconsole'],
|
||||
$graph_id, $params['width'],
|
||||
$params['homeurl']
|
||||
);
|
||||
}
|
||||
|
||||
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
||||
$return .= "<div id='timestamp_$graph_id'
|
||||
class='timestamp_graph'
|
||||
style=' font-size:".$format_graph['font_size']."pt;
|
||||
style=' font-size:".$params['font_size']."pt;
|
||||
display:none; position:absolute;
|
||||
background:#fff; border: solid 1px #aaa;
|
||||
padding: 2px; z-index:1000;'></div>";
|
||||
$return .= "<div id='$graph_id' class='";
|
||||
|
||||
if($format_graph['type'] == 'area_simple'){
|
||||
if($params['type'] == 'area_simple'){
|
||||
$return .= "noresizevc ";
|
||||
}
|
||||
//XXXXXX height: ".$format_graph['height']."px;'
|
||||
$return .= "graph" .$format_graph['adapt_key'] ."'
|
||||
style=' width: ".$format_graph['width']."px;
|
||||
height: ".$format_graph['height']."px;'></div>";
|
||||
//XXXXXX height: ".$params['height']."px;'
|
||||
$return .= "graph" .$params['adapt_key'] ."'
|
||||
style=' width: ".$params['width']."px;
|
||||
height: ".$params['height']."px;'></div>";
|
||||
|
||||
if ($show_elements_graph['menu']) {
|
||||
$format_graph['height'] = 100;
|
||||
if ($params['menu']) {
|
||||
$params['height'] = 100;
|
||||
}
|
||||
else {
|
||||
$format_graph['height'] = 1;
|
||||
$params['height'] = 1;
|
||||
}
|
||||
|
||||
if (!$vconsole){
|
||||
$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
|
||||
|
@ -225,11 +224,11 @@ function flot_area_graph (
|
|||
}
|
||||
|
||||
// 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'
|
||||
style='font-size: " . $format_graph['font_size'] . "pt;
|
||||
style='font-size: " . $params['font_size'] . "pt;
|
||||
display:none; position:absolute; overflow: auto;
|
||||
max-height: ".($format_graph['height']+50)."px;
|
||||
max-height: ".($params['height']+50)."px;
|
||||
width: ".$extra_width."px;
|
||||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
|
@ -264,8 +263,7 @@ function flot_area_graph (
|
|||
$series_type = json_encode($series_type);
|
||||
$date_array = json_encode($date_array);
|
||||
$data_module_graph = json_encode($data_module_graph);
|
||||
$show_elements_graph = json_encode($show_elements_graph);
|
||||
$format_graph = json_encode($format_graph);
|
||||
$params = json_encode($params);
|
||||
$array_events_alerts = json_encode($array_events_alerts);
|
||||
|
||||
// Javascript code
|
||||
|
@ -281,8 +279,7 @@ function flot_area_graph (
|
|||
"'$watermark', \n" .
|
||||
"JSON.parse('$date_array'), \n" .
|
||||
"JSON.parse('$data_module_graph'), \n" .
|
||||
"JSON.parse('$show_elements_graph'), \n" .
|
||||
"JSON.parse('$format_graph'), \n" .
|
||||
"JSON.parse('$params'), \n" .
|
||||
"$force_integer, \n" .
|
||||
"'$series_suffix_str', \n" .
|
||||
"'$background_color', \n" .
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
@ -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) {
|
||||
case 'boolean':
|
||||
case 'sparse':
|
||||
$graph = grafico_modulo_sparse(
|
||||
$this->id,
|
||||
$this->period,
|
||||
$this->draw_events,
|
||||
$this->width,
|
||||
$this->height,
|
||||
false,
|
||||
null,
|
||||
$this->draw_alerts,
|
||||
$this->avg_only,
|
||||
false,
|
||||
$date,
|
||||
$unit,
|
||||
$this->baseline,
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
$urlImage,
|
||||
1,
|
||||
false,
|
||||
'adapter_' . $this->graph_type,
|
||||
$time_compare, $this->unknown_graph, false,
|
||||
'white', null, false, false, $config['type_module_charts']);
|
||||
$params =array(
|
||||
'agent_module_id' => $this->id,
|
||||
'period' => $this->period,
|
||||
'show_events' => $this->draw_events,
|
||||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
'show_alerts' => $this->draw_alerts,
|
||||
'avg_only' => $this->avg_only,
|
||||
'date' => $date,
|
||||
'unit' => $unit,
|
||||
'baseline' => $this->baseline,
|
||||
'homeurl' => $urlImage,
|
||||
'adapt_key' => 'adapter_' . $this->graph_type,
|
||||
'compare' => $time_compare,
|
||||
'show_unknown' => $this->unknown_graph,
|
||||
'menu' => false,
|
||||
'type_graph' => $config['type_module_charts']
|
||||
);
|
||||
|
||||
$graph = grafico_modulo_sparse($params);
|
||||
if ($this->draw_events) {
|
||||
$graph .= '<br>';
|
||||
$graph .= graphic_module_events($this->id,
|
||||
|
|
|
@ -235,14 +235,27 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||
switch ($graph_type) {
|
||||
case 'boolean':
|
||||
case 'sparse':
|
||||
echo grafico_modulo_sparse ($id, $period, $draw_events,
|
||||
$width, $height, $label_graph, $unit, $draw_alerts,
|
||||
$avg_only, false, $date, $unit, $baseline, 0, true,
|
||||
false, $urlImage, 1, false,
|
||||
'adapter_' . $graph_type, $time_compare,
|
||||
$unknown_graph, true, 'white',
|
||||
(($show_percentil)? $config['percentil'] : null),
|
||||
false, false, $config['type_module_charts'], $fullscale);
|
||||
$params =array(
|
||||
'agent_module_id' => $id,
|
||||
'period' => $period,
|
||||
'show_events' => $draw_events,
|
||||
'title' => $label_graph,
|
||||
'unit_name' => $unit,
|
||||
'show_alerts' => $draw_alerts,
|
||||
'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>';
|
||||
if ($show_events_graph){
|
||||
$width = '500';
|
||||
|
|
|
@ -168,9 +168,23 @@ function main_intel_dcm_agent_view () {
|
|||
|
||||
$module = modules_get_agentmodule_id (io_safe_input("Avg. Power"), $id_agent);
|
||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||
|
||||
$data[1] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
||||
|
||||
$params_1 =array(
|
||||
'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);
|
||||
|
||||
|
@ -190,19 +204,44 @@ function main_intel_dcm_agent_view () {
|
|||
|
||||
$module = modules_get_agentmodule_id (io_safe_input("Avg. Inlet Temperature"), $id_agent);
|
||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||
|
||||
$data[0] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
||||
|
||||
$params_2 =array(
|
||||
'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[0] = grafico_modulo_sparse($params_2);
|
||||
|
||||
$module = modules_get_agentmodule_id (io_safe_input("Calculated Cooling Power"), $id_agent);
|
||||
$unit = modules_get_unit ($module['id_agente_modulo']);
|
||||
|
||||
$data[1] = grafico_modulo_sparse($module['id_agente_modulo'], 7200, $draw_events, 400, 250,
|
||||
$module['nombre'], null, $draw_alerts, $avg_only, false, $date, $unit);
|
||||
|
||||
|
||||
$params_3 =array(
|
||||
'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);
|
||||
|
||||
|
||||
echo "<center>";
|
||||
html_print_table($table);
|
||||
echo "</center>";
|
||||
|
|
Loading…
Reference in New Issue