";
else
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
-
+
$row = array();
$row['title'] = __('Name');
$row['data'] = "".$cellName."";
$table->data['name'] = $row;
-
+
// Interval
$row = array();
$row['title'] = __('Interval');
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
$table->data['interval'] = $row;
-
+
// Warning Min/Max
if (modules_is_string_type($module['id_tipo_modulo'])) {
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
@@ -93,12 +93,12 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
else {
$warning_status_str = __('Min.') . ': ' . (float)$module['min_warning'] . '
' . __('Max.') . ': ' . (float)$module['max_warning'];
}
-
+
$row = array();
$row['title'] = __('Warning status');
$row['data'] = $warning_status_str;
$table->data['watning_status'] = $row;
-
+
// Critical Min/Max
if (modules_is_string_type($module['id_tipo_modulo'])) {
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
@@ -110,7 +110,7 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$row['title'] = __('Critical status');
$row['data'] = $critical_status_str;
$table->data['critical_status'] = $row;
-
+
// Module group
$module_group = modules_get_modulegroup_name($module['id_module_group']);
@@ -118,31 +118,32 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$module_group = __('Not assigned');
else
$module_group = __("$module_group");
-
+
$row = array();
$row['title'] = __('Module group');
$row['data'] = $module_group;
$table->data['module_group'] = $row;
-
+
// Description
$row = array();
$row['title'] = __('Description');
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
$table->data['description'] = $row;
-
+
// Tags
$tags = tags_get_module_tags($module['id_agente_modulo']);
if (empty($tags)) {
$tags = array();
}
-
+
$user_tags = tags_get_user_tags($config["id_user"]);
-
+
foreach ($tags as $k => $v) {
if (!array_key_exists($v, $user_tags)) { //only show user's tags.
unset($tags[$k]);
- } else {
+ }
+ else {
$tag_name = tags_get_name($v);
if (empty($tag_name)) {
unset($tags[$k]);
@@ -152,19 +153,19 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
}
}
}
-
+
if (empty($tags)) {
$tags = '' . __('N/A') . '';
}
else {
$tags = implode(', ' , $tags);
}
-
+
$row = array();
$row['title'] = __('Tags');
$row['data'] = $tags;
$table->data['tags'] = $row;
-
+
// 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')));
if ($config["render_proc"]) {
@@ -292,20 +293,20 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
else {
$last_data_str = '' . __('No data') . '';
}
-
+
$row = array();
$row['title'] = __('Last data');
$row['data'] = $last_data_str;
$table->data['last_data'] = $row;
-
+
//End of table
html_print_table($table);
-
+
$id_group = agents_get_agent_group($module['id_agente']);
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
$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 ($user_access_node && check_acl ($config["id_user"], $id_group, 'AW')) {
// Actions table
echo '';
}
-
+
//id_module and id_agent hidden
echo '';
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 '
';
-
+
+ if (!empty($server_data) && is_metaconsole()) {
+ metaconsole_restore_db();
+ }
+
return;
}
@@ -340,7 +345,14 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head
$console_url = $server_data['server_url'] . '/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
-
+
+ $user_access_node = can_user_access_node ();
+
+ if (is_metaconsole()) {
+ if (metaconsole_connect($server_data) != NOERR)
+ return;
+ }
+
$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);
@@ -427,7 +439,7 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head
}
html_print_table($table2);
- if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
+ if ($user_access_node && check_acl ($config["id_user"], $id_group, 'LW')) {
// Actions table
echo '';
}
+
+ if (!empty($server_data) && is_metaconsole()) {
+ metaconsole_restore_db();
+ }
+
+ return;
}
function treeview_printTable($id_agente, $server_data = array(), $no_head = false) {
@@ -467,16 +485,23 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
+
+ $user_access_node = can_user_access_node ();
+
+ if (is_metaconsole()) {
+ if (metaconsole_connect($server_data) != NOERR)
+ return;
+ }
+ $agent = db_get_row ("tagente", "id_agente", $id_agente);
+
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
db_pandora_audit("ACL Violation",
"Trying to access Agent General Information");
require_once ("general/noaccess.php");
return;
}
-
- $agent = db_get_row ("tagente", "id_agente", $id_agente);
-
+
if ($agent === false) {
ui_print_error_message(__('There was a problem loading agent'));
return;
@@ -498,7 +523,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
$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, $user_access_node);
if ($agent['disabled']) {
$cellName .= ui_print_help_tip(__('Disabled'), true) . "";
@@ -567,7 +592,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
//End of table
$agent_table = html_print_table($table, true);
- if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
+ if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
$go_to_agent = '