2012-08-22 16:09:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 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 Lesser 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.
|
|
|
|
|
2015-09-07 11:49:13 +02:00
|
|
|
function treeview_printModuleTable($id_module, $server_data = false, $no_head = false) {
|
2013-01-09 10:25:07 +01:00
|
|
|
global $config;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($server_data)) {
|
2013-01-29 11:22:59 +01:00
|
|
|
$server_name = '';
|
|
|
|
$server_id = '';
|
|
|
|
$url_hash = '';
|
|
|
|
$console_url = '';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$server_name = $server_data['server_name'];
|
|
|
|
$server_id = $server_data['id'];
|
|
|
|
$console_url = $server_data['server_url'] . '/';
|
|
|
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
require_once ($config["homedir"] . "/include/functions_agents.php");
|
|
|
|
require_once ($config["homedir"] . "/include/functions_graph.php");
|
|
|
|
include_graphs_dependencies($config['homedir'].'/');
|
|
|
|
require_once ($config['homedir'] . "/include/functions_groups.php");
|
|
|
|
require_once ($config['homedir'] . "/include/functions_servers.php");
|
|
|
|
enterprise_include_once ('meta/include/functions_modules_meta.php');
|
|
|
|
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
|
|
|
enterprise_include_once ('meta/include/functions_metaconsole.php');
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
$user_access_node = can_user_access_node ();
|
|
|
|
|
|
|
|
if (is_metaconsole()) {
|
|
|
|
if (metaconsole_connect($server_data) != NOERR)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
$filter["id_agente_modulo"] = $id_module;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
$module = db_get_row_filter ("tagente_modulo", $filter);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
if ($module === false) {
|
2013-05-23 17:42:32 +02:00
|
|
|
ui_print_error_message(__('There was a problem loading module'));
|
2013-01-29 11:22:59 +01:00
|
|
|
return;
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$table = new StdClass();
|
|
|
|
$table->width = "100%";
|
2015-06-25 10:40:35 +02:00
|
|
|
$table->class = "databox data";
|
2015-01-30 20:04:56 +01:00
|
|
|
$table->style = array();
|
|
|
|
$table->style['title'] = 'font-weight: bold;';
|
2015-09-07 11:49:13 +02:00
|
|
|
|
|
|
|
if (!$no_head) {
|
|
|
|
$table->head = array();
|
|
|
|
$table->head[] = __('Module');
|
|
|
|
}
|
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$table->head_colspan[] = 2;
|
|
|
|
$table->data = array();
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
//Module name
|
2013-01-29 11:22:59 +01:00
|
|
|
if ($module["disabled"])
|
2017-01-19 12:44:44 +01:00
|
|
|
$cellName = "<em>" . ui_print_truncate_text (io_safe_output($module["nombre"]), GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
2013-01-29 11:22:59 +01:00
|
|
|
else
|
2017-01-19 12:44:44 +01:00
|
|
|
$cellName = ui_print_truncate_text (io_safe_output($module["nombre"]), GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Name');
|
|
|
|
$row['data'] = "<b>".$cellName."</b>";
|
|
|
|
$table->data['name'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Interval
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Interval');
|
|
|
|
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
|
|
|
|
$table->data['interval'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Warning Min/Max
|
|
|
|
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
2015-01-30 20:04:56 +01:00
|
|
|
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-08-28 16:26:43 +02:00
|
|
|
$warning_status_str = __('Min.') . ': ' . (float)$module['min_warning'] . '<br>' . __('Max.') . ': ' . (float)$module['max_warning'];
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Warning status');
|
|
|
|
$row['data'] = $warning_status_str;
|
|
|
|
$table->data['watning_status'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Critical Min/Max
|
|
|
|
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
2015-01-30 20:04:56 +01:00
|
|
|
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-08-28 16:26:43 +02:00
|
|
|
$critical_status_str = __('Min.') . ': ' . (float)$module['min_critical'] . '<br>' . __('Max.') . ': ' . (float)$module['max_critical'];
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Critical status');
|
|
|
|
$row['data'] = $critical_status_str;
|
|
|
|
$table->data['critical_status'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Module group
|
2013-01-29 11:22:59 +01:00
|
|
|
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
2015-01-30 20:04:56 +01:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
if ($module_group === false)
|
2015-01-30 20:04:56 +01:00
|
|
|
$module_group = __('Not assigned');
|
2013-01-29 11:22:59 +01:00
|
|
|
else
|
2015-01-30 20:04:56 +01:00
|
|
|
$module_group = __("$module_group");
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Module group');
|
|
|
|
$row['data'] = $module_group;
|
|
|
|
$table->data['module_group'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Description
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Description');
|
|
|
|
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
|
|
|
|
$table->data['description'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Tags
|
|
|
|
$tags = tags_get_module_tags($module['id_agente_modulo']);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($tags)) {
|
2013-05-30 17:48:22 +02:00
|
|
|
$tags = array();
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2014-09-30 12:11:10 +02:00
|
|
|
$user_tags = tags_get_user_tags($config["id_user"]);
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
foreach ($tags as $k => $v) {
|
2014-09-30 12:11:10 +02:00
|
|
|
if (!array_key_exists($v, $user_tags)) { //only show user's tags.
|
2013-05-30 17:48:22 +02:00
|
|
|
unset($tags[$k]);
|
2017-01-13 10:46:09 +01:00
|
|
|
}
|
|
|
|
else {
|
2014-09-30 12:11:10 +02:00
|
|
|
$tag_name = tags_get_name($v);
|
|
|
|
if (empty($tag_name)) {
|
|
|
|
unset($tags[$k]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tags[$k] = $tag_name;
|
|
|
|
}
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($tags)) {
|
2013-05-30 17:48:22 +02:00
|
|
|
$tags = '<i>' . __('N/A') . '</i>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tags = implode(', ' , $tags);
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Tags');
|
|
|
|
$row['data'] = $tags;
|
|
|
|
$table->data['tags'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Data
|
|
|
|
$last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC')));
|
2015-10-13 12:13:17 +02:00
|
|
|
if ($config["render_proc"]) {
|
2015-10-13 12:35:40 +02:00
|
|
|
switch($module["id_tipo_modulo"]) {
|
|
|
|
case 2:
|
|
|
|
case 6:
|
|
|
|
case 9:
|
|
|
|
case 18:
|
|
|
|
case 21:
|
|
|
|
case 31:
|
|
|
|
if (is_numeric($last_data["datos"]) && $last_data["datos"] >= 1) {
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" . $config["render_proc_ok"] . "</span>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" . $config["render_proc_fail"] . "</span>";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2016-10-26 16:17:02 +02:00
|
|
|
//~ if (is_numeric($last_data["datos"]))
|
2016-11-08 12:39:28 +01:00
|
|
|
//~ $data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . "</span>";
|
2016-10-26 16:17:02 +02:00
|
|
|
//~ else
|
|
|
|
//~ $data = "<span title='" . $last_data["datos"] . "' style='white-space: nowrap;'>" . substr(io_safe_output($last_data['datos']),0,12) . "</span>";
|
2016-11-08 12:39:28 +01:00
|
|
|
switch($module['id_tipo_modulo']) {
|
|
|
|
case 15:
|
|
|
|
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
|
|
|
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0')
|
|
|
|
$data = "<span title='" . $last_data["datos"] .
|
|
|
|
"' style='white-space: nowrap;'>" . human_milliseconds_to_string($last_data['datos']) . "</span>";
|
|
|
|
else
|
|
|
|
if (is_numeric($last_data["datos"]))
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" .
|
|
|
|
remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . "</span>";
|
|
|
|
else
|
2017-01-11 13:12:46 +01:00
|
|
|
$data = ui_print_truncate_text(io_safe_output($last_data['datos']),
|
|
|
|
GENERIC_SIZE_TEXT, true, true,
|
|
|
|
true, '...', 'white-space: nowrap;');
|
2016-11-08 12:39:28 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (is_numeric($last_data["datos"]))
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" .
|
|
|
|
remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . "</span>";
|
|
|
|
else
|
2017-01-11 13:12:46 +01:00
|
|
|
$data = ui_print_truncate_text(io_safe_output($last_data['datos']),
|
|
|
|
GENERIC_SIZE_TEXT, true, true,
|
|
|
|
true, '...', 'white-space: nowrap;');
|
2016-11-08 12:39:28 +01:00
|
|
|
break;
|
|
|
|
}
|
2016-10-26 16:17:02 +02:00
|
|
|
break;
|
2015-10-13 12:21:01 +02:00
|
|
|
}
|
2015-10-13 12:13:17 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-11-08 12:39:28 +01:00
|
|
|
switch($module['id_tipo_modulo']) {
|
|
|
|
case 15:
|
|
|
|
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
|
|
|
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0')
|
|
|
|
$data = "<span title='" . human_milliseconds_to_string($last_data['datos']) .
|
|
|
|
"' style='white-space: nowrap;'>" . human_milliseconds_to_string($last_data['datos']) . "</span>";
|
|
|
|
else
|
|
|
|
if (is_numeric($last_data["datos"]))
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" .
|
|
|
|
remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . "</span>";
|
|
|
|
else
|
2017-01-11 13:12:46 +01:00
|
|
|
$data = ui_print_truncate_text(io_safe_output($last_data['datos']),
|
|
|
|
GENERIC_SIZE_TEXT, true, true, true,
|
|
|
|
'...', 'white-space: nowrap;');
|
2016-11-08 12:39:28 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (is_numeric($last_data["datos"]))
|
|
|
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" .
|
|
|
|
remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . "</span>";
|
|
|
|
else
|
2017-01-11 13:12:46 +01:00
|
|
|
$data = ui_print_truncate_text(io_safe_output($last_data['datos']),
|
|
|
|
GENERIC_SIZE_TEXT, true, true, true,
|
|
|
|
'...', 'white-space: nowrap;');
|
2016-11-08 12:39:28 +01:00
|
|
|
break;
|
2017-01-11 13:12:46 +01:00
|
|
|
}
|
2015-10-13 12:13:17 +02:00
|
|
|
}
|
2013-05-30 17:48:22 +02:00
|
|
|
if (!empty($last_data['utimestamp'])) {
|
2015-01-30 20:04:56 +01:00
|
|
|
$last_data_str = $data;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
if ($module['unit'] != '') {
|
2017-09-14 12:10:41 +02:00
|
|
|
$data_macro = modules_get_unit_macro($last_data["datos"],$module['unit']);
|
|
|
|
if($data_macro){
|
|
|
|
if (is_numeric($data_macro))
|
|
|
|
$last_data_str = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" .
|
|
|
|
remove_right_zeros(number_format($data_macro, $config['graph_precision'])) . "</span>";
|
|
|
|
else
|
|
|
|
$last_data_str = ui_print_truncate_text(io_safe_output($data_macro),
|
|
|
|
GENERIC_SIZE_TEXT, true, true, true,
|
|
|
|
'...', 'white-space: nowrap;');
|
|
|
|
} else {
|
|
|
|
$last_data_str .= " ";
|
|
|
|
$last_data_str .= '('.$module['unit'].')';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$last_data_str .= " ";
|
|
|
|
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
2016-12-07 17:08:32 +01:00
|
|
|
|
2018-08-02 13:02:33 +02:00
|
|
|
$is_snapshot = is_snapshot_data ( $last_data["datos"] );
|
|
|
|
$is_large_image = is_text_to_black_string ($last_data["datos"]);
|
|
|
|
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
|
|
|
|
$link = ui_get_snapshot_link( array(
|
|
|
|
'id_module' => $module['id_agente_modulo'],
|
|
|
|
'interval' => $module['current_interval'],
|
2018-08-02 13:42:39 +02:00
|
|
|
'module_name' => $module['module_name'],
|
|
|
|
'id_node' => empty($server_id) ? 0 : $server_id
|
2018-08-02 13:02:33 +02:00
|
|
|
));
|
|
|
|
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
|
|
|
}
|
2018-11-08 09:32:38 +01:00
|
|
|
|
|
|
|
if($salida !== NULL){
|
|
|
|
$last_data_str = html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
|
|
|
}
|
|
|
|
|
2018-08-02 13:02:33 +02:00
|
|
|
$last_data_str .= $salida;
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-01-30 20:04:56 +01:00
|
|
|
$last_data_str = '<i>' . __('No data') . '</i>';
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Last data');
|
|
|
|
$row['data'] = $last_data_str;
|
|
|
|
$table->data['last_data'] = $row;
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
//End of table
|
2015-01-30 20:04:56 +01:00
|
|
|
html_print_table($table);
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
$id_group = agents_get_agent_group($module['id_agente']);
|
2015-08-28 16:26:43 +02:00
|
|
|
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
|
|
|
$agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']);
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
if ($user_access_node && check_acl ($config["id_user"], $id_group, 'AW')) {
|
2013-05-28 17:18:41 +02:00
|
|
|
// Actions table
|
2015-01-30 20:04:56 +01:00
|
|
|
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
|
|
|
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
2013-05-30 17:48:22 +02:00
|
|
|
html_print_submit_button (__('Go to module edition'), 'upd_button', false, 'class="sub config"');
|
2015-01-30 20:04:56 +01:00
|
|
|
echo '</a>';
|
2013-03-15 10:30:46 +01:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
echo '</div>';
|
2013-05-28 17:18:41 +02:00
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2013-05-28 17:18:41 +02:00
|
|
|
//id_module and id_agent hidden
|
|
|
|
echo '<div id="ids" style="display:none;">';
|
|
|
|
html_print_input_text('id_module', $id_module);
|
|
|
|
html_print_input_text('id_agent', $module['id_agente']);
|
|
|
|
html_print_input_text('server_name', $server_name);
|
|
|
|
echo '</div>';
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
if (!empty($server_data) && is_metaconsole()) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
|
2013-01-29 11:22:59 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-07 11:49:13 +02:00
|
|
|
function treeview_printAlertsTable($id_module, $server_data = array(), $no_head = false) {
|
2013-01-29 11:22:59 +01:00
|
|
|
global $config;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($server_data)) {
|
2013-01-29 11:22:59 +01:00
|
|
|
$server_name = '';
|
|
|
|
$server_id = '';
|
|
|
|
$url_hash = '';
|
|
|
|
$console_url = '';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$server_name = $server_data['server_name'];
|
|
|
|
$server_id = $server_data['id'];
|
|
|
|
$console_url = $server_data['server_url'] . '/';
|
|
|
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
$user_access_node = can_user_access_node ();
|
|
|
|
|
|
|
|
if (is_metaconsole()) {
|
|
|
|
if (metaconsole_connect($server_data) != NOERR)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-09 10:25:07 +01:00
|
|
|
$module_alerts = alerts_get_alerts_agent_module($id_module);
|
|
|
|
$module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
|
|
|
$agent_id = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
2013-05-30 17:48:22 +02:00
|
|
|
$id_group = agents_get_agent_group($agent_id);
|
|
|
|
|
2013-01-09 10:25:07 +01:00
|
|
|
if ($module_alerts === false) {
|
2013-05-23 17:42:32 +02:00
|
|
|
ui_print_error_message(__('There was a problem loading alerts'));
|
2013-01-09 10:25:07 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$table = new StdClass();
|
|
|
|
$table->width = "100%";
|
2015-09-07 11:49:13 +02:00
|
|
|
$table->class = "databox data";
|
|
|
|
$table->rowstyle = array();
|
|
|
|
$table->rowstyle['titles'] = 'font-weight: bold;';
|
|
|
|
|
|
|
|
if (!$no_head) {
|
|
|
|
$table->head = array();
|
|
|
|
$table->head[] = __('Alerts') . ": " . $module_name;
|
|
|
|
}
|
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$table->head_colspan[] = 2;
|
|
|
|
$table->data = array();
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['template'] = __('Template');
|
|
|
|
$row['actions'] = __('Actions');
|
|
|
|
$table->data['titles'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-09-07 11:49:13 +02:00
|
|
|
foreach ($module_alerts as $module_alert) {
|
2013-01-09 10:25:07 +01:00
|
|
|
//Template name
|
|
|
|
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-01-09 10:25:07 +01:00
|
|
|
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($actions)) {
|
2015-01-30 20:04:56 +01:00
|
|
|
$actions_list = '<i>'.__('N/A').'</i>';
|
2013-01-09 10:25:07 +01:00
|
|
|
}
|
|
|
|
else {
|
2015-01-30 20:04:56 +01:00
|
|
|
$actions_list = '<ul>';
|
2016-11-11 11:00:48 +01:00
|
|
|
foreach($actions as $act) {
|
2015-01-30 20:04:56 +01:00
|
|
|
$actions_list .= '<li>';
|
|
|
|
$actions_list .= $act['name'];
|
|
|
|
$actions_list .= '</li>';
|
2013-01-09 10:25:07 +01:00
|
|
|
}
|
2015-01-30 20:04:56 +01:00
|
|
|
$actions_list .= '</ul>';
|
2013-01-09 10:25:07 +01:00
|
|
|
}
|
2015-01-30 20:04:56 +01:00
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['template'] = $template_name;
|
|
|
|
$row['actions'] = $actions_list;
|
|
|
|
$table->data['last_data'] = $row;
|
2013-01-09 10:25:07 +01:00
|
|
|
}
|
2015-01-30 20:04:56 +01:00
|
|
|
|
|
|
|
html_print_table($table);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2016-11-11 11:00:48 +01:00
|
|
|
$table2 = new StdClass();
|
|
|
|
$table2->width = "100%";
|
|
|
|
$table2->class = "databox data";
|
|
|
|
$table2->rowstyle = array();
|
|
|
|
$table2->rowstyle['titles'] = 'font-weight: bold;';
|
|
|
|
|
|
|
|
$table2->head_colspan[] = 3;
|
|
|
|
$table2->data = array();
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['template'] = __('Template');
|
|
|
|
$row['times_fired'] = __('Times fired');
|
|
|
|
$row['last_fired'] = __('Last fired');
|
|
|
|
$table2->data['titles'] = $row;
|
2016-12-14 13:02:10 +01:00
|
|
|
|
2016-11-11 11:00:48 +01:00
|
|
|
foreach ($module_alerts as $module_alert) {
|
|
|
|
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
|
|
|
|
|
|
|
$times_fired = $module_alert['times_fired'];
|
|
|
|
|
|
|
|
$last_fired = date($config['date_format'], $module_alert['last_fired']);
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['template'] = $template_name;
|
|
|
|
$row['times_fired'] = $times_fired;
|
|
|
|
$row['last_fired'] = $last_fired;
|
|
|
|
$table2->data['last_data'] = $row;
|
|
|
|
}
|
|
|
|
html_print_table($table2);
|
|
|
|
|
2017-01-13 10:46:09 +01:00
|
|
|
if ($user_access_node && check_acl ($config["id_user"], $id_group, 'LW')) {
|
2013-05-28 17:18:41 +02:00
|
|
|
// Actions table
|
2015-01-30 20:04:56 +01:00
|
|
|
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
|
|
|
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
2013-05-30 17:48:22 +02:00
|
|
|
html_print_submit_button (__('Go to alerts edition'), 'upd_button', false, 'class="sub search"');
|
2015-01-30 20:04:56 +01:00
|
|
|
echo '</a>';
|
2013-05-30 17:48:22 +02:00
|
|
|
echo '</div>';
|
2013-05-28 17:18:41 +02:00
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
if (!empty($server_data) && is_metaconsole()) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2013-01-09 10:25:07 +01:00
|
|
|
}
|
|
|
|
|
2015-09-07 11:49:13 +02:00
|
|
|
function treeview_printTable($id_agente, $server_data = array(), $no_head = false) {
|
2012-08-22 16:09:05 +02:00
|
|
|
global $config;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if (empty($server_data)) {
|
2013-01-29 11:22:59 +01:00
|
|
|
$server_name = '';
|
|
|
|
$server_id = '';
|
|
|
|
$url_hash = '';
|
|
|
|
$console_url = '';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$server_name = $server_data['server_name'];
|
|
|
|
$server_id = $server_data['id'];
|
|
|
|
$console_url = $server_data['server_url'] . '/';
|
|
|
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
require_once ($config["homedir"] . "/include/functions_agents.php");
|
2012-08-22 16:09:05 +02:00
|
|
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
|
|
|
require_once ($config['homedir'] . '/include/functions_groups.php');
|
|
|
|
require_once ($config['homedir'] . '/include/functions_gis.php');
|
2015-02-26 19:16:29 +01:00
|
|
|
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
2014-12-18 16:22:38 +01:00
|
|
|
include_graphs_dependencies();
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
2012-08-22 16:09:05 +02:00
|
|
|
$is_extra = false;
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
|
|
|
$user_access_node = can_user_access_node ();
|
|
|
|
|
|
|
|
if (is_metaconsole()) {
|
|
|
|
if (metaconsole_connect($server_data) != NOERR)
|
|
|
|
return;
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2018-10-11 16:00:49 +02:00
|
|
|
// Get the agent info
|
2017-01-13 10:46:09 +01:00
|
|
|
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
2018-10-11 16:00:49 +02:00
|
|
|
if ($agent == false) return;
|
|
|
|
|
|
|
|
// Check all groups
|
2018-10-31 16:16:32 +01:00
|
|
|
$groups = agents_get_all_groups_agent($id_agente, $agent["id_grupo"]);
|
2018-10-11 16:00:49 +02:00
|
|
|
if (! check_acl_one_of_groups ($config["id_user"], $groups, "AR") && ! check_acl_one_of_groups ($config["id_user"], $groups, "AW") && !$is_extra) {
|
2015-08-28 16:26:43 +02:00
|
|
|
db_pandora_audit("ACL Violation",
|
2012-08-22 16:09:05 +02:00
|
|
|
"Trying to access Agent General Information");
|
|
|
|
require_once ("general/noaccess.php");
|
2018-10-31 16:16:32 +01:00
|
|
|
if (!empty($server_data) && is_metaconsole()) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
2012-08-22 16:09:05 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
if ($agent === false) {
|
|
|
|
ui_print_error_message(__('There was a problem loading agent'));
|
2018-10-31 16:16:32 +01:00
|
|
|
if (!empty($server_data) && is_metaconsole()) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
2014-12-18 16:22:38 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = new StdClass();
|
|
|
|
$table->width = "100%";
|
2015-07-02 15:31:53 +02:00
|
|
|
$table->class = "databox data";
|
2014-12-18 16:22:38 +01:00
|
|
|
$table->style = array();
|
|
|
|
$table->style['title'] = 'font-weight: bold;';
|
|
|
|
$table->head = array();
|
|
|
|
$table->data = array();
|
|
|
|
|
|
|
|
// Agent name
|
2012-08-22 16:09:05 +02:00
|
|
|
if ($agent['disabled']) {
|
2013-07-22 16:04:06 +02:00
|
|
|
$cellName = "<em>";
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-07-22 16:04:06 +02:00
|
|
|
$cellName = '';
|
|
|
|
}
|
2016-09-26 10:58:42 +02:00
|
|
|
|
2017-02-27 15:06:24 +01:00
|
|
|
if (is_metaconsole()) {
|
2017-02-27 17:23:02 +01:00
|
|
|
$pwd = $server_data["auth_token"]; // Create HASH login info
|
|
|
|
$user = $config["id_user"];
|
|
|
|
|
|
|
|
// Extract auth token from serialized field
|
|
|
|
$pwd_deserialiced = json_decode($pwd, true);
|
|
|
|
$hashdata = $user.$pwd_deserialiced['auth_token'];
|
|
|
|
|
|
|
|
$hashdata = md5($hashdata);
|
2018-11-07 12:29:37 +01:00
|
|
|
$url = $server_data["server_url"] . "/index.php?" .
|
2017-02-27 17:23:02 +01:00
|
|
|
"sec=estado&" .
|
|
|
|
"sec2=operation/agentes/ver_agente&" .
|
|
|
|
"id_agente=" . $agent["id_agente"] . "&" .
|
|
|
|
"loginhash=auto&" .
|
|
|
|
"loginhash_data=$hashdata&" .
|
|
|
|
"loginhash_user=" . str_rot13($user);
|
|
|
|
|
|
|
|
$cellName .= '<a href="'.$url.'">' .
|
2017-02-27 15:06:24 +01:00
|
|
|
'<b><span style="font-weight:bold;text-transform:uppercase;" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span></b></a>';
|
|
|
|
} else {
|
|
|
|
$cellName .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'">' .
|
|
|
|
'<b><span style="font-weight:bold;text-transform:uppercase;" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span></b></a>';
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-22 16:04:06 +02:00
|
|
|
if ($agent['disabled']) {
|
|
|
|
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
2014-12-18 16:22:38 +01:00
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Agent name');
|
|
|
|
$row['data'] = $cellName;
|
|
|
|
$table->data['name'] = $row;
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
//Addresses
|
|
|
|
$ips = array();
|
|
|
|
$addresses = agents_get_addresses ($id_agente);
|
|
|
|
$address = agents_get_address($id_agente);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
foreach ($addresses as $k => $add) {
|
|
|
|
if ($add == $address) {
|
2012-08-22 16:09:05 +02:00
|
|
|
unset($addresses[$k]);
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
if (!empty($addresses)) {
|
2014-12-18 16:22:38 +01:00
|
|
|
$address .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('IP Address');
|
|
|
|
$row['data'] = $address;
|
|
|
|
$table->data['address'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Agent Interval
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Interval');
|
|
|
|
$row['data'] = human_time_description_raw ($agent["intervalo"]);
|
|
|
|
$table->data['interval'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Comments
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Description');
|
|
|
|
$row['data'] = $agent["comentarios"];
|
|
|
|
$table->data['description'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Last contact
|
2014-12-18 16:22:38 +01:00
|
|
|
$last_contact = ui_print_timestamp($agent["ultimo_contacto"], true);
|
|
|
|
|
2015-08-28 16:26:43 +02:00
|
|
|
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
2014-12-18 16:22:38 +01:00
|
|
|
$last_remote_contact = __('Never');
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
|
|
|
else {
|
2014-12-18 16:22:38 +01:00
|
|
|
$last_remote_contact = ui_print_timestamp ($agent["ultimo_contacto_remoto"], true);
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2014-12-18 16:22:38 +01:00
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Last contact') . " / " . __('Remote');
|
|
|
|
$row['data'] = "$last_contact / $last_remote_contact";
|
|
|
|
$table->data['contact'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
// Next contact (agent)
|
|
|
|
$progress = agents_get_next_contact($id_agente);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Next agent contact');
|
|
|
|
$row['data'] = progress_bar($progress, 150, 20);
|
|
|
|
$table->data['next_contact'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
//End of table
|
2014-12-18 16:22:38 +01:00
|
|
|
$agent_table = html_print_table($table, true);
|
|
|
|
|
2017-01-13 10:46:09 +01:00
|
|
|
if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
2014-12-18 16:22:38 +01:00
|
|
|
$go_to_agent = '<div style="text-align: right;">';
|
2018-03-19 10:05:29 +01:00
|
|
|
|
2018-04-23 13:52:16 +02:00
|
|
|
if($agent["id_os"] != 100){
|
2018-11-07 12:29:37 +01:00
|
|
|
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
2018-03-19 10:05:29 +01:00
|
|
|
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$id_agente);
|
|
|
|
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1='.$id_agente.'">';
|
|
|
|
$go_to_agent .= html_print_submit_button (__('Edit cluster'), 'upd_button', false, 'class="sub config"', true);
|
|
|
|
}
|
|
|
|
|
2015-01-30 20:04:56 +01:00
|
|
|
$go_to_agent .= '</a>';
|
2014-12-18 16:22:38 +01:00
|
|
|
$go_to_agent .= '</div>';
|
|
|
|
|
|
|
|
$agent_table .= $go_to_agent;
|
2013-05-30 17:48:22 +02:00
|
|
|
}
|
2014-12-18 16:22:38 +01:00
|
|
|
$agent_table .= "<br>";
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
// print agent data toggle
|
|
|
|
ui_toggle($agent_table, __('Agent data'), '', false);
|
|
|
|
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
// Advanced data
|
|
|
|
$table = new StdClass();
|
|
|
|
$table->width = "100%";
|
|
|
|
$table->style = array();
|
|
|
|
$table->style['title'] = 'font-weight: bold;';
|
|
|
|
$table->head = array();
|
|
|
|
$table->data = array();
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Agent version
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Agent Version');
|
|
|
|
$row['data'] = $agent["agent_version"];
|
|
|
|
$table->data['agent_version'] = $row;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Position Information
|
|
|
|
if ($config['activate_gis']) {
|
|
|
|
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
if ($dataPositionAgent !== false) {
|
|
|
|
$position = '<a href="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">';
|
2012-08-22 16:09:05 +02:00
|
|
|
if ($dataPositionAgent['description'] != "")
|
2014-12-18 16:22:38 +01:00
|
|
|
$position .= $dataPositionAgent['description'];
|
2012-08-22 16:09:05 +02:00
|
|
|
else
|
2014-12-18 16:22:38 +01:00
|
|
|
$position .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
|
|
|
|
$position .= "</a>";
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Position (Long, Lat)');
|
|
|
|
$row['data'] = $position;
|
|
|
|
$table->data['agent_position'] = $row;
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// If the url description is setted
|
|
|
|
if ($agent['url_address'] != '') {
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Url address');
|
|
|
|
$row['data'] = '<a href='.$agent["url_address"].'>'.$agent["url_address"].'</a>';
|
|
|
|
$table->data['agent_address'] = $row;
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Timezone Offset
|
|
|
|
if ($agent['timezone_offset'] != 0) {
|
2014-12-18 16:22:38 +01:00
|
|
|
$row = array();
|
|
|
|
$row['title'] = __('Timezone Offset');
|
|
|
|
$row['data'] = $agent["timezone_offset"];
|
|
|
|
$table->data['agent_timezone_offset'] = $row;
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
// Custom fields
|
|
|
|
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
|
|
|
if ($fields === false) {
|
|
|
|
$fields = array ();
|
|
|
|
}
|
|
|
|
if ($fields) {
|
|
|
|
foreach ($fields as $field) {
|
|
|
|
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
2014-12-18 16:22:38 +01:00
|
|
|
if (!empty($custom_value)) {
|
|
|
|
$row = array();
|
|
|
|
$row['title'] = $field['name'] . ui_print_help_tip (__('Custom field'), true);
|
2018-03-22 13:10:25 +01:00
|
|
|
if($field['is_password_type']){
|
|
|
|
$row['data'] = '••••••••';
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$row['data'] = ui_bbcode_to_html($custom_value);
|
|
|
|
}
|
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
$table->data['custom_field_'.$field['id_field']] = $row;
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
//End of table advanced
|
2014-12-18 16:22:38 +01:00
|
|
|
$table_advanced = html_print_table($table, true);
|
|
|
|
$table_advanced .= "<br>";
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2014-12-18 16:22:38 +01:00
|
|
|
ui_toggle($table_advanced, __('Advanced information'));
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
if ($config["agentaccess"]) {
|
2018-06-14 12:17:16 +02:00
|
|
|
$access_graph = '<div style="width:100%; height:130px;">';
|
2018-11-23 10:32:58 +01:00
|
|
|
$access_graph .= graphic_agentaccess ($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
2018-06-14 12:17:16 +02:00
|
|
|
$access_graph .= '</div>';
|
2013-05-30 17:48:22 +02:00
|
|
|
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
2012-08-22 16:09:05 +02:00
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2018-11-23 10:32:58 +01:00
|
|
|
$events_graph = '<div style="margin-left:10px; width:100%;">';
|
|
|
|
$events_graph .= graph_graphic_agentevents ($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true);
|
2014-12-18 16:22:38 +01:00
|
|
|
$events_graph .= '</div><br>';
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
ui_toggle($events_graph, __('Events (24h)'));
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-02-02 13:27:32 +01:00
|
|
|
// Table network interfaces
|
|
|
|
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-02-02 13:27:32 +01:00
|
|
|
$network_interfaces = array();
|
|
|
|
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
|
|
|
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($network_interfaces)) {
|
|
|
|
$table = new stdClass();
|
|
|
|
$table->id = 'agent_interface_info';
|
|
|
|
$table->class = 'databox';
|
|
|
|
$table->width = '100%';
|
|
|
|
$table->style = array();
|
|
|
|
$table->style['interface_status'] = 'width: 30px;';
|
|
|
|
$table->style['interface_graph'] = 'width: 20px;';
|
|
|
|
$table->head = array();
|
|
|
|
$table->data = array();
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-02-02 13:27:32 +01:00
|
|
|
foreach ($network_interfaces as $interface_name => $interface) {
|
2015-03-25 12:26:16 +01:00
|
|
|
if (!empty($interface['traffic'])) {
|
2018-10-08 17:19:46 +02:00
|
|
|
$permission = check_acl($config['id_user'], $agent["id_grupo"], "RR");
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-03-25 12:26:16 +01:00
|
|
|
if ($permission) {
|
|
|
|
$params = array(
|
|
|
|
'interface_name' => $interface_name,
|
|
|
|
'agent_id' => $id_agente,
|
|
|
|
'traffic_module_in' => $interface['traffic']['in'],
|
|
|
|
'traffic_module_out' => $interface['traffic']['out']
|
|
|
|
);
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-03-25 12:26:16 +01:00
|
|
|
if (defined('METACONSOLE') && !empty($server_id))
|
|
|
|
$params["server"] = $server_id;
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-03-25 12:26:16 +01:00
|
|
|
$params_json = json_encode($params);
|
|
|
|
$params_encoded = base64_encode($params_json);
|
|
|
|
$url = ui_get_full_url("operation/agentes/interface_traffic_graph_win.php", false, false, false);
|
|
|
|
$graph_url = "$url?params=$params_encoded";
|
|
|
|
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-03-25 12:26:16 +01:00
|
|
|
$graph_link = "<a href=\"javascript:winopeng('$graph_url','$win_handle')\">" .
|
|
|
|
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$graph_link = "";
|
|
|
|
}
|
2015-02-02 13:27:32 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$graph_link = "";
|
|
|
|
}
|
2015-08-28 16:26:43 +02:00
|
|
|
|
2015-02-02 13:27:32 +01:00
|
|
|
$data = array();
|
|
|
|
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
|
|
|
$data['interface_status'] = $interface['status_image'];
|
|
|
|
$data['interface_graph'] = $graph_link;
|
|
|
|
$data['interface_ip'] = $interface['ip'];
|
|
|
|
$data['interface_mac'] = $interface['mac'];
|
|
|
|
$table->data[] = $data;
|
|
|
|
}
|
|
|
|
//End of table network interfaces
|
|
|
|
$table_interfaces = html_print_table($table, true);
|
|
|
|
$table_interfaces .= "<br>";
|
|
|
|
|
|
|
|
ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)');
|
|
|
|
}
|
2017-01-13 10:46:09 +01:00
|
|
|
if (!empty($server_data) && is_metaconsole()) {
|
|
|
|
metaconsole_restore_db();
|
|
|
|
}
|
2012-08-22 16:09:05 +02:00
|
|
|
return;
|
|
|
|
}
|
2012-11-26 17:44:41 +01:00
|
|
|
?>
|