Fixed format error in tree view. Ticket#2642
This commit is contained in:
parent
add2e74e2b
commit
b2ead0c430
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
function treeview_printModuleTable($id_module, $server_data = false) {
|
function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (empty($server_data)) {
|
if (empty($server_data)) {
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = '';
|
$server_id = '';
|
||||||
|
@ -29,7 +29,7 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
$console_url = $server_data['server_url'] . '/';
|
$console_url = $server_data['server_url'] . '/';
|
||||||
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ($config["homedir"] . "/include/functions_agents.php");
|
require_once ($config["homedir"] . "/include/functions_agents.php");
|
||||||
require_once ($config["homedir"] . "/include/functions_graph.php");
|
require_once ($config["homedir"] . "/include/functions_graph.php");
|
||||||
include_graphs_dependencies($config['homedir'].'/');
|
include_graphs_dependencies($config['homedir'].'/');
|
||||||
|
@ -38,23 +38,23 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
enterprise_include_once ('meta/include/functions_modules_meta.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_ui_meta.php');
|
||||||
enterprise_include_once ('meta/include/functions_metaconsole.php');
|
enterprise_include_once ('meta/include/functions_metaconsole.php');
|
||||||
|
|
||||||
$filter["id_agente_modulo"] = $id_module;
|
$filter["id_agente_modulo"] = $id_module;
|
||||||
|
|
||||||
$module = db_get_row_filter ("tagente_modulo", $filter);
|
$module = db_get_row_filter ("tagente_modulo", $filter);
|
||||||
|
|
||||||
if ($module === false) {
|
if ($module === false) {
|
||||||
ui_print_error_message(__('There was a problem loading module'));
|
ui_print_error_message(__('There was a problem loading module'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! check_acl ($config["id_user"], $module["id_grupo"], "AR")) {
|
if (! check_acl ($config["id_user"], $module["id_grupo"], "AR")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Module Information");
|
"Trying to access Module Information");
|
||||||
require_once ("general/noaccess.php");
|
require_once ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->width = "100%";
|
$table->width = "100%";
|
||||||
$table->class = "databox data";
|
$table->class = "databox data";
|
||||||
|
@ -64,49 +64,49 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
$table->head[] = __('Module');
|
$table->head[] = __('Module');
|
||||||
$table->head_colspan[] = 2;
|
$table->head_colspan[] = 2;
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
//Module name
|
//Module name
|
||||||
if ($module["disabled"])
|
if ($module["disabled"])
|
||||||
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
||||||
else
|
else
|
||||||
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Name');
|
$row['title'] = __('Name');
|
||||||
$row['data'] = "<b>".$cellName."</b>";
|
$row['data'] = "<b>".$cellName."</b>";
|
||||||
$table->data['name'] = $row;
|
$table->data['name'] = $row;
|
||||||
|
|
||||||
// Interval
|
// Interval
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Interval');
|
$row['title'] = __('Interval');
|
||||||
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
|
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
|
||||||
$table->data['interval'] = $row;
|
$table->data['interval'] = $row;
|
||||||
|
|
||||||
// Warning Min/Max
|
// Warning Min/Max
|
||||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||||
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
|
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$warning_status_str = __('Min.') . ': ' . $module['min_warning'] . '<br>' . __('Max.') . ': ' . $module['max_warning'];
|
$warning_status_str = __('Min.') . ': ' . (float)$module['min_warning'] . '<br>' . __('Max.') . ': ' . (float)$module['max_warning'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Warning status');
|
$row['title'] = __('Warning status');
|
||||||
$row['data'] = $warning_status_str;
|
$row['data'] = $warning_status_str;
|
||||||
$table->data['watning_status'] = $row;
|
$table->data['watning_status'] = $row;
|
||||||
|
|
||||||
// Critical Min/Max
|
// Critical Min/Max
|
||||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||||
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
|
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$critical_status_str = __('Min.') . ': ' . $module['min_critical'] . '<br>' . __('Max.') . ': ' . $module['max_critical'];
|
$critical_status_str = __('Min.') . ': ' . (float)$module['min_critical'] . '<br>' . __('Max.') . ': ' . (float)$module['max_critical'];
|
||||||
}
|
}
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Critical status');
|
$row['title'] = __('Critical status');
|
||||||
$row['data'] = $critical_status_str;
|
$row['data'] = $critical_status_str;
|
||||||
$table->data['critical_status'] = $row;
|
$table->data['critical_status'] = $row;
|
||||||
|
|
||||||
// Module group
|
// Module group
|
||||||
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
||||||
|
|
||||||
|
@ -114,27 +114,27 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
$module_group = __('Not assigned');
|
$module_group = __('Not assigned');
|
||||||
else
|
else
|
||||||
$module_group = __("$module_group");
|
$module_group = __("$module_group");
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Module group');
|
$row['title'] = __('Module group');
|
||||||
$row['data'] = $module_group;
|
$row['data'] = $module_group;
|
||||||
$table->data['module_group'] = $row;
|
$table->data['module_group'] = $row;
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Description');
|
$row['title'] = __('Description');
|
||||||
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
|
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
|
||||||
$table->data['description'] = $row;
|
$table->data['description'] = $row;
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
$tags = tags_get_module_tags($module['id_agente_modulo']);
|
$tags = tags_get_module_tags($module['id_agente_modulo']);
|
||||||
|
|
||||||
if (empty($tags)) {
|
if (empty($tags)) {
|
||||||
$tags = array();
|
$tags = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_tags = tags_get_user_tags($config["id_user"]);
|
$user_tags = tags_get_user_tags($config["id_user"]);
|
||||||
|
|
||||||
foreach ($tags as $k => $v) {
|
foreach ($tags as $k => $v) {
|
||||||
if (!array_key_exists($v, $user_tags)) { //only show user's tags.
|
if (!array_key_exists($v, $user_tags)) { //only show user's tags.
|
||||||
unset($tags[$k]);
|
unset($tags[$k]);
|
||||||
|
@ -148,53 +148,53 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($tags)) {
|
if (empty($tags)) {
|
||||||
$tags = '<i>' . __('N/A') . '</i>';
|
$tags = '<i>' . __('N/A') . '</i>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tags = implode(', ' , $tags);
|
$tags = implode(', ' , $tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Tags');
|
$row['title'] = __('Tags');
|
||||||
$row['data'] = $tags;
|
$row['data'] = $tags;
|
||||||
$table->data['tags'] = $row;
|
$table->data['tags'] = $row;
|
||||||
|
|
||||||
// Data
|
// 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')));
|
$last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC')));
|
||||||
if (is_numeric($last_data["datos"]))
|
if (is_numeric($last_data["datos"]))
|
||||||
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" . format_numeric($last_data["datos"]) . "</span>";
|
$data = "<span style='height: 20px; display: inline-table; vertical-align: top;'>" . format_numeric($last_data["datos"]) . "</span>";
|
||||||
else
|
else
|
||||||
$data = "<span title='" . $last_data["datos"] . "' style='white-space: nowrap;'>" . substr(io_safe_output($last_data['datos']),0,12) . "</span>";
|
$data = "<span title='" . $last_data["datos"] . "' style='white-space: nowrap;'>" . substr(io_safe_output($last_data['datos']),0,12) . "</span>";
|
||||||
|
|
||||||
if (!empty($last_data['utimestamp'])) {
|
if (!empty($last_data['utimestamp'])) {
|
||||||
$last_data_str = $data;
|
$last_data_str = $data;
|
||||||
|
|
||||||
if ($module['unit'] != '') {
|
if ($module['unit'] != '') {
|
||||||
$last_data_str .= " ";
|
$last_data_str .= " ";
|
||||||
$last_data_str .= '('.$module['unit'].')';
|
$last_data_str .= '('.$module['unit'].')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_data_str .= " ";
|
$last_data_str .= " ";
|
||||||
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$last_data_str = '<i>' . __('No data') . '</i>';
|
$last_data_str = '<i>' . __('No data') . '</i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Last data');
|
$row['title'] = __('Last data');
|
||||||
$row['data'] = $last_data_str;
|
$row['data'] = $last_data_str;
|
||||||
$table->data['last_data'] = $row;
|
$table->data['last_data'] = $row;
|
||||||
|
|
||||||
//End of table
|
//End of table
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
$id_group = agents_get_agent_group($module['id_agente']);
|
$id_group = agents_get_agent_group($module['id_agente']);
|
||||||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||||
$agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']);
|
$agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']);
|
||||||
|
|
||||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) {
|
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) {
|
||||||
// Actions table
|
// Actions table
|
||||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||||
|
@ -211,13 +211,13 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
||||||
html_print_input_text('id_agent', $module['id_agente']);
|
html_print_input_text('id_agent', $module['id_agente']);
|
||||||
html_print_input_text('server_name', $server_name);
|
html_print_input_text('server_name', $server_name);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function treeview_printAlertsTable($id_module, $server_data = array()) {
|
function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (empty($server_data)) {
|
if (empty($server_data)) {
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = '';
|
$server_id = '';
|
||||||
|
@ -230,7 +230,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
$console_url = $server_data['server_url'] . '/';
|
$console_url = $server_data['server_url'] . '/';
|
||||||
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_alerts = alerts_get_alerts_agent_module($id_module);
|
$module_alerts = alerts_get_alerts_agent_module($id_module);
|
||||||
$module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $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);
|
$agent_id = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
||||||
|
@ -240,7 +240,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
ui_print_error_message(__('There was a problem loading alerts'));
|
ui_print_error_message(__('There was a problem loading alerts'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->width = "100%";
|
$table->width = "100%";
|
||||||
$table->style = array();
|
$table->style = array();
|
||||||
|
@ -254,13 +254,13 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
$row['template'] = __('Template');
|
$row['template'] = __('Template');
|
||||||
$row['actions'] = __('Actions');
|
$row['actions'] = __('Actions');
|
||||||
$table->data['titles'] = $row;
|
$table->data['titles'] = $row;
|
||||||
|
|
||||||
foreach($module_alerts as $module_alert) {
|
foreach($module_alerts as $module_alert) {
|
||||||
//Template name
|
//Template name
|
||||||
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
||||||
|
|
||||||
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
|
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
|
||||||
|
|
||||||
if (empty($actions)) {
|
if (empty($actions)) {
|
||||||
$actions_list = '<i>'.__('N/A').'</i>';
|
$actions_list = '<i>'.__('N/A').'</i>';
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
|
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
|
||||||
// Actions table
|
// Actions table
|
||||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||||
|
@ -294,7 +294,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
||||||
|
|
||||||
function treeview_printTable($id_agente, $server_data = array()) {
|
function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (empty($server_data)) {
|
if (empty($server_data)) {
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = '';
|
$server_id = '';
|
||||||
|
@ -307,31 +307,31 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$console_url = $server_data['server_url'] . '/';
|
$console_url = $server_data['server_url'] . '/';
|
||||||
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
$url_hash = metaconsole_get_servers_url_hash($server_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ($config["homedir"] . "/include/functions_agents.php");
|
require_once ($config["homedir"] . "/include/functions_agents.php");
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
require_once ($config['homedir'] . '/include/functions_groups.php');
|
require_once ($config['homedir'] . '/include/functions_groups.php');
|
||||||
require_once ($config['homedir'] . '/include/functions_gis.php');
|
require_once ($config['homedir'] . '/include/functions_gis.php');
|
||||||
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
||||||
include_graphs_dependencies();
|
include_graphs_dependencies();
|
||||||
|
|
||||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||||
|
|
||||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||||
|
|
||||||
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||||
$is_extra = false;
|
$is_extra = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
|
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Agent General Information");
|
"Trying to access Agent General Information");
|
||||||
require_once ("general/noaccess.php");
|
require_once ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||||
|
|
||||||
if ($agent === false) {
|
if ($agent === false) {
|
||||||
ui_print_error_message(__('There was a problem loading agent'));
|
ui_print_error_message(__('There was a problem loading agent'));
|
||||||
return;
|
return;
|
||||||
|
@ -352,9 +352,9 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
else {
|
else {
|
||||||
$cellName = '';
|
$cellName = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, can_user_access_node ());
|
$cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, can_user_access_node ());
|
||||||
|
|
||||||
if ($agent['disabled']) {
|
if ($agent['disabled']) {
|
||||||
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";
|
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";
|
||||||
}
|
}
|
||||||
|
@ -368,38 +368,38 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$ips = array();
|
$ips = array();
|
||||||
$addresses = agents_get_addresses ($id_agente);
|
$addresses = agents_get_addresses ($id_agente);
|
||||||
$address = agents_get_address($id_agente);
|
$address = agents_get_address($id_agente);
|
||||||
|
|
||||||
foreach ($addresses as $k => $add) {
|
foreach ($addresses as $k => $add) {
|
||||||
if ($add == $address) {
|
if ($add == $address) {
|
||||||
unset($addresses[$k]);
|
unset($addresses[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($addresses)) {
|
if (!empty($addresses)) {
|
||||||
$address .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
$address .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('IP Address');
|
$row['title'] = __('IP Address');
|
||||||
$row['data'] = $address;
|
$row['data'] = $address;
|
||||||
$table->data['address'] = $row;
|
$table->data['address'] = $row;
|
||||||
|
|
||||||
// Agent Interval
|
// Agent Interval
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Interval');
|
$row['title'] = __('Interval');
|
||||||
$row['data'] = human_time_description_raw ($agent["intervalo"]);
|
$row['data'] = human_time_description_raw ($agent["intervalo"]);
|
||||||
$table->data['interval'] = $row;
|
$table->data['interval'] = $row;
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Description');
|
$row['title'] = __('Description');
|
||||||
$row['data'] = $agent["comentarios"];
|
$row['data'] = $agent["comentarios"];
|
||||||
$table->data['description'] = $row;
|
$table->data['description'] = $row;
|
||||||
|
|
||||||
// Last contact
|
// Last contact
|
||||||
$last_contact = ui_print_timestamp($agent["ultimo_contacto"], true);
|
$last_contact = ui_print_timestamp($agent["ultimo_contacto"], true);
|
||||||
|
|
||||||
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
||||||
$last_remote_contact = __('Never');
|
$last_remote_contact = __('Never');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -410,15 +410,15 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$row['title'] = __('Last contact') . " / " . __('Remote');
|
$row['title'] = __('Last contact') . " / " . __('Remote');
|
||||||
$row['data'] = "$last_contact / $last_remote_contact";
|
$row['data'] = "$last_contact / $last_remote_contact";
|
||||||
$table->data['contact'] = $row;
|
$table->data['contact'] = $row;
|
||||||
|
|
||||||
// Next contact (agent)
|
// Next contact (agent)
|
||||||
$progress = agents_get_next_contact($id_agente);
|
$progress = agents_get_next_contact($id_agente);
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['title'] = __('Next agent contact');
|
$row['title'] = __('Next agent contact');
|
||||||
$row['data'] = progress_bar($progress, 150, 20);
|
$row['data'] = progress_bar($progress, 150, 20);
|
||||||
$table->data['next_contact'] = $row;
|
$table->data['next_contact'] = $row;
|
||||||
|
|
||||||
//End of table
|
//End of table
|
||||||
$agent_table = html_print_table($table, true);
|
$agent_table = html_print_table($table, true);
|
||||||
|
|
||||||
|
@ -432,11 +432,11 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$agent_table .= $go_to_agent;
|
$agent_table .= $go_to_agent;
|
||||||
}
|
}
|
||||||
$agent_table .= "<br>";
|
$agent_table .= "<br>";
|
||||||
|
|
||||||
// print agent data toggle
|
// print agent data toggle
|
||||||
ui_toggle($agent_table, __('Agent data'), '', false);
|
ui_toggle($agent_table, __('Agent data'), '', false);
|
||||||
|
|
||||||
|
|
||||||
// Advanced data
|
// Advanced data
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->width = "100%";
|
$table->width = "100%";
|
||||||
|
@ -450,11 +450,11 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$row['title'] = __('Agent Version');
|
$row['title'] = __('Agent Version');
|
||||||
$row['data'] = $agent["agent_version"];
|
$row['data'] = $agent["agent_version"];
|
||||||
$table->data['agent_version'] = $row;
|
$table->data['agent_version'] = $row;
|
||||||
|
|
||||||
// Position Information
|
// Position Information
|
||||||
if ($config['activate_gis']) {
|
if ($config['activate_gis']) {
|
||||||
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
|
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
|
||||||
|
|
||||||
if ($dataPositionAgent !== false) {
|
if ($dataPositionAgent !== false) {
|
||||||
$position = '<a href="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">';
|
$position = '<a href="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">';
|
||||||
if ($dataPositionAgent['description'] != "")
|
if ($dataPositionAgent['description'] != "")
|
||||||
|
@ -469,7 +469,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$table->data['agent_position'] = $row;
|
$table->data['agent_position'] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the url description is setted
|
// If the url description is setted
|
||||||
if ($agent['url_address'] != '') {
|
if ($agent['url_address'] != '') {
|
||||||
$row = array();
|
$row = array();
|
||||||
|
@ -477,7 +477,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$row['data'] = '<a href='.$agent["url_address"].'>'.$agent["url_address"].'</a>';
|
$row['data'] = '<a href='.$agent["url_address"].'>'.$agent["url_address"].'</a>';
|
||||||
$table->data['agent_address'] = $row;
|
$table->data['agent_address'] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timezone Offset
|
// Timezone Offset
|
||||||
if ($agent['timezone_offset'] != 0) {
|
if ($agent['timezone_offset'] != 0) {
|
||||||
$row = array();
|
$row = array();
|
||||||
|
@ -485,7 +485,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$row['data'] = $agent["timezone_offset"];
|
$row['data'] = $agent["timezone_offset"];
|
||||||
$table->data['agent_timezone_offset'] = $row;
|
$table->data['agent_timezone_offset'] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom fields
|
// Custom fields
|
||||||
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
||||||
if ($fields === false) {
|
if ($fields === false) {
|
||||||
|
@ -502,36 +502,36 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//End of table advanced
|
//End of table advanced
|
||||||
$table_advanced = html_print_table($table, true);
|
$table_advanced = html_print_table($table, true);
|
||||||
$table_advanced .= "<br>";
|
$table_advanced .= "<br>";
|
||||||
|
|
||||||
ui_toggle($table_advanced, __('Advanced information'));
|
ui_toggle($table_advanced, __('Advanced information'));
|
||||||
|
|
||||||
// Blank space below title, DONT remove this, this
|
// Blank space below title, DONT remove this, this
|
||||||
// Breaks the layout when Flash charts are enabled :-o
|
// Breaks the layout when Flash charts are enabled :-o
|
||||||
//echo '<div id="id_div" style="height: 10px"> </div>';
|
//echo '<div id="id_div" style="height: 10px"> </div>';
|
||||||
|
|
||||||
if ($config["agentaccess"]) {
|
if ($config["agentaccess"]) {
|
||||||
$access_graph = '<div style="margin-left: 10px;">';
|
$access_graph = '<div style="margin-left: 10px;">';
|
||||||
$access_graph .= graphic_agentaccess($id_agente, 290, 110,
|
$access_graph .= graphic_agentaccess($id_agente, 290, 110,
|
||||||
SECONDS_1DAY, true);
|
SECONDS_1DAY, true);
|
||||||
$access_graph .= '</div><br>';
|
$access_graph .= '</div><br>';
|
||||||
|
|
||||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$events_graph = '<div style="margin-left: 10px;">';
|
$events_graph = '<div style="margin-left: 10px;">';
|
||||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
|
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
|
||||||
SECONDS_1DAY, '', true);
|
SECONDS_1DAY, '', true);
|
||||||
$events_graph .= '</div><br>';
|
$events_graph .= '</div><br>';
|
||||||
|
|
||||||
ui_toggle($events_graph, __('Events (24h)'));
|
ui_toggle($events_graph, __('Events (24h)'));
|
||||||
|
|
||||||
// Table network interfaces
|
// Table network interfaces
|
||||||
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
||||||
|
|
||||||
$network_interfaces = array();
|
$network_interfaces = array();
|
||||||
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
||||||
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
||||||
|
@ -547,11 +547,11 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
$table->style['interface_graph'] = 'width: 20px;';
|
$table->style['interface_graph'] = 'width: 20px;';
|
||||||
$table->head = array();
|
$table->head = array();
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
foreach ($network_interfaces as $interface_name => $interface) {
|
foreach ($network_interfaces as $interface_name => $interface) {
|
||||||
if (!empty($interface['traffic'])) {
|
if (!empty($interface['traffic'])) {
|
||||||
$permission = false;
|
$permission = false;
|
||||||
|
|
||||||
if ($strict_user) {
|
if ($strict_user) {
|
||||||
if (tags_check_acl_by_module($interface['traffic']['in'], $config['id_user'], 'RR') === true
|
if (tags_check_acl_by_module($interface['traffic']['in'], $config['id_user'], 'RR') === true
|
||||||
&& tags_check_acl_by_module($interface['traffic']['out'], $config['id_user'], 'RR') === true)
|
&& tags_check_acl_by_module($interface['traffic']['out'], $config['id_user'], 'RR') === true)
|
||||||
|
@ -560,7 +560,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
else {
|
else {
|
||||||
$permission = check_acl($config['id_user'], $agent["id_grupo"], "RR");
|
$permission = check_acl($config['id_user'], $agent["id_grupo"], "RR");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($permission) {
|
if ($permission) {
|
||||||
$params = array(
|
$params = array(
|
||||||
'interface_name' => $interface_name,
|
'interface_name' => $interface_name,
|
||||||
|
@ -568,16 +568,16 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
'traffic_module_in' => $interface['traffic']['in'],
|
'traffic_module_in' => $interface['traffic']['in'],
|
||||||
'traffic_module_out' => $interface['traffic']['out']
|
'traffic_module_out' => $interface['traffic']['out']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (defined('METACONSOLE') && !empty($server_id))
|
if (defined('METACONSOLE') && !empty($server_id))
|
||||||
$params["server"] = $server_id;
|
$params["server"] = $server_id;
|
||||||
|
|
||||||
$params_json = json_encode($params);
|
$params_json = json_encode($params);
|
||||||
$params_encoded = base64_encode($params_json);
|
$params_encoded = base64_encode($params_json);
|
||||||
$url = ui_get_full_url("operation/agentes/interface_traffic_graph_win.php", false, false, false);
|
$url = ui_get_full_url("operation/agentes/interface_traffic_graph_win.php", false, false, false);
|
||||||
$graph_url = "$url?params=$params_encoded";
|
$graph_url = "$url?params=$params_encoded";
|
||||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||||
|
|
||||||
$graph_link = "<a href=\"javascript:winopeng('$graph_url','$win_handle')\">" .
|
$graph_link = "<a href=\"javascript:winopeng('$graph_url','$win_handle')\">" .
|
||||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
else {
|
else {
|
||||||
$graph_link = "";
|
$graph_link = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
||||||
$data['interface_status'] = $interface['status_image'];
|
$data['interface_status'] = $interface['status_image'];
|
||||||
|
@ -603,7 +603,7 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
||||||
|
|
||||||
ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)');
|
ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue