Merge branch '2231-Vistas-realtime-en-modulos-de-red' into 'develop'
2231 vistas realtime en modulos de red See merge request artica/pandorafms!1470
This commit is contained in:
commit
c83def806b
|
@ -14,8 +14,10 @@
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
include_once('include/graphs/fgraph.php');
|
global $config;
|
||||||
include_once('include/functions_snmp_browser.php');
|
|
||||||
|
include_once($config['homedir'] . '/include/graphs/fgraph.php');
|
||||||
|
include_once($config['homedir'] . '/include/functions_snmp_browser.php');
|
||||||
|
|
||||||
function pandora_realtime_graphs () {
|
function pandora_realtime_graphs () {
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -25,8 +27,11 @@ function pandora_realtime_graphs () {
|
||||||
$action = get_parameter('action', 'list');
|
$action = get_parameter('action', 'list');
|
||||||
|
|
||||||
$onheader = array();
|
$onheader = array();
|
||||||
|
|
||||||
ui_print_page_header (__("Realtime graphs"), "images/extensions.png", false, "", false, $onheader);
|
$hide_header = get_parameter('hide_header', 0);
|
||||||
|
if (!$hide_header) {
|
||||||
|
ui_print_page_header (__("Realtime graphs"), "images/extensions.png", false, "", false, $onheader);
|
||||||
|
}
|
||||||
|
|
||||||
$chart[time()]['graph'] = '0';
|
$chart[time()]['graph'] = '0';
|
||||||
$interactive_graph = true;
|
$interactive_graph = true;
|
||||||
|
@ -69,26 +74,40 @@ function pandora_realtime_graphs () {
|
||||||
$graph = get_parameter('graph', 'cpu_load');
|
$graph = get_parameter('graph', 'cpu_load');
|
||||||
$refresh = get_parameter('refresh', '1000');
|
$refresh = get_parameter('refresh', '1000');
|
||||||
|
|
||||||
$data['graph'] = __('Graph') . ' ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
|
if ($graph != 'snmp_module') {
|
||||||
|
$data['graph'] = __('Graph') . ' ' . html_print_select ($graph_fields, 'graph', $graph, '', '', 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
|
$refresh_fields[1000] = human_time_description_raw(1, true, 'large');
|
||||||
$refresh_fields[5000] = human_time_description_raw(5, true, 'large');
|
$refresh_fields[5000] = human_time_description_raw(5, true, 'large');
|
||||||
$refresh_fields[10000] = human_time_description_raw(10, true, 'large');
|
$refresh_fields[10000] = human_time_description_raw(10, true, 'large');
|
||||||
$refresh_fields[30000] = human_time_description_raw(30, true, 'large');
|
$refresh_fields[30000] = human_time_description_raw(30, true, 'large');
|
||||||
|
|
||||||
|
if ($graph == 'snmp_module') {
|
||||||
|
$agent_alias = get_parameter('agent_alias', '');
|
||||||
|
$module_name = get_parameter('module_name', '');
|
||||||
|
$module_incremental = get_parameter ('incremental', 0);
|
||||||
|
$data['module_info'] = "$agent_alias: <b>$module_name</b>";
|
||||||
|
|
||||||
|
// Append all the hidden in this cell
|
||||||
|
$data['module_info'] .= html_print_input_hidden ('incremental', $module_incremental, true);
|
||||||
|
$data['module_info'] .= html_print_select (
|
||||||
|
array('snmp_module' => '-'), 'graph', 'snmp_module', '', '', 0, true, false, true, '', false, 'display: none;'
|
||||||
|
);
|
||||||
|
}
|
||||||
$data['refresh'] = __('Refresh interval') . ' ' . html_print_select ($refresh_fields, 'refresh', $refresh, '', '', 0, true);
|
$data['refresh'] = __('Refresh interval') . ' ' . html_print_select ($refresh_fields, 'refresh', $refresh, '', '', 0, true);
|
||||||
$data['incremental'] = __('Incremental') . ' ' . html_print_checkbox ('incremental', 1, 0, true);
|
if ($graph != 'snmp_module') {
|
||||||
|
$data['incremental'] = __('Incremental') . ' ' . html_print_checkbox ('incremental', 1, 0, true);
|
||||||
|
}
|
||||||
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true);
|
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true);
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
|
|
||||||
|
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
|
||||||
if ($graph == 'snmp_interface') {
|
$snmp_address = get_parameter('snmp_address', '');
|
||||||
$snmp_address = '';
|
$snmp_community = get_parameter('snmp_community', '');
|
||||||
$snmp_community = '';
|
$snmp_oid = get_parameter('snmp_oid', '');
|
||||||
$snmp_oid = '';
|
$snmp_ver = get_parameter('snmp_ver', '');
|
||||||
$snmp_ver = '1';
|
|
||||||
$snmp_inc = false;
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$data['snmp_address'] = __('Target IP') . ' ' . html_print_input_text ('ip_target', $snmp_address, '', 50, 255, true);
|
$data['snmp_address'] = __('Target IP') . ' ' . html_print_input_text ('ip_target', $snmp_address, '', 50, 255, true);
|
||||||
|
@ -111,12 +130,21 @@ function pandora_realtime_graphs () {
|
||||||
$data['snmp_ver'] = __('Version') . ' ' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
$data['snmp_ver'] = __('Version') . ' ' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
||||||
$data['snmp_ver'] .= ' ' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true);
|
$data['snmp_ver'] .= ' ' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true);
|
||||||
$table->colspan[2]['snmp_ver'] = 2;
|
$table->colspan[2]['snmp_ver'] = 2;
|
||||||
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
|
|
||||||
|
// Hide some options in snmp_module graphs
|
||||||
|
if ($graph == 'snmp_module') {
|
||||||
|
$table->rowstyle[1] = "display: none;";
|
||||||
|
$table->rowstyle[2] = "display: none;";
|
||||||
|
}
|
||||||
snmp_browser_print_container (false, '100%', '60%', 'none');
|
snmp_browser_print_container (false, '100%', '60%', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print the relative path to AJAX calls:
|
||||||
|
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
||||||
|
|
||||||
|
// Print the form
|
||||||
echo '<form id="realgraph" method="post">';
|
echo '<form id="realgraph" method="post">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
@ -125,9 +153,9 @@ function pandora_realtime_graphs () {
|
||||||
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
html_print_input_hidden ('custom_action', urlencode (base64_encode(' <a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
|
||||||
html_print_input_hidden ('incremental_base', '0');
|
html_print_input_hidden ('incremental_base', '0');
|
||||||
|
|
||||||
echo '<script type="text/javascript" src="extensions/realtime_graphs/realtime_graphs.js"></script>';
|
echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>';
|
||||||
echo '<script type="text/javascript" src="include/javascript/pandora_snmp_browser.js"></script>';
|
echo '<script type="text/javascript" src="'.ui_get_full_url("include/javascript/pandora_snmp_browser.js").'"></script>';
|
||||||
echo '<link rel="stylesheet" type="text/css" href="extensions/realtime_graphs/realtime_graphs.css"></style>';
|
echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.css").'"></style>';
|
||||||
|
|
||||||
// Store servers timezone offset to be retrieved from js
|
// Store servers timezone offset to be retrieved from js
|
||||||
set_js_value('timezone_offset', date('Z', time()));
|
set_js_value('timezone_offset', date('Z', time()));
|
||||||
|
|
|
@ -59,6 +59,7 @@ switch($graph) {
|
||||||
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
|
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
|
||||||
break;
|
break;
|
||||||
case 'snmp_interface':
|
case 'snmp_interface':
|
||||||
|
case 'snmp_module':
|
||||||
$snmp_address = $_POST['snmp_address'];
|
$snmp_address = $_POST['snmp_address'];
|
||||||
$snmp_community = $_POST['snmp_community'];
|
$snmp_community = $_POST['snmp_community'];
|
||||||
$snmp_ver = $_POST['snmp_ver'];
|
$snmp_ver = $_POST['snmp_ver'];
|
||||||
|
|
|
@ -37,7 +37,7 @@ var plot = $.plot("#" + id, data, options);
|
||||||
|
|
||||||
|
|
||||||
var refresh = parseInt($('#refresh').val());
|
var refresh = parseInt($('#refresh').val());
|
||||||
var incremental = $('#checkbox-incremental').is(':checked');
|
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
|
||||||
var incremental_base = 0;
|
var incremental_base = 0;
|
||||||
var last_inc = 0;
|
var last_inc = 0;
|
||||||
var to;
|
var to;
|
||||||
|
@ -58,9 +58,11 @@ function refresh_graph () {
|
||||||
postvars['snmp_address'] = $('#text-ip_target').val();
|
postvars['snmp_address'] = $('#text-ip_target').val();
|
||||||
|
|
||||||
postvars['refresh'] = refresh;
|
postvars['refresh'] = refresh;
|
||||||
|
|
||||||
|
var rel_path = $("#hidden-rel_path").val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "extensions/realtime_graphs/ajax.php",
|
url: rel_path + "extensions/realtime_graphs/ajax.php",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: postvars,
|
data: postvars,
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 527 B |
|
@ -1083,6 +1083,10 @@ if ($list_modules) {
|
||||||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||||
|
|
||||||
|
// Try to display the SNMP module realtime graph
|
||||||
|
$rt_button .= get_module_realtime_link_graph($module);
|
||||||
|
if (!empty($rt_button)) $data[8] = $rt_button . " ";
|
||||||
|
|
||||||
# Show events for boolean modules by default.
|
# Show events for boolean modules by default.
|
||||||
if ($graph_type == 'boolean') {
|
if ($graph_type == 'boolean') {
|
||||||
$draw_events = 1;
|
$draw_events = 1;
|
||||||
|
@ -1099,9 +1103,8 @@ if ($list_modules) {
|
||||||
base64_encode($module["nombre"]))) . "&" .
|
base64_encode($module["nombre"]))) . "&" .
|
||||||
"refresh=" . SECONDS_10MINUTES . "&" .
|
"refresh=" . SECONDS_10MINUTES . "&" .
|
||||||
"draw_events=$draw_events', 'day_".$win_handle."')";
|
"draw_events=$draw_events', 'day_".$win_handle."')";
|
||||||
|
if(!is_snapshot_data($module['datos'])){
|
||||||
if(!is_snapshot_data($module['datos'])){
|
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
|
||||||
}
|
}
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$data[8] .= "<a href='javascript: " .
|
$data[8] .= "<a href='javascript: " .
|
||||||
|
|
|
@ -92,28 +92,27 @@ function extensions_is_extension ($page) {
|
||||||
*
|
*
|
||||||
* @param bool $enterprise
|
* @param bool $enterprise
|
||||||
*/
|
*/
|
||||||
function extensions_get_extensions ($enterprise = false) {
|
function extensions_get_extensions ($enterprise = false, $rel_path = '') {
|
||||||
|
|
||||||
$dir = EXTENSIONS_DIR;
|
$dir = $rel_path . EXTENSIONS_DIR;
|
||||||
$master_dir = ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
$master_dir = $rel_path . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||||
$handle = false;
|
$handle = false;
|
||||||
if ($enterprise) {
|
if ($enterprise) {
|
||||||
$dir = ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
$dir = $rel_path . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
|
||||||
if (defined("METACONSOLE")) {
|
if (defined("METACONSOLE")) {
|
||||||
$dir = '../' . EXTENSIONS_DIR;
|
$dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||||
$master_dir = '../' . EXTENSIONS_DIR;
|
$master_dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (defined("METACONSOLE")) {
|
if (defined("METACONSOLE")) {
|
||||||
$dir = '../../' . $dir;
|
$dir = $rel_path . '../../' . $dir;
|
||||||
$master_dir = '../' . EXTENSIONS_DIR;
|
$master_dir = $rel_path . '../' . EXTENSIONS_DIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists ($dir))
|
if (file_exists ($dir))
|
||||||
$handle = @opendir ($dir);
|
$handle = @opendir ($dir);
|
||||||
|
|
||||||
if (empty ($handle))
|
if (empty ($handle))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -148,11 +147,22 @@ function extensions_get_extensions ($enterprise = false) {
|
||||||
|
|
||||||
/* Load extensions in enterprise directory */
|
/* Load extensions in enterprise directory */
|
||||||
if (! $enterprise && file_exists ($master_dir))
|
if (! $enterprise && file_exists ($master_dir))
|
||||||
return array_merge ($extensions, extensions_get_extensions (true));
|
return array_merge ($extensions, extensions_get_extensions (true, $rel_path));
|
||||||
|
|
||||||
return $extensions;
|
return $extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if an extension is enabled
|
||||||
|
*
|
||||||
|
* @param string Extension name (ended with .php)
|
||||||
|
* @return True if enabled
|
||||||
|
*/
|
||||||
|
function extensions_is_enabled_extension($name) {
|
||||||
|
global $config;
|
||||||
|
return isset($config['extensions'][$name]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get disabled open and enterprise extensions
|
* Get disabled open and enterprise extensions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2684,4 +2684,62 @@ function recursive_get_dt_from_modules_tree (&$f_modules, $modules, $deep) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the button with the link to open realtime stats into a new window
|
||||||
|
* Only to native (not satellite discovered) snmp modules.
|
||||||
|
*
|
||||||
|
* @param array With all the module info
|
||||||
|
* @return string All the HTML code to paint the button
|
||||||
|
*/
|
||||||
|
function get_module_realtime_link_graph ($module) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Sometimes some parameters are renamed
|
||||||
|
if (!isset($module['id_tipo_modulo'])) $module['id_tipo_modulo'] = $module['module_type'];
|
||||||
|
if (!isset($module['nombre'])) $module['nombre'] = $module['module_name'];
|
||||||
|
|
||||||
|
// Avoid to show on metaconsole
|
||||||
|
if (is_metaconsole()) return '';
|
||||||
|
// Realtime graph is an extension and it should be enabled
|
||||||
|
if (!extensions_is_enabled_extension("realtime_graphs.php")) return '';
|
||||||
|
// Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc
|
||||||
|
if ($module['id_tipo_modulo'] != 15 && $module['id_tipo_modulo'] != 16 && $module['id_tipo_modulo'] != 18) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// Only version 1, 2 and 2c
|
||||||
|
if ($module['tcp_send'] != "1" && $module['tcp_send'] != "2" && $module['tcp_send'] != "2c") {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'graph' => 'snmp_module',
|
||||||
|
'agent_alias' => modules_get_agentmodule_agent_alias($module['id_agente_modulo']),
|
||||||
|
'module_name' => $module['nombre'],
|
||||||
|
'snmp_address' => $module['ip_target'],
|
||||||
|
'snmp_community' => $module['snmp_community'],
|
||||||
|
'snmp_oid' => $module['snmp_oid'],
|
||||||
|
'snmp_ver' => $module['tcp_send'],
|
||||||
|
'hide_header' => 1,
|
||||||
|
'rel_path' => '../../'
|
||||||
|
);
|
||||||
|
// Incremental type
|
||||||
|
if ($module['id_tipo_modulo'] == 16) $params['incremental'] = 1;
|
||||||
|
$link = "operation/agentes/realtime_win.php?";
|
||||||
|
foreach ($params as $p_key => $p_value) {
|
||||||
|
$link .= "$p_key=" . urlencode(io_safe_output($p_value)) . "&";
|
||||||
|
}
|
||||||
|
$link = substr($link, 0, -1);
|
||||||
|
|
||||||
|
$win_handle = "realtime_" . dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||||
|
|
||||||
|
$link_button = '<a href="javascript:winopeng_var(\''.$link.'\',\''.$win_handle.'\', 850, 480)">' .
|
||||||
|
html_print_image(
|
||||||
|
"images/realtime_shortcut.png",
|
||||||
|
true,
|
||||||
|
array("border" => '0', "alt" => "", 'title' => __('Realtime SNMP graph'))
|
||||||
|
) .
|
||||||
|
'</a>';
|
||||||
|
|
||||||
|
return $link_button;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -576,16 +576,17 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
|
||||||
enterprise_include_once ('include/functions_satellite.php');
|
enterprise_include_once ('include/functions_satellite.php');
|
||||||
|
|
||||||
$rows = get_proxy_servers();
|
$rows = get_proxy_servers();
|
||||||
foreach ($rows as $row) {
|
if ($rows !== false) {
|
||||||
if ($row['server_type'] != 13) {
|
foreach ($rows as $row) {
|
||||||
$s_type = " (Standard)";
|
if ($row['server_type'] != 13) {
|
||||||
|
$s_type = " (Standard)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$s_type = " (Satellite)";
|
||||||
|
}
|
||||||
|
$servers_to_exec[$row['id_server']] = $row['name'] . $s_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$s_type = " (Satellite)";
|
|
||||||
}
|
|
||||||
|
|
||||||
$servers_to_exec[$row['id_server']] = $row['name'] . $s_type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$table->data[1][1] = '<strong>' . __('Server to execute') . '</strong> ';
|
$table->data[1][1] = '<strong>' . __('Server to execute') . '</strong> ';
|
||||||
$table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
|
$table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
|
||||||
|
|
|
@ -497,6 +497,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||||
|
|
||||||
|
|
||||||
// Javascript code
|
// Javascript code
|
||||||
|
if ($font_size == '') $font_size = '\'\'';
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
$return .= "$(document).ready( function () {";
|
$return .= "$(document).ready( function () {";
|
||||||
$return .= "pandoraFlotArea(" .
|
$return .= "pandoraFlotArea(" .
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?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.
|
||||||
|
|
||||||
|
|
||||||
|
if (! isset($_SESSION['id_usuario'])) {
|
||||||
|
session_start();
|
||||||
|
//session_write_close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Global & session management
|
||||||
|
require_once ('../../include/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_modules.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||||
|
require_once ($config['homedir'] . '/include/functions_extensions.php');
|
||||||
|
check_login ();
|
||||||
|
|
||||||
|
// Metaconsole connection to the node
|
||||||
|
$server_id = (int) get_parameter("server");
|
||||||
|
if (is_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 ('../../include/languages/'.$user_language.'.mo')) {
|
||||||
|
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
|
||||||
|
$l10n->load_tables();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<?php
|
||||||
|
// Parsing the refresh before sending any header
|
||||||
|
$refresh = (int) get_parameter ("refresh", -1);
|
||||||
|
if ($refresh > 0) {
|
||||||
|
$query = ui_get_url_refresh (false);
|
||||||
|
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>Pandora FMS Realtime Module Graph</title>
|
||||||
|
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../include/styles/jquery-ui-1.10.0.custom.css" type="text/css" />
|
||||||
|
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||||
|
<script type='text/javascript' src='../../include/javascript/jquery-1.9.0.js'></script>
|
||||||
|
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||||
|
<script type='text/javascript' src='../../include/javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
|
||||||
|
<?php
|
||||||
|
//Include the javascript for the js charts library
|
||||||
|
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
||||||
|
include_javascript_dependencies_flot_graph();
|
||||||
|
?>
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||||
|
<?php
|
||||||
|
$config['extensions'] = extensions_get_extensions (false, '../../');
|
||||||
|
if (!extensions_is_enabled_extension("realtime_graphs.php")) {
|
||||||
|
ui_print_error_message(__('Realtime extension is not enabled.'));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
include_once('../../extensions/realtime_graphs.php');
|
||||||
|
}
|
||||||
|
pandora_realtime_graphs();
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Echo the script tags of the datepicker and the timepicker
|
||||||
|
// Modify the user language cause the ui.datepicker language files use - instead _
|
||||||
|
$custom_user_language = str_replace('_', '-', $user_language);
|
||||||
|
ui_require_jquery_file("ui.datepicker-" . $custom_user_language, "include/javascript/i18n/", true);
|
||||||
|
ui_include_time_picker(true);
|
||||||
|
?>
|
|
@ -753,7 +753,11 @@ switch ($config['dbtype']) {
|
||||||
tagente.id_grupo AS id_group,
|
tagente.id_grupo AS id_group,
|
||||||
tagente.id_agente AS id_agent,
|
tagente.id_agente AS id_agent,
|
||||||
tagente_modulo.id_tipo_modulo AS module_type,
|
tagente_modulo.id_tipo_modulo AS module_type,
|
||||||
tagente_modulo.module_interval,
|
tagente_modulo.module_interval,
|
||||||
|
tagente_modulo.tcp_send,
|
||||||
|
tagente_modulo.ip_target,
|
||||||
|
tagente_modulo.snmp_community,
|
||||||
|
tagente_modulo.snmp_oid,
|
||||||
tagente_estado.datos,
|
tagente_estado.datos,
|
||||||
tagente_estado.estado,
|
tagente_estado.estado,
|
||||||
tagente_modulo.min_warning,
|
tagente_modulo.min_warning,
|
||||||
|
@ -1272,12 +1276,11 @@ if (!empty($result)) {
|
||||||
$graph_params_str = http_build_query($graph_params);
|
$graph_params_str = http_build_query($graph_params);
|
||||||
|
|
||||||
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
||||||
|
|
||||||
$data[7] = '';
|
$data[7] = get_module_realtime_link_graph($row);
|
||||||
|
|
||||||
if(!is_snapshot_data($row['datos'])){
|
if(!is_snapshot_data($row['datos'])){
|
||||||
|
$data[7] .= '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
||||||
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
|
||||||
}
|
}
|
||||||
$data[7] .= '<a href="javascript: ' .
|
$data[7] .= '<a href="javascript: ' .
|
||||||
'show_module_detail_dialog(' .
|
'show_module_detail_dialog(' .
|
||||||
|
|
Loading…
Reference in New Issue