fix SNMP v3 show realtime charts
This commit is contained in:
parent
b1d2e7bba0
commit
35bfd765f3
|
@ -1,22 +1,42 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Funtions real time.
|
||||||
|
*
|
||||||
|
* @category Realtime
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2014 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; 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 $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/graphs/fgraph.php';
|
require_once $config['homedir'].'/include/graphs/fgraph.php';
|
||||||
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Real time charts.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function pandora_realtime_graphs()
|
function pandora_realtime_graphs()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -28,7 +48,7 @@ function pandora_realtime_graphs()
|
||||||
$onheader = [];
|
$onheader = [];
|
||||||
|
|
||||||
$hide_header = get_parameter('hide_header', 0);
|
$hide_header = get_parameter('hide_header', 0);
|
||||||
if (!$hide_header) {
|
if ($hide_header === 0) {
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Realtime graphs'),
|
__('Realtime graphs'),
|
||||||
'images/extensions.png',
|
'images/extensions.png',
|
||||||
|
@ -96,18 +116,42 @@ function pandora_realtime_graphs()
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
|
$graph_fields['cpu_load'] = __('%s Server CPU', get_product_name());
|
||||||
$graph_fields['pending_packets'] = __('Pending packages from %s Server', get_product_name());
|
$graph_fields['pending_packets'] = __(
|
||||||
$graph_fields['disk_io_wait'] = __('%s Server Disk IO Wait', get_product_name());
|
'Pending packages from %s Server',
|
||||||
$graph_fields['apache_load'] = __('%s Server Apache load', get_product_name());
|
get_product_name()
|
||||||
$graph_fields['mysql_load'] = __('%s Server MySQL load', get_product_name());
|
);
|
||||||
$graph_fields['server_load'] = __('%s Server load', get_product_name());
|
$graph_fields['disk_io_wait'] = __(
|
||||||
|
'%s Server Disk IO Wait',
|
||||||
|
get_product_name()
|
||||||
|
);
|
||||||
|
$graph_fields['apache_load'] = __(
|
||||||
|
'%s Server Apache load',
|
||||||
|
get_product_name()
|
||||||
|
);
|
||||||
|
$graph_fields['mysql_load'] = __(
|
||||||
|
'%s Server MySQL load',
|
||||||
|
get_product_name()
|
||||||
|
);
|
||||||
|
$graph_fields['server_load'] = __(
|
||||||
|
'%s Server load',
|
||||||
|
get_product_name()
|
||||||
|
);
|
||||||
$graph_fields['snmp_interface'] = __('SNMP Interface throughput');
|
$graph_fields['snmp_interface'] = __('SNMP Interface throughput');
|
||||||
|
|
||||||
$graph = get_parameter('graph', 'cpu_load');
|
$graph = get_parameter('graph', 'cpu_load');
|
||||||
$refresh = get_parameter('refresh', '1000');
|
$refresh = get_parameter('refresh', '1000');
|
||||||
|
|
||||||
if ($graph != 'snmp_module') {
|
if ($graph != 'snmp_module') {
|
||||||
$data['graph'] = __('Graph').' '.html_print_select($graph_fields, 'graph', $graph, '', '', 0, true);
|
$data['graph'] = __('Graph').' ';
|
||||||
|
$data['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');
|
||||||
|
@ -119,10 +163,14 @@ function pandora_realtime_graphs()
|
||||||
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
|
$agent_alias = io_safe_output(get_parameter('agent_alias', ''));
|
||||||
$module_name = io_safe_output(get_parameter('module_name', ''));
|
$module_name = io_safe_output(get_parameter('module_name', ''));
|
||||||
$module_incremental = get_parameter('incremental', 0);
|
$module_incremental = get_parameter('incremental', 0);
|
||||||
$data['module_info'] = "$agent_alias: <b>$module_name</b>";
|
$data['module_info'] = $agent_alias.': <b>'.$module_name.'</b>';
|
||||||
|
|
||||||
// Append all the hidden in this cell
|
// Append all the hidden in this cell.
|
||||||
$data['module_info'] .= html_print_input_hidden('incremental', $module_incremental, true);
|
$data['module_info'] .= html_print_input_hidden(
|
||||||
|
'incremental',
|
||||||
|
$module_incremental,
|
||||||
|
true
|
||||||
|
);
|
||||||
$data['module_info'] .= html_print_select(
|
$data['module_info'] .= html_print_select(
|
||||||
['snmp_module' => '-'],
|
['snmp_module' => '-'],
|
||||||
'graph',
|
'graph',
|
||||||
|
@ -139,76 +187,72 @@ function pandora_realtime_graphs()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['refresh'] = __('Refresh interval').' '.html_print_select($refresh_fields, 'refresh', $refresh, '', '', 0, true);
|
$data['refresh'] = __('Refresh interval').' ';
|
||||||
|
$data['refresh'] .= html_print_select(
|
||||||
|
$refresh_fields,
|
||||||
|
'refresh',
|
||||||
|
$refresh,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
if ($graph != 'snmp_module') {
|
if ($graph != 'snmp_module') {
|
||||||
$data['incremental'] = __('Incremental').' '.html_print_checkbox('incremental', 1, 0, true);
|
$data['incremental'] = __('Incremental').' ';
|
||||||
|
$data['incremental'] .= html_print_checkbox('incremental', 1, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'javascript:realtimeGraphs.clearGraph();', 'class="sub delete" style="margin-top:0px;"', true);
|
$data['reset'] = html_print_button(
|
||||||
|
__('Clear graph'),
|
||||||
|
'reset',
|
||||||
|
false,
|
||||||
|
'javascript:realtimeGraphs.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' || $graph == 'snmp_module') {
|
||||||
$snmp_address = get_parameter('snmp_address', '');
|
echo snmp_browser_print_container(true, '100%', '60%', 'none');
|
||||||
$snmp_community = get_parameter('snmp_community', '');
|
|
||||||
$snmp_oid = get_parameter('snmp_oid', '');
|
|
||||||
$snmp_ver = get_parameter('snmp_ver', '');
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
$data['snmp_address'] = __('Target IP').' '.html_print_input_text('ip_target', $snmp_address, '', 50, 255, true);
|
|
||||||
$table->colspan[1]['snmp_address'] = 2;
|
|
||||||
|
|
||||||
$data['snmp_community'] = __('Community').' '.html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true);
|
|
||||||
$table->colspan[1]['snmp_community'] = 2;
|
|
||||||
|
|
||||||
$table->data[] = $data;
|
|
||||||
|
|
||||||
$snmp_versions = [];
|
|
||||||
$snmp_versions['1'] = '1';
|
|
||||||
$snmp_versions['2'] = '2';
|
|
||||||
$snmp_versions['2c'] = '2c';
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$data['snmp_oid'] = __('OID').' '.html_print_input_text('snmp_oid', $snmp_oid, '', 100, 255, true);
|
|
||||||
$table->colspan[2]['snmp_oid'] = 2;
|
|
||||||
|
|
||||||
$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, 'javascript:snmpBrowserWindow();', 'class="sub next"', true);
|
|
||||||
$table->colspan[2]['snmp_ver'] = 2;
|
|
||||||
|
|
||||||
$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');
|
// Print the relative path to AJAX calls.
|
||||||
}
|
|
||||||
|
|
||||||
// Print the relative path to AJAX calls:
|
|
||||||
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
html_print_input_hidden('rel_path', get_parameter('rel_path', ''));
|
||||||
|
|
||||||
// Print the form
|
// 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>';
|
||||||
|
|
||||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
// Define a custom action to save
|
||||||
html_print_input_hidden('custom_action', urlencode(base64_encode(' <a href="javascript:realtimeGraphs.setOID();"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>')), false);
|
// the OID selected in the SNMP browser to the form.
|
||||||
|
html_print_input_hidden(
|
||||||
|
'custom_action',
|
||||||
|
urlencode(
|
||||||
|
base64_encode(
|
||||||
|
' <a href="javascript:realtimeGraphs.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="'.ui_get_full_url('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 '<script type="text/javascript" src="'.ui_get_full_url('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 '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url('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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extensions_add_operation_menu_option(__('Realtime graphs'), 'estado', null, 'v1r1', 'view');
|
extensions_add_operation_menu_option(
|
||||||
|
__('Realtime graphs'),
|
||||||
|
'estado',
|
||||||
|
null,
|
||||||
|
'v1r1',
|
||||||
|
'view'
|
||||||
|
);
|
||||||
extensions_add_main_function('pandora_realtime_graphs');
|
extensions_add_main_function('pandora_realtime_graphs');
|
||||||
|
|
||||||
$db = null;
|
$db = null;
|
||||||
|
|
|
@ -69,15 +69,34 @@ switch ($graph) {
|
||||||
|
|
||||||
case 'snmp_interface':
|
case 'snmp_interface':
|
||||||
case 'snmp_module':
|
case 'snmp_module':
|
||||||
$snmp_address = $_POST['snmp_address'];
|
$snmp_address = get_parameter('snmp_address', '');
|
||||||
$snmp_community = $_POST['snmp_community'];
|
$snmp_community = get_parameter('snmp_community', '');
|
||||||
$snmp_ver = $_POST['snmp_ver'];
|
$snmp_ver = get_parameter('snmp_ver', '');
|
||||||
$snmp_oid = $_POST['snmp_oid'];
|
$snmp_oid = get_parameter('snmp_oid', '');
|
||||||
|
$snmp3_auth_user = get_parameter('snmp3_auth_user', '');
|
||||||
|
$snmp3_security_level = get_parameter('snmp3_security_level', '');
|
||||||
|
$snmp3_auth_method = get_parameter('snmp3_auth_method', '');
|
||||||
|
$snmp3_auth_pass = get_parameter('snmp3_auth_pass', '');
|
||||||
|
$snmp3_privacy_method = get_parameter('snmp3_privacy_method', '');
|
||||||
|
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', '');
|
||||||
|
|
||||||
if (empty($snmp_address) || empty($snmp_oid)) {
|
if (empty($snmp_address) || empty($snmp_oid)) {
|
||||||
$data = 0;
|
$data = 0;
|
||||||
} else {
|
} else {
|
||||||
$data = get_snmpwalk($snmp_address, $snmp_ver, $snmp_community, '', '', '', '', '', '', 0, $snmp_oid);
|
$data = get_snmpwalk(
|
||||||
|
$snmp_address,
|
||||||
|
$snmp_ver,
|
||||||
|
$snmp_community,
|
||||||
|
$snmp3_auth_user,
|
||||||
|
$snmp3_security_level,
|
||||||
|
$snmp3_auth_method,
|
||||||
|
$snmp3_auth_pass,
|
||||||
|
$snmp3_privacy_method,
|
||||||
|
$snmp3_privacy_pass,
|
||||||
|
0,
|
||||||
|
$snmp_oid,
|
||||||
|
$snmp_port
|
||||||
|
);
|
||||||
$data_index = array_keys($data);
|
$data_index = array_keys($data);
|
||||||
$graph_title = $data_index[0];
|
$graph_title = $data_index[0];
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* global $, get_php_value */
|
||||||
(function() {
|
(function() {
|
||||||
var numberOfPoints = 100;
|
var numberOfPoints = 100;
|
||||||
var refresh = parseInt($("#refresh").val());
|
var refresh = parseInt($("#refresh").val());
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
container: $("#chartLegend")
|
container: $("#chartLegend")
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
tickFormatter: function(timestamp, axis) {
|
tickFormatter: function(timestamp) {
|
||||||
var date = new Date(timestamp * 1000);
|
var date = new Date(timestamp * 1000);
|
||||||
|
|
||||||
var server_timezone_offset = get_php_value("timezone_offset");
|
var server_timezone_offset = get_php_value("timezone_offset");
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
tickFormatter: function(value, axis) {
|
tickFormatter: function(value) {
|
||||||
return shortNumber(roundToTwo(value));
|
return shortNumber(roundToTwo(value));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -66,10 +67,16 @@
|
||||||
data: {
|
data: {
|
||||||
graph: $("#graph :selected").val(),
|
graph: $("#graph :selected").val(),
|
||||||
graph_title: $("#graph :selected").html(),
|
graph_title: $("#graph :selected").html(),
|
||||||
snmp_community: $("#text-snmp_community").val(),
|
snmp_community: $("#text-community").val(),
|
||||||
snmp_oid: $("#text-snmp_oid").val(),
|
snmp_oid: $("#text-starting_oid").val(),
|
||||||
snmp_ver: $("#snmp_version :selected").val(),
|
snmp_ver: $("#snmp_browser_version").val(),
|
||||||
snmp_address: $("#text-ip_target").val(),
|
snmp_address: $("#text-target_ip").val(),
|
||||||
|
snmp3_auth_user: $("#text-snmp3_browser_auth_user").val(),
|
||||||
|
snmp3_security_level: $("#snmp3_browser_security_level").val(),
|
||||||
|
snmp3_auth_method: $("#snmp3_browser_auth_method").val(),
|
||||||
|
snmp3_auth_pass: $("#password-snmp3_browser_auth_pass").val(),
|
||||||
|
snmp3_privacy_method: $("#snmp3_browser_privacy_method").val(),
|
||||||
|
snmp3_privacy_pass: $("#password-snmp3_browser_privacy_pass").val(),
|
||||||
refresh: refresh
|
refresh: refresh
|
||||||
},
|
},
|
||||||
success: function(serie) {
|
success: function(serie) {
|
||||||
|
@ -87,7 +94,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
for (i = 0; i < numberOfPoints; i++) {
|
for (var i = 0; i < numberOfPoints; i++) {
|
||||||
var step = i * (refresh / 1000);
|
var step = i * (refresh / 1000);
|
||||||
serie.data.unshift([timestamp - step, 0]);
|
serie.data.unshift([timestamp - step, 0]);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +130,7 @@
|
||||||
var data = plot.getData();
|
var data = plot.getData();
|
||||||
if (data.length === 0) return;
|
if (data.length === 0) return;
|
||||||
|
|
||||||
for (i = 0; i < data[0].data.length; i++) {
|
for (var i = 0; i < data[0].data.length; i++) {
|
||||||
data[0].data[i][1] = 0;
|
data[0].data[i][1] = 0;
|
||||||
}
|
}
|
||||||
if (incremental) lastIncVal = null;
|
if (incremental) lastIncVal = null;
|
||||||
|
|
|
@ -3397,14 +3397,14 @@ 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
|
* @brief Get the button with the link to open realtime stats into a new window
|
||||||
* Only to native (not satellite discovered) snmp modules.
|
* Only to native (not satellite discovered) snmp modules.
|
||||||
*
|
*
|
||||||
* @param array With all the module info
|
* @param array $module With all the module info.
|
||||||
* @return string All the HTML code to paint the button
|
* @return string Link to chart.
|
||||||
*/
|
*/
|
||||||
function get_module_realtime_link_graph($module)
|
function get_module_realtime_link_graph($module)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Sometimes some parameters are renamed
|
// Sometimes some parameters are renamed.
|
||||||
if (!isset($module['id_tipo_modulo'])) {
|
if (!isset($module['id_tipo_modulo'])) {
|
||||||
$module['id_tipo_modulo'] = $module['module_type'];
|
$module['id_tipo_modulo'] = $module['module_type'];
|
||||||
}
|
}
|
||||||
|
@ -3413,34 +3413,49 @@ function get_module_realtime_link_graph($module)
|
||||||
$module['nombre'] = $module['module_name'];
|
$module['nombre'] = $module['module_name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid to show on metaconsole
|
// Avoid to show on metaconsole.
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Realtime graph is an extension and it should be enabled
|
// Realtime graph is an extension and it should be enabled.
|
||||||
if (!extensions_is_enabled_extension('realtime_graphs.php')) {
|
if (!extensions_is_enabled_extension('realtime_graphs.php')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc
|
// 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) {
|
if ($module['id_tipo_modulo'] != 15
|
||||||
|
&& $module['id_tipo_modulo'] != 16
|
||||||
|
&& $module['id_tipo_modulo'] != 18
|
||||||
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only version 1, 2 and 2c
|
// Only version 1, 2, 2c and 3
|
||||||
if ($module['tcp_send'] != '1' && $module['tcp_send'] != '2' && $module['tcp_send'] != '2c') {
|
if ($module['tcp_send'] != '1'
|
||||||
|
&& $module['tcp_send'] != '2'
|
||||||
|
&& $module['tcp_send'] != '2c'
|
||||||
|
&& $module['tcp_send'] != '3'
|
||||||
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'graph' => 'snmp_module',
|
'graph' => 'snmp_module',
|
||||||
'agent_alias' => urlencode(modules_get_agentmodule_agent_alias($module['id_agente_modulo'])),
|
'agent_alias' => urlencode(
|
||||||
|
modules_get_agentmodule_agent_alias($module['id_agente_modulo'])
|
||||||
|
),
|
||||||
'module_name' => urlencode($module['nombre']),
|
'module_name' => urlencode($module['nombre']),
|
||||||
'snmp_address' => $module['ip_target'],
|
'target_ip' => $module['ip_target'],
|
||||||
'snmp_community' => urlencode($module['snmp_community']),
|
'community' => urlencode($module['snmp_community']),
|
||||||
'snmp_oid' => $module['snmp_oid'],
|
'starting_oid' => urlencode($module['snmp_oid']),
|
||||||
'snmp_ver' => $module['tcp_send'],
|
'snmp_browser_version' => urlencode($module['tcp_send']),
|
||||||
|
'snmp3_auth_user' => urlencode($module['plugin_user']),
|
||||||
|
'snmp3_security_level' => urlencode($module['custom_string_3']),
|
||||||
|
'snmp3_auth_method' => urlencode($module['plugin_parameters']),
|
||||||
|
'snmp3_auth_pass' => urlencode($module['plugin_pass']),
|
||||||
|
'snmp3_privacy_method' => urlencode($module['custom_string_1']),
|
||||||
|
'snmp3_privacy_pass' => urlencode($module['custom_string_2']),
|
||||||
'hide_header' => 1,
|
'hide_header' => 1,
|
||||||
'rel_path' => '../../',
|
'rel_path' => '../../',
|
||||||
];
|
];
|
||||||
|
@ -3456,9 +3471,13 @@ function get_module_realtime_link_graph($module)
|
||||||
|
|
||||||
$link = substr($link, 0, -1);
|
$link = substr($link, 0, -1);
|
||||||
|
|
||||||
$win_handle = 'realtime_'.dechex(crc32($module['id_agente_modulo'].$module['nombre']));
|
$win_handle = 'realtime_';
|
||||||
|
$win_handle .= dechex(
|
||||||
|
crc32($module['id_agente_modulo'].$module['nombre'])
|
||||||
|
);
|
||||||
|
|
||||||
$link_button = '<a href="javascript:winopeng_var(\''.$link.'\',\''.$win_handle.'\', 900, 480)">'.html_print_image(
|
$link_button = '<a href="javascript:winopeng_var(\''.$link.'\',\''.$win_handle.'\', 900, 480)">';
|
||||||
|
$link_button .= html_print_image(
|
||||||
'images/realtime_shortcut.png',
|
'images/realtime_shortcut.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
@ -3466,7 +3485,8 @@ function get_module_realtime_link_graph($module)
|
||||||
'alt' => '',
|
'alt' => '',
|
||||||
'title' => __('Realtime SNMP graph'),
|
'title' => __('Realtime SNMP graph'),
|
||||||
]
|
]
|
||||||
).'</a>';
|
);
|
||||||
|
$link_button .= '</a>';
|
||||||
|
|
||||||
return $link_button;
|
return $link_button;
|
||||||
}
|
}
|
||||||
|
|
|
@ -669,18 +669,29 @@ function snmp_browser_print_oid(
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the div that contains the SNMP browser.
|
* Print browser container.
|
||||||
*
|
*
|
||||||
* @param bool return The result is printed if set to true or returned if set to false.
|
* @param boolean $return The result is printed
|
||||||
* @param string width Width of the SNMP browser. Units must be specified.
|
* if set to true or returned if set to false.
|
||||||
* @param string height Height of the SNMP browser. Units must be specified.
|
* @param string $width Width of the SNMP browser.
|
||||||
* @param string display CSS display value for the container div. Set to none to hide the div.
|
* Units must be specified.
|
||||||
|
* @param string $height Height of the SNMP browser.
|
||||||
|
* Units must be specified.
|
||||||
|
* @param string $display CSS display value for the
|
||||||
|
* container div. Set to none to hide the div.
|
||||||
|
* @param boolean $show_massive_buttons Massive buttons.
|
||||||
*
|
*
|
||||||
* @return string The container div.
|
* @return string html.
|
||||||
*/
|
*/
|
||||||
function snmp_browser_print_container($return=false, $width='100%', $height='60%', $display='', $show_massive_buttons=false)
|
function snmp_browser_print_container(
|
||||||
{
|
$return=false,
|
||||||
// Target selection
|
$width='100%',
|
||||||
|
$height='60%',
|
||||||
|
$display='',
|
||||||
|
$show_massive_buttons=false
|
||||||
|
) {
|
||||||
|
$snmp_version = get_parameter('snmp_browser_version', '2c');
|
||||||
|
// Target selection.
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
|
@ -754,12 +765,36 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[1][1] = '<strong>'.__('Server to execute').'</strong> ';
|
$table->data[1][1] = '<strong>';
|
||||||
$table->data[1][1] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
|
$table->data[1][1] .= __('Server to execute');
|
||||||
|
$table->data[1][1] .= '</strong> ';
|
||||||
|
$table->data[1][1] .= html_print_select(
|
||||||
|
$servers_to_exec,
|
||||||
|
'server_to_exec',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[1][2] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
|
$table->data[1][2] = html_print_button(
|
||||||
|
__('Browse'),
|
||||||
|
'browse',
|
||||||
|
false,
|
||||||
|
'snmpBrowse()',
|
||||||
|
'class="sub search" style="margin-top:0px;"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// SNMP v3 options.
|
||||||
|
$snmp3_auth_user = get_parameter('snmp3_auth_user', '');
|
||||||
|
$snmp3_security_level = get_parameter('snmp3_security_level', 'authNoPriv');
|
||||||
|
$snmp3_auth_method = get_parameter('snmp3_auth_method', 'MD5');
|
||||||
|
$snmp3_auth_pass = get_parameter('snmp3_auth_pass', '');
|
||||||
|
$snmp3_privacy_method = get_parameter('snmp3_privacy_method', 'AES');
|
||||||
|
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass', '');
|
||||||
|
|
||||||
// SNMP v3 options
|
|
||||||
$table3 = new stdClass();
|
$table3 = new stdClass();
|
||||||
$table3->width = '100%';
|
$table3->width = '100%';
|
||||||
|
|
||||||
|
@ -767,18 +802,69 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
$table3->valign[1] = '';
|
$table3->valign[1] = '';
|
||||||
|
|
||||||
$table3->data[2][1] = '<b>'.__('Auth user').'</b>';
|
$table3->data[2][1] = '<b>'.__('Auth user').'</b>';
|
||||||
$table3->data[2][2] = html_print_input_text('snmp3_browser_auth_user', '', '', 15, 60, true);
|
$table3->data[2][2] = html_print_input_text(
|
||||||
|
'snmp3_browser_auth_user',
|
||||||
|
$snmp3_auth_user,
|
||||||
|
'',
|
||||||
|
15,
|
||||||
|
60,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table3->data[2][3] = '<b>'.__('Auth password').'</b>';
|
$table3->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||||
$table3->data[2][4] = html_print_input_password('snmp3_browser_auth_pass', '', '', 15, 60, true);
|
$table3->data[2][4] = html_print_input_password(
|
||||||
$table3->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_fsb', true);
|
'snmp3_browser_auth_pass',
|
||||||
|
$snmp3_auth_pass,
|
||||||
|
'',
|
||||||
|
15,
|
||||||
|
60,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$table3->data[2][4] .= html_print_input_hidden_extended(
|
||||||
|
'active_snmp_v3',
|
||||||
|
0,
|
||||||
|
'active_snmp_v3_fsb',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table3->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
$table3->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||||
$table3->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_browser_privacy_method', '', '', '', '', true);
|
$table3->data[5][1] = html_print_select(
|
||||||
|
[
|
||||||
|
'DES' => __('DES'),
|
||||||
|
'AES' => __('AES'),
|
||||||
|
],
|
||||||
|
'snmp3_browser_privacy_method',
|
||||||
|
$snmp3_privacy_method,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table3->data[5][2] = '<b>'.__('Privacy pass').'</b>';
|
$table3->data[5][2] = '<b>'.__('Privacy pass').'</b>';
|
||||||
$table3->data[5][3] = html_print_input_password('snmp3_browser_privacy_pass', '', '', 15, 60, true);
|
$table3->data[5][3] = html_print_input_password(
|
||||||
|
'snmp3_browser_privacy_pass',
|
||||||
|
$snmp3_privacy_pass,
|
||||||
|
'',
|
||||||
|
15,
|
||||||
|
60,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table3->data[6][0] = '<b>'.__('Auth method').'</b>';
|
$table3->data[6][0] = '<b>'.__('Auth method').'</b>';
|
||||||
$table3->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_browser_auth_method', '', '', '', '', true);
|
$table3->data[6][1] = html_print_select(
|
||||||
|
[
|
||||||
|
'MD5' => __('MD5'),
|
||||||
|
'SHA' => __('SHA'),
|
||||||
|
],
|
||||||
|
'snmp3_browser_auth_method',
|
||||||
|
$snmp3_auth_method,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$table3->data[6][2] = '<b>'.__('Security level').'</b>';
|
$table3->data[6][2] = '<b>'.__('Security level').'</b>';
|
||||||
$table3->data[6][3] = html_print_select(
|
$table3->data[6][3] = html_print_select(
|
||||||
[
|
[
|
||||||
|
@ -787,29 +873,92 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
'authPriv' => __('Auth and privacy method'),
|
'authPriv' => __('Auth and privacy method'),
|
||||||
],
|
],
|
||||||
'snmp3_browser_security_level',
|
'snmp3_browser_security_level',
|
||||||
'',
|
$snmp3_security_level,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Search tools
|
// Search tools.
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
$table2->width = '100%';
|
$table2->width = '100%';
|
||||||
$table2->class = 'databox filters';
|
$table2->class = 'databox filters';
|
||||||
$table2->size = [];
|
$table2->size = [];
|
||||||
$table2->data = [];
|
$table2->data = [];
|
||||||
|
|
||||||
$table2->data[0][0] = html_print_input_text('search_text', '', '', 25, 0, true);
|
$table2->data[0][0] = html_print_input_text(
|
||||||
$table2->data[0][0] .= '<a href="javascript:">'.html_print_image('images/zoom.png', true, ['title' => __('Search'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchText();']).'</a>';
|
'search_text',
|
||||||
$table2->data[0][1] = ' '.'<a href="javascript:">'.html_print_image('images/go_first.png', true, ['title' => __('First match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchFirstMatch();']).'</a>';
|
'',
|
||||||
$table2->data[0][1] .= ' '.'<a href="javascript:">'.html_print_image('images/go_previous.png', true, ['title' => __('Previous match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchPrevMatch();']).'</a>';
|
'',
|
||||||
$table2->data[0][1] .= ' '.'<a href="javascript:">'.html_print_image('images/go_next.png', true, ['title' => __('Next match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchNextMatch();']).'</a>';
|
25,
|
||||||
$table2->data[0][1] .= ' '.'<a href="javascript:">'.html_print_image('images/go_last.png', true, ['title' => __('Last match'), 'style' => 'vertical-align: middle;', 'onclick' => 'searchLastMatch();']).'</a>';
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table2->data[0][0] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][0] .= html_print_image(
|
||||||
|
'images/zoom.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Search'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'searchText();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][0] .= '</a>';
|
||||||
|
|
||||||
|
$table2->data[0][1] = ' ';
|
||||||
|
$table2->data[0][1] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][1] .= html_print_image(
|
||||||
|
'images/go_first.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('First match'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'searchFirstMatch();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][1] .= '</a>';
|
||||||
|
$table2->data[0][1] .= ' ';
|
||||||
|
$table2->data[0][1] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][1] .= html_print_image(
|
||||||
|
'images/go_previous.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Previous match'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'searchPrevMatch();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][1] .= '</a>';
|
||||||
|
$table2->data[0][1] .= ' ';
|
||||||
|
$table2->data[0][1] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][1] .= html_print_image(
|
||||||
|
'images/go_next.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Next match'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'searchNextMatch();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][1] .= '</a>';
|
||||||
|
$table2->data[0][1] .= ' ';
|
||||||
|
$table2->data[0][1] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][1] .= html_print_image(
|
||||||
|
'images/go_last.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Last match'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'searchLastMatch();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][1] .= '</a>';
|
||||||
$table2->cellstyle[0][1] = 'text-align:center;';
|
$table2->cellstyle[0][1] = 'text-align:center;';
|
||||||
|
|
||||||
$table2->data[0][2] = ' '.'<a href="javascript:">'.html_print_image(
|
$table2->data[0][2] = ' ';
|
||||||
|
$table2->data[0][2] .= '<a href="javascript:">'.html_print_image(
|
||||||
'images/expand.png',
|
'images/expand.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
@ -817,8 +966,20 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
'style' => 'vertical-align: middle;',
|
'style' => 'vertical-align: middle;',
|
||||||
'onclick' => 'expandAll();',
|
'onclick' => 'expandAll();',
|
||||||
]
|
]
|
||||||
).'</a>';
|
);
|
||||||
$table2->data[0][2] .= ' '.'<a href="javascript:">'.html_print_image('images/collapse.png', true, ['title' => __('Collapse the tree'), 'style' => 'vertical-align: middle;', 'onclick' => 'collapseAll();']).'</a>';
|
$table2->data[0][2] .= '</a>';
|
||||||
|
$table2->data[0][2] .= ' ';
|
||||||
|
$table2->data[0][2] .= '<a href="javascript:">';
|
||||||
|
$table2->data[0][2] .= html_print_image(
|
||||||
|
'images/collapse.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Collapse the tree'),
|
||||||
|
'style' => 'vertical-align: middle;',
|
||||||
|
'onclick' => 'collapseAll();',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$table2->data[0][2] .= '</a>';
|
||||||
$table2->cellstyle[0][2] = 'text-align:center;';
|
$table2->cellstyle[0][2] = 'text-align:center;';
|
||||||
|
|
||||||
// This extra div that can be handled by jquery's dialog.
|
// This extra div that can be handled by jquery's dialog.
|
||||||
|
@ -828,7 +989,7 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
$output .= html_print_table($table, true);
|
$output .= html_print_table($table, true);
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
|
|
||||||
if (!isset($snmp_version)) {
|
if (isset($snmp_version) === false) {
|
||||||
$snmp_version = null;
|
$snmp_version = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,20 +999,42 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
$output .= '<div id="snmp3_browser_options" style="display: none;">';
|
$output .= '<div id="snmp3_browser_options" style="display: none;">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= ui_toggle(html_print_table($table3, true), __('SNMP v3 options'), '', '', true, true);
|
$output .= ui_toggle(
|
||||||
|
html_print_table($table3, true),
|
||||||
|
__('SNMP v3 options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
$output .= '<div style="width: 100%; padding-top: 10px;">';
|
$output .= '<div style="width: 100%; padding-top: 10px;">';
|
||||||
$output .= ui_toggle(html_print_table($table2, true), __('Search options'), '', '', true, true);
|
$output .= ui_toggle(
|
||||||
|
html_print_table($table2, true),
|
||||||
|
__('Search options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
|
|
||||||
// SNMP tree container
|
// SNMP tree container.
|
||||||
$output .= '<div style="width: 100%; height: 100%; margin-top: 5px; position: relative;">';
|
$output .= '<div style="width: 100%; height: 100%; margin-top: 5px; position: relative;">';
|
||||||
$output .= html_print_input_hidden('search_count', 0, true);
|
$output .= html_print_input_hidden('search_count', 0, true);
|
||||||
$output .= html_print_input_hidden('search_index', -1, true);
|
$output .= html_print_input_hidden('search_index', -1, true);
|
||||||
|
|
||||||
// Save some variables for javascript functions
|
// Save some variables for javascript functions.
|
||||||
$output .= html_print_input_hidden('ajax_url', ui_get_full_url('ajax.php'), true);
|
$output .= html_print_input_hidden(
|
||||||
$output .= html_print_input_hidden('search_matches_translation', __('Search matches'), true);
|
'ajax_url',
|
||||||
|
ui_get_full_url('ajax.php'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= html_print_input_hidden(
|
||||||
|
'search_matches_translation',
|
||||||
|
__('Search matches'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>';
|
$output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>';
|
||||||
$output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">'.html_print_image('images/spinner.gif', true).'</div>';
|
$output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">'.html_print_image('images/spinner.gif', true).'</div>';
|
||||||
|
@ -864,7 +1047,6 @@ function snmp_browser_print_container($return=false, $width='100%', $height='60%
|
||||||
|
|
||||||
if ($show_massive_buttons) {
|
if ($show_massive_buttons) {
|
||||||
$output .= '<div id="snmp_create_buttons" style="display:none">';
|
$output .= '<div id="snmp_create_buttons" style="display:none">';
|
||||||
|
|
||||||
$output .= html_print_submit_button(
|
$output .= html_print_submit_button(
|
||||||
__('Create agent modules'),
|
__('Create agent modules'),
|
||||||
'create_modules_agent',
|
'create_modules_agent',
|
||||||
|
|
|
@ -1,18 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* View charts.
|
||||||
|
*
|
||||||
|
* @category View charts Realtime.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// 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.
|
|
||||||
// Don't start a session before this import.
|
|
||||||
// The session is configured and started inside the config process.
|
|
||||||
require_once '../../include/config.php';
|
require_once '../../include/config.php';
|
||||||
require_once $config['homedir'].'/include/auth/mysql.php';
|
require_once $config['homedir'].'/include/auth/mysql.php';
|
||||||
require_once $config['homedir'].'/include/functions.php';
|
require_once $config['homedir'].'/include/functions.php';
|
||||||
|
@ -25,16 +38,18 @@ require_once $config['homedir'].'/include/functions_tags.php';
|
||||||
require_once $config['homedir'].'/include/functions_extensions.php';
|
require_once $config['homedir'].'/include/functions_extensions.php';
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
// Metaconsole connection to the node
|
// Metaconsole connection to the node.
|
||||||
$server_id = (int) get_parameter('server');
|
$server_id = (int) get_parameter('server');
|
||||||
if (is_metaconsole() && !empty($server_id)) {
|
if (is_metaconsole() && !empty($server_id)) {
|
||||||
$server = metaconsole_get_connection_by_id($server_id);
|
$server = metaconsole_get_connection_by_id($server_id);
|
||||||
|
|
||||||
// Error connecting
|
// Error connecting.
|
||||||
if (metaconsole_connect($server) !== NOERR) {
|
if (metaconsole_connect($server) !== NOERR) {
|
||||||
echo '<html>';
|
echo '<html>';
|
||||||
echo '<body>';
|
echo '<body>';
|
||||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
ui_print_error_message(
|
||||||
|
__('There was a problem connecting with the node')
|
||||||
|
);
|
||||||
echo '</body>';
|
echo '</body>';
|
||||||
echo '</html>';
|
echo '</html>';
|
||||||
exit;
|
exit;
|
||||||
|
@ -43,7 +58,9 @@ if (is_metaconsole() && !empty($server_id)) {
|
||||||
|
|
||||||
$user_language = get_user_language($config['id_user']);
|
$user_language = get_user_language($config['id_user']);
|
||||||
if (file_exists('../../include/languages/'.$user_language.'.mo')) {
|
if (file_exists('../../include/languages/'.$user_language.'.mo')) {
|
||||||
$l10n = new gettext_reader(new CachedFileReader('../../include/languages/'.$user_language.'.mo'));
|
$l10n = new gettext_reader(
|
||||||
|
new CachedFileReader('../../include/languages/'.$user_language.'.mo')
|
||||||
|
);
|
||||||
$l10n->load_tables();
|
$l10n->load_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +70,7 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<?php
|
<?php
|
||||||
// Parsing the refresh before sending any header
|
// Parsing the refresh before sending any header.
|
||||||
$refresh = (int) get_parameter('refresh', -1);
|
$refresh = (int) get_parameter('refresh', -1);
|
||||||
if ($refresh > 0) {
|
if ($refresh > 0) {
|
||||||
$query = ui_get_url_refresh(false);
|
$query = ui_get_url_refresh(false);
|
||||||
|
@ -70,7 +87,7 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
|
||||||
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||||
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
|
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
|
||||||
<?php
|
<?php
|
||||||
// Include the javascript for the js charts library
|
// Include the javascript for the js charts library.
|
||||||
require_once $config['homedir'].'/include/graphs/functions_flot.php';
|
require_once $config['homedir'].'/include/graphs/functions_flot.php';
|
||||||
include_javascript_dependencies_flot_graph();
|
include_javascript_dependencies_flot_graph();
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue