2018-05-28 17:47:40 +02:00
|
|
|
<?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.
|
|
|
|
|
|
|
|
// Global & session manageme
|
2018-06-14 16:47:23 +02:00
|
|
|
|
2018-11-21 13:08:58 +01:00
|
|
|
session_id($_REQUEST["session_id"]);
|
2018-06-20 11:31:43 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
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');
|
|
|
|
|
2018-06-08 08:58:18 +02:00
|
|
|
check_login();
|
|
|
|
|
|
|
|
global $config;
|
2018-06-20 11:31:43 +02:00
|
|
|
//get_parameter(array)('data', '');
|
2018-05-28 17:47:40 +02:00
|
|
|
|
2018-06-19 19:07:36 +02:00
|
|
|
$params = json_decode($_REQUEST['data'], true);
|
2018-06-20 11:31:43 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
// Metaconsole connection to the node
|
2018-06-14 19:19:58 +02:00
|
|
|
$server_id = $params['server_id'];
|
2018-05-28 17:47:40 +02:00
|
|
|
|
|
|
|
if ($config["metaconsole"] && !empty($server_id)) {
|
2018-06-20 11:31:43 +02:00
|
|
|
$server = metaconsole_get_connection_by_id($server_id);
|
2018-05-28 17:47:40 +02:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|
2018-06-14 19:19:58 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
|
|
|
|
$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();
|
|
|
|
}
|
2018-06-08 08:58:18 +02:00
|
|
|
|
2018-05-28 17:47:40 +02:00
|
|
|
?>
|
|
|
|
<!DOCTYPE>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
2018-06-20 11:31:43 +02:00
|
|
|
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
|
2018-12-27 10:35:31 +01:00
|
|
|
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
2018-05-28 17:47:40 +02:00
|
|
|
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
2018-11-07 17:09:42 +01:00
|
|
|
<link rel="stylesheet" href="styles/jquery-ui.min.css" type="text/css" />
|
2018-06-06 11:18:39 +02:00
|
|
|
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
2018-11-07 13:28:00 +01:00
|
|
|
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
2018-05-28 17:47:40 +02:00
|
|
|
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
|
2018-11-07 17:09:42 +01:00
|
|
|
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
|
2018-05-28 17:47:40 +02:00
|
|
|
<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;'>
|
2018-12-12 10:46:28 +01:00
|
|
|
<?php
|
|
|
|
$params['only_image'] = false;
|
2018-06-19 19:19:38 +02:00
|
|
|
$params['width'] = (int) $_REQUEST['viewport_width'];
|
2018-06-06 11:18:39 +02:00
|
|
|
$params['menu'] = false;
|
2018-05-28 17:47:40 +02:00
|
|
|
|
2018-06-20 11:31:43 +02:00
|
|
|
if((!isset($params['width']) || ($params['width'] <= 0))) {
|
2018-06-19 19:19:38 +02:00
|
|
|
$params['width'] = 1048;
|
|
|
|
}
|
|
|
|
|
2018-06-19 19:07:36 +02:00
|
|
|
$params_combined = json_decode($_REQUEST['data_combined'], true);
|
|
|
|
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
|
|
|
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
2018-06-01 13:58:29 +02:00
|
|
|
|
2018-06-20 11:31:43 +02:00
|
|
|
$aux_font_size = $config['font_size'];
|
|
|
|
$config['font_size'] = $config['font_size'] + 3;
|
|
|
|
|
2018-10-16 15:32:31 +02:00
|
|
|
echo '<div>';
|
|
|
|
switch ($type_graph_pdf) {
|
|
|
|
case 'combined':
|
2018-06-01 13:58:29 +02:00
|
|
|
echo graphic_combined_module(
|
|
|
|
$module_list,
|
|
|
|
$params,
|
|
|
|
$params_combined
|
|
|
|
);
|
2018-10-16 15:32:31 +02:00
|
|
|
break;
|
|
|
|
case 'sparse':
|
2018-06-06 17:23:32 +02:00
|
|
|
echo grafico_modulo_sparse($params);
|
2018-10-16 15:32:31 +02:00
|
|
|
break;
|
|
|
|
case 'pie_chart':
|
2018-10-11 12:57:48 +02:00
|
|
|
echo flot_pie_chart(
|
|
|
|
$params['values'],
|
|
|
|
$params['keys'],
|
|
|
|
$params['width'],
|
|
|
|
$params['height'],
|
|
|
|
$params['water_mark_url'],
|
|
|
|
$params['font'],
|
2018-11-27 17:43:59 +01:00
|
|
|
$config['font_size'],
|
2018-10-11 12:57:48 +02:00
|
|
|
$params['legend_position'],
|
|
|
|
$params['colors'],
|
|
|
|
$params['hide_labels']
|
|
|
|
);
|
2018-10-16 15:32:31 +02:00
|
|
|
break;
|
|
|
|
case 'vbar':
|
|
|
|
echo flot_vcolumn_chart(
|
|
|
|
$params['chart_data'],
|
|
|
|
$params['width'],
|
|
|
|
$params['height'],
|
|
|
|
$params['color'],
|
|
|
|
$params['legend'],
|
|
|
|
$params['long_index'],
|
|
|
|
$params['homeurl'],
|
|
|
|
$params['unit'],
|
|
|
|
$params['water_mark_url'],
|
|
|
|
$params['homedir'],
|
|
|
|
$params['font'],
|
2018-11-27 17:43:59 +01:00
|
|
|
$config['font_size'],
|
2018-10-16 15:32:31 +02:00
|
|
|
$params['from_ux'],
|
|
|
|
$params['from_wux'],
|
|
|
|
$params['backgroundColor'],
|
|
|
|
$params['tick_color']
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'hbar':
|
|
|
|
echo flot_hcolumn_chart(
|
|
|
|
$params['chart_data'],
|
|
|
|
$params['width'],
|
|
|
|
$params['height'],
|
|
|
|
$params['water_mark_url'],
|
|
|
|
$params['font'],
|
2018-11-27 17:43:59 +01:00
|
|
|
$config['font_size'],
|
2018-10-16 15:32:31 +02:00
|
|
|
$params['backgroundColor'],
|
|
|
|
$params['tick_color'],
|
|
|
|
$params['val_min'],
|
|
|
|
$params['val_max']
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'ring_graph':
|
|
|
|
echo flot_custom_pie_chart (
|
|
|
|
$params['chart_data'],
|
|
|
|
$params['width'],
|
|
|
|
$params['height'],
|
|
|
|
$params['colors'],
|
|
|
|
$params['module_name_list'],
|
|
|
|
$params['long_index'],
|
|
|
|
$params['no_data'],
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
$params['water_mark'],
|
|
|
|
$params['font'],
|
2018-11-27 17:43:59 +01:00
|
|
|
$config['font_size'],
|
2018-10-16 15:32:31 +02:00
|
|
|
$params['unit'],
|
|
|
|
$params['ttl'],
|
|
|
|
$params['homeurl'],
|
|
|
|
$params['background_color'],
|
|
|
|
$params['legend_position'],
|
|
|
|
$params['background_color']
|
|
|
|
);
|
|
|
|
break;
|
2018-10-19 10:49:13 +02:00
|
|
|
case 'slicebar':
|
|
|
|
echo flot_slicesbar_graph (
|
|
|
|
$params['graph_data'],
|
|
|
|
$params['period'],
|
|
|
|
$params['width'],
|
|
|
|
$params['height'],
|
|
|
|
$params['legend'],
|
|
|
|
$params['colors'],
|
|
|
|
$params['fontpath'],
|
|
|
|
$params['round_corner'],
|
|
|
|
$params['homeurl'],
|
|
|
|
$params['watermark'],
|
|
|
|
$params['adapt_key'],
|
|
|
|
$params['stat_winalse'],
|
|
|
|
$params['id_agent'],
|
|
|
|
$params['full_legend_daterray'],
|
|
|
|
$params['not_interactive'],
|
2018-12-04 10:19:26 +01:00
|
|
|
$params['ttl'],
|
|
|
|
$params['widgets'],
|
|
|
|
$params['show']
|
2018-10-19 10:49:13 +02:00
|
|
|
);
|
|
|
|
break;
|
2018-10-16 15:32:31 +02:00
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
2018-10-11 12:57:48 +02:00
|
|
|
}
|
2018-10-16 15:32:31 +02:00
|
|
|
echo '</div>';
|
2018-06-20 11:31:43 +02:00
|
|
|
|
|
|
|
$config['font_size'] = $aux_font_size;
|
2018-12-12 10:46:28 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('document').ready(function () {
|
|
|
|
setTimeout(function () {
|
2018-12-13 17:24:01 +01:00
|
|
|
try {
|
|
|
|
var status = window.callPhantom({ status: "loaded" });
|
|
|
|
} catch (error) {
|
|
|
|
console.log("CALLBACK ERROR", error.message)
|
2018-12-12 10:46:28 +01:00
|
|
|
}
|
|
|
|
}, 100);
|
|
|
|
});
|
|
|
|
</script>
|
2018-06-06 17:23:32 +02:00
|
|
|
|
2018-12-12 10:46:28 +01:00
|
|
|
</body>
|
2018-06-14 16:47:23 +02:00
|
|
|
</html>
|