';
+ $output .= '
';
$output .= html_print_input(
[
'style' => 'display:none;',
@@ -1190,6 +1191,7 @@ function html_print_select_multiple_filtered(
'return' => true,
]
);
+ $output .= '
';
$f = "filterAvailableItems(this.value,'".$rid."','".__('None')."')";
$output .= html_print_input(
@@ -1312,7 +1314,7 @@ function html_print_select_multiple_filtered(
'input_class' => 'flex-row-vcenter',
'label' => __('Group recursion'),
'name' => 'id-group-recursion-selected-select-'.$rid,
- 'type' => 'checkbox',
+ 'type' => 'switch',
'script' => $reload_content,
'return' => true,
]
@@ -1329,6 +1331,8 @@ function html_print_select_multiple_filtered(
) {
$output .= '
';
+ $output .= '
';
+
$output .= html_print_input(
[
'style' => 'display:none;',
@@ -1338,6 +1342,7 @@ function html_print_select_multiple_filtered(
'return' => true,
]
);
+ $output .= '
';
$f = "filterSelectedItems(this.value,'".$rid."','".__('None')."')";
$output .= html_print_input(
@@ -1475,7 +1480,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true,
'nothing' => __('All'),
'nothing_value' => 0,
- 'script' => 'fmModuleChange(\''.$uniqId.'\')',
+ 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
$output .= '
';
@@ -1528,7 +1533,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
- 'script' => 'fmModuleChange(\''.$uniqId.'\')',
+ 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
@@ -1545,39 +1550,29 @@ function html_print_select_multiple_modules_filtered(array $data):string
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'selected' => $data['mShowCommonModules'],
'return' => true,
- 'script' => 'fmModuleChange(\''.$uniqId.'\')',
+ 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
]
);
if ($data['mAgents'] !== null) {
- $all_modules = select_modules_for_agent_group(
+ $all_modules = get_modules_agents(
$data['mModuleGroup'],
explode(',', $data['mAgents']),
$data['mShowCommonModules'],
- false
+ false,
+ true
);
} else {
$all_modules = [];
}
- if ($data['mShowSelectedOtherGroups']) {
- $selected_modules_ids = explode(',', $data['mModules']);
-
- foreach ($selected_modules_ids as $id) {
- if (!array_key_exists($id, $all_modules)) {
- $module_data = modules_get_agentmodule($id);
- $all_modules[$id] = $module_data['nombre'];
- }
- }
- }
-
$output .= html_print_input(
[
'label' => __('Modules'),
'type' => 'select',
'fields' => $all_modules,
'name' => 'filtered-module-modules-'.$uniqId,
- 'selected' => explode(',', $data['mModules']),
+ 'selected' => explode((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ',', $data['mModules']),
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
@@ -2430,6 +2425,38 @@ function html_print_div(
}
+/**
+ * Render an
tag for show code.
+ * For debug purposes, see for `hd()` function.
+ *
+ * @param string $content Content of tag.
+ * @param boolean $return Return the tag string formed.
+ * @param array $attributes Attributes availables for pre tags.
+ *
+ * @return string
+ */
+function html_print_code(
+ string $content,
+ bool $return=true,
+ array $attributes=[]
+) {
+ $output = ' $value) {
+ $output .= ' '.$attribute.'="'.io_safe_input_html($value).'"';
+ }
+ }
+
+ $output .= sprintf('>%s ', $content);
+
+ if ($return === true) {
+ return $output;
+ } else {
+ echo $output;
+ }
+}
+
+
/**
* Render an anchor html element.
*
@@ -2783,7 +2810,7 @@ function html_print_input_number(array $settings):string
global $config;
$text_color = '';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'style="color: white"';
}
@@ -4260,7 +4287,7 @@ function html_print_autocomplete_modules(
$text_color = '';
$module_icon = 'images/search_module.png';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'color: white';
$module_icon = 'images/brick.menu.png';
}
@@ -4562,7 +4589,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
enterprise_include_once('include/functions_metaconsole.php');
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$style = 'style="color: white"';
}
@@ -5223,7 +5250,7 @@ function html_print_autocomplete_users_from_integria(
global $config;
$user_icon = 'images/user_green.png';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$user_icon = 'images/header_user.png';
}
@@ -5330,7 +5357,7 @@ function html_print_tabs(array $tabs)
$bg_color = '';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'style="background-color: #222"';
}
@@ -5432,7 +5459,7 @@ function html_print_select_search(
$select2_css = 'select2.min';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$select2_css = 'select2_dark.min';
}
diff --git a/pandora_console/include/functions_integriaims.php b/pandora_console/include/functions_integriaims.php
index af04f5064d..7bf2a2fd53 100644
--- a/pandora_console/include/functions_integriaims.php
+++ b/pandora_console/include/functions_integriaims.php
@@ -158,35 +158,86 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
{
global $config;
- if ($user_level_conf === null) {
- $user_level_conf = (bool) $config['integria_user_level_conf'];
- }
+ if (is_metaconsole()) {
+ $servers = metaconsole_get_connection_names();
+ foreach ($servers as $key => $server) {
+ $connection = metaconsole_get_connection($server);
+ if (metaconsole_connect($connection) != NOERR) {
+ continue;
+ }
- $user_info = users_get_user_by_id($config['id_user']);
+ $integria_enabled = db_get_sql(
+ 'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
+ );
- // API access data.
- if ($api_hostname === null) {
- $api_hostname = $config['integria_hostname'];
- }
+ if (!$integria_enabled) {
+ metaconsole_restore_db();
+ continue;
+ }
- if ($api_pass === null) {
- $api_pass = $config['integria_api_pass'];
- }
+ // integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
+ $config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
+ $user_info = users_get_user_by_id($config['id_user']);
+ foreach ($config_aux as $key => $conf) {
+ if ($conf['token'] === 'integria_user_level_conf') {
+ $user_level_conf = $conf['value'];
+ }
- // Integria user and password.
- if ($user === null || $user_level_conf === true) {
- $user = $config['integria_user'];
+ if ($conf['token'] === 'integria_hostname') {
+ $api_hostname = $conf['value'];
+ }
- if ($user_level_conf === true) {
- $user = $user_info['integria_user_level_user'];
+ if ($conf['token'] === 'integria_api_pass') {
+ $api_pass = $conf['value'];
+ }
+
+ if ($conf['token'] === 'integria_user') {
+ $user = $conf['value'];
+ }
+
+ if ($conf['token'] === 'integria_pass') {
+ $user_pass = $conf['value'];
+ }
+ }
+
+ if ($user_level_conf == true) {
+ $user = $user_info['integria_user_level_user'];
+ $user_pass = $user_info['integria_user_level_pass'];
+ }
+
+ metaconsole_restore_db();
+ }
+ } else {
+ if ($user_level_conf === null) {
+ $user_level_conf = (bool) $config['integria_user_level_conf'];
}
- }
- if ($user_pass === null || $user_level_conf === true) {
- $user_pass = $config['integria_pass'];
+ $user_info = users_get_user_by_id($config['id_user']);
- if ($user_level_conf === true) {
- $user_pass = $user_info['integria_user_level_pass'];
+ // API access data.
+ if ($api_hostname === null) {
+ $api_hostname = $config['integria_hostname'];
+ }
+
+ if ($api_pass === null) {
+ $api_pass = $config['integria_api_pass'];
+ }
+
+ // Integria user and password.
+ if ($user === null || $user_level_conf === true) {
+ $user = $config['integria_user'];
+
+ if ($user_level_conf === true) {
+ $user = $user_info['integria_user_level_user'];
+ }
+ }
+
+ if ($user_pass === null || $user_level_conf === true) {
+ $user_pass = $config['integria_pass'];
+
+ if ($user_level_conf === true) {
+ $user_pass = $user_info['integria_user_level_pass'];
+ }
}
}
diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php
index 853fbb330a..f11c49a939 100755
--- a/pandora_console/include/functions_io.php
+++ b/pandora_console/include/functions_io.php
@@ -545,11 +545,12 @@ function io_input_password($password)
* Process the given password read from the Pandora FMS Database,
* decrypting it if necessary.
*
- * @param string password Password read from the DB.
+ * @param string $password Password read from the DB.
+ * @param string $wrappedBy Wrap the password with the informed character.
*
* @return string The processed password.
*/
-function io_output_password($password)
+function io_output_password($password, $wrappedBy='')
{
global $config;
@@ -562,11 +563,14 @@ function io_output_password($password)
]
);
- if ($plaintext === ENTERPRISE_NOT_HOOK) {
- return io_safe_output($password);
- }
+ $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
- return io_safe_output($plaintext);
+ return sprintf(
+ '%s%s%s',
+ $wrappedBy,
+ io_safe_output($output),
+ $wrappedBy
+ );
}
diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php
index 4f27b17896..b9635630a1 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -189,7 +189,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[
'nombre' => $module['nombre'],
'disabled' => false,
- ]
+ ],
+ true,
+ true,
+ false,
+ false
);
// The module already exist in the target
@@ -203,7 +207,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[
'nombre' => $module['nombre'],
'disabled' => true,
- ]
+ ],
+ true,
+ true,
+ false,
+ false
);
// If the module exist but disabled, we enable it
@@ -3231,9 +3239,10 @@ function modules_get_first_date($id_agent_module, $datelimit=0)
{
global $config;
- // check datatype string or normal
+ // Check datatype string or normal.
$table = 'tagente_datos';
- $module_type_str = modules_get_agentmodule_type($id_agent_module);
+ $module_type = modules_get_agentmodule_type($id_agent_module);
+ $module_type_str = modules_get_type_name($module_type);
if (strstr($module_type_str, 'string') !== false) {
$table = 'tagente_datos_string';
}
@@ -3555,7 +3564,7 @@ function modules_get_agentmodule_mininterval_no_async($id_agent)
}
-function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true)
+function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true, $useName=false)
{
if ((bool) is_metaconsole() === true) {
if ($select_mode === true) {
@@ -3675,8 +3684,14 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$modules = array_reduce(
$modules,
- function ($carry, $item) {
- $carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
+ function ($carry, $item) use ($useName) {
+ // Only works in select mode.
+ if ($useName === true) {
+ $carry[io_safe_input($item['nombre'])] = $item['nombre'];
+ } else {
+ $carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
+ }
+
return $carry;
},
[]
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index a65e62932d..d4d26d8777 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -8775,6 +8775,8 @@ function reporting_increment($report, $content)
$return['data'] = [];
+ $search_in_history_db = db_search_in_history_db($return['from']);
+
if (is_metaconsole()) {
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
@@ -8801,17 +8803,23 @@ function reporting_increment($report, $content)
$connection = false;
}
- $old_data = db_get_value_sql($sql1);
+ $old_data = db_get_value_sql($sql1, false, $search_in_history_db);
- $last_data = db_get_value_sql($sql2);
+ $last_data = db_get_value_sql($sql2, false, $search_in_history_db);
}
} else {
$old_data = db_get_value_sql(
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
- AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
+ AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
+ false,
+ $search_in_history_db
);
- $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC');
+ $last_data = db_get_value_sql(
+ 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
+ false,
+ $search_in_history_db
+ );
}
if (!is_metaconsole()) {
@@ -9374,7 +9382,7 @@ function reporting_custom_graph(
$modules = [];
foreach ($module_source as $key => $value) {
$modules[$key]['module'] = $value['id_agent_module'];
- $modules[$key]['server'] = $value['id_server'];
+ $modules[$key]['id_server'] = $value['id_server'];
}
}
}
@@ -9817,19 +9825,21 @@ function reporting_set_conf_charts(
$content,
&$ttl
) {
+ global $config;
+
switch ($type) {
case 'dinamic':
default:
$only_image = false;
$width = 900;
- $height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
+ $height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
$ttl = 1;
break;
case 'static':
$ttl = 2;
$only_image = true;
- $height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
+ $height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
$width = 650;
break;
@@ -14155,7 +14165,7 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if (modules_is_disable_agent($content['id_agent_module'])
|| modules_is_not_init($content['id_agent_module'])
) {
- if ($metaconsole_on) {
+ if ($metaconsole_on && $server_name != '') {
// Restore db connection.
metaconsole_restore_db();
}
@@ -14179,6 +14189,9 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null;
+ if ((bool) $content['dinamic_proc'] === true) {
+ $max_value_critical = 0.01;
+ }
} else {
$max_value_critical = $agentmodule_info['max_critical'];
}
@@ -14386,28 +14399,37 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
$width_graph = 100;
$height_graph = 80;
- $return['chart'] = flot_slicesbar_graph(
- $array_result,
- $time_total,
- $width_graph,
- $height_graph,
- $legend,
- $colors,
- $config['fontpath'],
- $config['round_corner'],
- $homeurl,
- '',
- '',
- false,
- 0,
- [],
- true,
- $ttl,
- $content['sizeForTicks'],
- true
- );
+ if (empty($array_result) === false) {
+ $return['chart'] = flot_slicesbar_graph(
+ $array_result,
+ $time_total,
+ $width_graph,
+ $height_graph,
+ $legend,
+ $colors,
+ $config['fontpath'],
+ $config['round_corner'],
+ $homeurl,
+ '',
+ '',
+ false,
+ 0,
+ [],
+ true,
+ $ttl,
+ $content['sizeForTicks'],
+ true,
+ $report['datetime']
+ );
+ } else {
+ $return['chart'] = graph_nodata_image(
+ $width_graph,
+ $height_graph,
+ 'area'
+ );
+ }
- if ($metaconsole_on) {
+ if ($metaconsole_on && $server_name != '') {
// Restore db connection.
metaconsole_restore_db();
}
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 3f7624fee0..92e20da72e 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -122,7 +122,7 @@ function html_do_report_info($report)
{
global $config;
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#222';
} else {
$background_color = '#f5f5f5';
@@ -5346,7 +5346,7 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
$agent_data = [];
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
- $agent_data[1] = " ".format_numeric($data['agent_not_init']).' ';
+ $agent_data[1] = "".format_numeric($data['agent_not_init']).' ';
$agent_data[2] = '';
$agent_data[3] = '';
diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php
index 4f405efb00..cf61fec7a7 100644
--- a/pandora_console/include/functions_servers.php
+++ b/pandora_console/include/functions_servers.php
@@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server)
return __('WUX server');
case SERVER_TYPE_ENTERPRISE_SATELLITE:
- return __('Satellite');
+ return __('Satellite server');
+
+ case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
+ return __('Transactional server');
+
+ case SERVER_TYPE_ALERT:
+ return __('Alert server');
+
+ case SERVER_TYPE_NCM:
+ return __('NCM server');
default:
return __('N/A');
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index ff0c7401fd..8fc8e6e319 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -1627,31 +1627,31 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
switch ($agent_status) {
case AGENT_STATUS_CRITICAL:
if ($critical > 0) {
- $count ++;
+ $count++;
}
break;
case AGENT_STATUS_WARNING:
if ($total > 0 && $critical = 0 && $warning > 0) {
- $count ++;
+ $count++;
}
break;
case AGENT_STATUS_UNKNOWN:
if ($critical == 0 && $warning == 0 && $unknown > 0) {
- $count ++;
+ $count++;
}
break;
case AGENT_STATUS_NOT_INIT:
if ($total == 0 || $total == $not_init) {
- $count ++;
+ $count++;
}
break;
case AGENT_STATUS_NORMAL:
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
- $count ++;
+ $count++;
}
break;
@@ -1662,23 +1662,23 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
} else {
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
if ($critical > 0) {
- $count ++;
+ $count++;
}
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
if ($total > 0 && $critical = 0 && $warning > 0) {
- $count ++;
+ $count++;
}
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
if ($critical == 0 && $warning == 0 && $unknown > 0) {
- $count ++;
+ $count++;
}
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
if ($total == 0 || $total == $not_init) {
- $count ++;
+ $count++;
}
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
- $count ++;
+ $count++;
}
}
// Invalid status.
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index ae4321dadd..ddf722bfd3 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -1203,7 +1203,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
- if (empty($actions) === false) {
+ if (empty($actions) === false || $actionDefault != '') {
$actionText = '';
foreach ($actions as $action) {
$actionText .= ''.$action['name'];
@@ -1215,9 +1215,9 @@ function ui_format_alert_row(
}
$actionText .= '
';
- } else {
+
if ($actionDefault != '') {
- $actionText = db_get_sql(
+ $actionText .= db_get_sql(
sprintf(
'SELECT name FROM talert_actions WHERE id = %d',
$actionDefault
@@ -4964,7 +4964,7 @@ function ui_print_agent_autocomplete_input($parameters)
// Default value.
$icon_agent = 'images/search_agent.png';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'style="color: white"';
$icon_agent = 'images/agent_mc.menu.png';
}
@@ -5820,7 +5820,7 @@ function ui_print_agent_autocomplete_input($parameters)
$html = '';
$text_color = '';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'color: white';
}
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index b592c240ca..f05d0de6e2 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -2850,9 +2850,6 @@ function get_donut_module_data($id_module)
foreach ($values as $val) {
if ($index < $max_elements) {
$data = explode(',', $val);
- if ($data[1] == 0) {
- $data[1] = __('No data');
- }
if ($no_data_to_show) {
$values_to_return[$index]['tag_name'] = $data[0];
@@ -2865,10 +2862,6 @@ function get_donut_module_data($id_module)
$total += (int) $data[1];
$index++;
} else {
- if ($data[1] == 0) {
- $data[1] = __('No data');
- }
-
$data = explode(',', $val);
$values_to_return[$index]['tag_name'] = __('Others').': '.$data[1];
$values_to_return[$index]['color'] = $colors[$index];
@@ -2881,6 +2874,7 @@ function get_donut_module_data($id_module)
$values_to_return[$ind]['percent'] = (($donut_data['value'] * 100) / $total);
}
+ // sort array
$new_values_to_return = [];
while (!empty($values_to_return)) {
$first = true;
@@ -3426,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
break;
case GROUP_ITEM:
- $group_status = groups_get_status($layoutData['id_group']);
+ $group_status = groups_get_status($layoutData['id_group'], true);
switch ($group_status) {
case AGENT_STATUS_ALERT_FIRED:
diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php
index ec83514c46..b734fd3553 100644
--- a/pandora_console/include/graphs/fgraph.php
+++ b/pandora_console/include/graphs/fgraph.php
@@ -220,7 +220,7 @@ function vbar_graph(
$options['x']['font']['color'] = '#545454';
if ($options['pdf'] === true) {
$options['x']['font']['color'] = '#000';
- } else if ($config['style'] === 'pandora_black') {
+ } else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['x']['font']['color'] = '#fff';
}
}
@@ -238,7 +238,7 @@ function vbar_graph(
// Grid color axes x.
if (isset($options['x']['color']) === false) {
$options['x']['color'] = '#ffffff';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['x']['color'] = '#222';
}
}
@@ -305,7 +305,7 @@ function vbar_graph(
$options['y']['font']['color'] = '#545454';
if ($options['pdf'] === true) {
$options['y']['font']['color'] = '#000';
- } else if ($config['style'] === 'pandora_black') {
+ } else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['y']['font']['color'] = '#fff';
}
}
@@ -323,7 +323,7 @@ function vbar_graph(
// Grid color axes y.
if (isset($options['y']['color']) === false) {
$options['y']['color'] = '#ffffff';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['y']['color'] = '#222';
}
}
@@ -361,7 +361,7 @@ function vbar_graph(
if (isset($options['grid']['color']) === false) {
$options['grid']['color'] = '#ffffff';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['grid']['color'] = '#111';
}
}
@@ -373,7 +373,7 @@ function vbar_graph(
'#ffffff',
],
];
- if ($config['style'] === 'pandora_black' && $ttl === 1) {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$options['grid']['backgroundColor'] = [
'colors' => [
'#222',
@@ -746,11 +746,11 @@ function hbar_graph(
return generator_chart_to_pdf('hbar', $params);
}
- if ($config['style'] === 'pandora_black' && $ttl === 1) {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$backgroundColor = '#222';
}
- if ($config['style'] === 'pandora_black' && $ttl === 1) {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$tick_color = '#fff';
}
diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js
index ed64ffecd2..13e72bdaca 100644
--- a/pandora_console/include/graphs/flot/pandora.flot.js
+++ b/pandora_console/include/graphs/flot/pandora.flot.js
@@ -335,7 +335,7 @@ function pandoraFlotHBars(
"#e63c52",
"#FFA631",
"#f3b200",
- "#5BB6E5",
+ "#4a83f3",
"#F2919D",
"#82b92e"
];
@@ -437,25 +437,23 @@ function pandoraFlotHBars(
var format = new Array();
for (var i = 0; i < labels_total.length; i++) {
var label = labels_total[i][1];
- // var shortLabel = reduceText(label, 25);
- var title = label;
- if (label.length > 30) {
- label = reduceText(label, 30);
- }
var div_attributes =
'style="font-size:' +
font_size +
"pt !important;" +
- " margin: 0; max-width: 150px;" +
- "margin-right:5px";
- +"margin-left: -1.5em";
- +"text-align: right";
+ "margin: 0; max-width: 200px;" +
+ "margin-right:5px;" +
+ "margin-left: -1.5em" +
+ "text-align: right" +
+ "text-overflow: ellipsis;" +
+ "overflow: hidden;" +
+ "white-space: pre;";
if (label.indexOf(" ") != -1) {
div_attributes += "min-height: 2.5em;";
}
- div_attributes += '" title="' + title + '" style="overflow: hidden;"';
+ div_attributes += '" title="' + label + '" style="overflow: hidden;"';
format.push([i, "" + label + "
"]);
}
@@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
if (text.length <= maxLength) return text;
var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
var str_cut = text.substr(0, firstSlideEnd);
- return str_cut + "... " + text.substr(-firstSlideEnd - 3);
+ //return str_cut + "... " + text.substr(-firstSlideEnd - 3);
+ return str_cut + "..." + text.substr(-firstSlideEnd - 3);
}
diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php
index e126fc33b4..57cf3a1f43 100644
--- a/pandora_console/include/graphs/functions_d3.php
+++ b/pandora_console/include/graphs/functions_d3.php
@@ -202,7 +202,7 @@ function d3_bullet_chart(
$font = array_shift(explode('.', array_pop(explode('/', $font))));
$invert_color = '';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$invert_color = 'filter: invert(100%);';
}
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 3dd139bf3a..652d61bfb6 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -146,7 +146,7 @@ function flot_area_graph(
break;
}
- if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
+ if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
) {
$background_style = '#222';
$params['grid_color'] = '#fff';
@@ -553,11 +553,6 @@ function flot_hcolumn_chart($graph_data, $width, $height, $water_mark, $font='',
{
global $config;
- if ($pdf === true) {
- $background_color = 'white';
- $tick_color = '#000';
- }
-
// Include_javascript_dependencies_flot_graph().
$return = '';
diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js
index 262c31f860..fb88c9f3e5 100644
--- a/pandora_console/include/javascript/functions_pandora_networkmap.js
+++ b/pandora_console/include/javascript/functions_pandora_networkmap.js
@@ -683,10 +683,10 @@ function update_link(row_index, id_link) {
temp_link["text_end"] = data["text_end"];
$.each(graph.nodes, function(k, node) {
- if (node["id_agent"] == data["id_db_target"]) {
+ if (node["id_db"] == data["id_db_target"]) {
temp_link["target"] = graph.nodes[k];
}
- if (node["id_agent"] == data["id_db_source"]) {
+ if (node["id_db"] == data["id_db_source"]) {
temp_link["source"] = graph.nodes[k];
}
});
@@ -703,9 +703,21 @@ function update_link(row_index, id_link) {
.append("g")
.attr("id", "layer_graph_nodes_" + networkmap_id);
+ var graph_links_aux = graph.links.filter(function(d, i) {
+ if (typeof d["source"] === "undefined") {
+ return false;
+ }
+
+ if (typeof d["target"] === "undefined") {
+ return false;
+ }
+
+ return d;
+ });
+
force
.nodes(graph.nodes)
- .links(graph.links)
+ .links(graph_links_aux)
.start();
window.node = layer_graph_nodes.selectAll(".node");
@@ -2353,9 +2365,21 @@ function refresh_holding_area() {
.append("g")
.attr("id", "layer_graph_nodes_" + networkmap_id);
+ var graph_links_aux = graph.links.filter(function(d, i) {
+ if (typeof d["source"] === "undefined") {
+ return false;
+ }
+
+ if (typeof d["target"] === "undefined") {
+ return false;
+ }
+
+ return d;
+ });
+
force
.nodes(graph.nodes)
- .links(graph.links)
+ .links(graph_links_aux)
.start();
window.node = layer_graph_nodes.selectAll(".node");
diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js
index c813c8e26a..8de92ffcf3 100644
--- a/pandora_console/include/javascript/multiselect_filtered.js
+++ b/pandora_console/include/javascript/multiselect_filtered.js
@@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
}
// eslint-disable-next-line no-unused-vars
-function fmModuleChange(uniqId) {
+function fmModuleChange(uniqId, isMeta) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var showCommonModules = $(
@@ -230,14 +230,20 @@ function fmModuleChange(uniqId) {
$("#filtered-module-modules-" + uniqId).html("");
if (data) {
jQuery.each(data, function(id, value) {
- var option = $(" ")
- .attr(
- "value",
- value["id_node"]
- ? value["id_node"] + "|" + value["id_agente_modulo"]
- : value["id_agente_modulo"]
- )
- .html(value["nombre"]);
+ var option = $(" ");
+ if (isMeta === true) {
+ option
+ .attr(
+ "value",
+ value["id_node"]
+ ? value["id_node"] + "|" + value["id_agente_modulo"]
+ : value["id_agente_modulo"]
+ )
+ .html(value["nombre"]);
+ } else {
+ option.attr("value", value).html(value);
+ }
+
$("#filtered-module-modules-" + uniqId).append(option);
});
}
diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js
index 71893c1f62..e223e485d2 100644
--- a/pandora_console/include/javascript/pandora_dashboards.js
+++ b/pandora_console/include/javascript/pandora_dashboards.js
@@ -388,8 +388,8 @@ function initialiceLayout(data) {
dashboardId: data.dashboardId,
widgetId: widgetId
},
- width: widgetId == 14 || widgetId == 2 ? 750 : 450,
- maxHeight: 600,
+ width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
+ maxHeight: 610,
minHeight: 400
},
onsubmit: {
diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js
index 4a2361d050..af61688bf1 100644
--- a/pandora_console/include/javascript/pandora_modules.js
+++ b/pandora_console/include/javascript/pandora_modules.js
@@ -942,7 +942,9 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
.children()
.eq(1)
.children()
- .attr("type", "password");
+ .attr("type", "password")
+ .removeAttr("value")
+ .val(macro_value);
} else {
$("#" + row_id)
.children()
@@ -955,7 +957,9 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
$("#" + row_id)
.children()
.eq(1)
- .attr("type", "password");
+ .attr("type", "password")
+ .removeAttr("value")
+ .val(macro_value);
} else {
$("#" + row_id)
.children()
diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js
index 461066abbc..7f22c6e9d0 100644
--- a/pandora_console/include/javascript/tree/TreeController.js
+++ b/pandora_console/include/javascript/tree/TreeController.js
@@ -976,6 +976,11 @@ var TreeController = {
""
);
+ // Avoiding 'undefined' text.
+ if (typeof element.value === "undefined") {
+ element.value = "";
+ }
+
// Value.
$content.append(
'' + element.value + " "
@@ -985,6 +990,35 @@ var TreeController = {
typeof element.showGraphs != "undefined" &&
element.showGraphs != 0
) {
+ // Graph histogram pop-up
+ if (typeof element.histogramGraph != "undefined") {
+ var graphImageHistogram = $(
+ ' '
+ );
+
+ graphImageHistogram
+ .addClass("module-graph")
+ .click(function(e) {
+ e.stopPropagation();
+ try {
+ winopeng_var(
+ element.histogramGraph.url,
+ element.histogramGraph.handle,
+ 800,
+ 480
+ );
+ } catch (error) {
+ // console.log(error);
+ }
+ });
+
+ $content.append(graphImageHistogram);
+ }
+
// Graph pop-up
if (typeof element.moduleGraph != "undefined") {
if (element.statusImageHTML.indexOf("data:image") != -1) {
@@ -1178,24 +1212,26 @@ var TreeController = {
disabled == false
) {
if (element.type == "agent" || element.type == "module") {
- $content
- .click(function(e) {
- _getTreeDetailData(
- element.type,
- element.id,
- element.serverID,
- function(error, data) {
- if (error) {
- // console.error(error);
- } else {
- controller.detailRecipient
- .render(element.name, data)
- .open();
+ if (typeof element.noAcl === "undefined") {
+ $content
+ .click(function(e) {
+ _getTreeDetailData(
+ element.type,
+ element.id,
+ element.serverID,
+ function(error, data) {
+ if (error) {
+ // console.error(error);
+ } else {
+ controller.detailRecipient
+ .render(element.name, data)
+ .open();
+ }
}
- }
- );
- })
- .css("cursor", "pointer");
+ );
+ })
+ .css("cursor", "pointer");
+ }
}
}
diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php
index 617bd74cb8..320280718b 100644
--- a/pandora_console/include/lib/Dashboard/Widget.php
+++ b/pandora_console/include/lib/Dashboard/Widget.php
@@ -512,7 +512,7 @@ class Widget
if (empty($values['background']) === true) {
$values['background'] = '#ffffff';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$values['background'] = '#222222';
}
}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
index bc8d1b49c7..c17b61092f 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php
@@ -35,7 +35,6 @@ use PandoraFMS\Module;
*/
class AgentModuleWidget extends Widget
{
- const MODULE_SEPARATOR = '|-|-|-|';
/**
* Name widget.
@@ -309,16 +308,12 @@ class AgentModuleWidget extends Widget
if (is_metaconsole() === true) {
$values['mModules'] = implode(
- self::MODULE_SEPARATOR,
+ SEPARATOR_META_MODULE,
array_reduce(
$values['mModules'],
function ($carry, $item) {
$d = explode('|', $item);
- if (isset($d[1]) === true) {
- $carry[] = \io_safe_output($d[1]);
- } else {
- $carry[] = \io_safe_output($item);
- }
+ $carry[] = (isset($d[1]) === true) ? $d[1] : $item;
return $carry;
},
@@ -639,7 +634,7 @@ class AgentModuleWidget extends Widget
$target_modules = $this->values['mModules'];
if (is_metaconsole() === true) {
$target_modules = explode(
- self::MODULE_SEPARATOR,
+ SEPARATOR_META_MODULE,
$this->values['mModules']
);
@@ -648,8 +643,17 @@ class AgentModuleWidget extends Widget
if (is_array($target_modules) === true
|| is_numeric($target_modules) === true
) {
+ $target_modules = array_reduce(
+ $target_modules,
+ function ($carry, $item) {
+ $carry[] = io_safe_output($item);
+
+ return $carry;
+ }
+ );
+
$all_modules = Module::search(
- ['id_agente_modulo' => $target_modules]
+ ['nombre' => $target_modules]
);
} else {
// From previous definitions.
@@ -660,29 +664,28 @@ class AgentModuleWidget extends Widget
}
if ($all_modules !== null) {
- $reduceAllModules = array_reduce(
- $all_modules,
- function ($carry, $item) {
- if ($item === null) {
+ if (is_metaconsole() === true
+ && $this->values['mShowCommonModules'] === '1'
+ ) {
+ $reduceAllModules = [];
+ } else {
+ $reduceAllModules = array_reduce(
+ $all_modules,
+ function ($carry, $item) {
+ if ($item === null) {
+ return $carry;
+ }
+
+ if (is_object($item) === true) {
+ $carry[$item->name()] = null;
+ } else {
+ $carry[io_safe_output($item)] = null;
+ }
+
return $carry;
}
-
- if (is_object($item) === true) {
- $carry[$item->name()] = null;
- } else {
- if ((is_metaconsole() === true
- && $this->values['mShowCommonModules'] !== '1')
- || is_metaconsole() === false
- ) {
- $carry[$item] = null;
- }
- }
-
- return $carry;
- }
- );
- } else {
- $reduceAllModules = [];
+ );
+ }
}
$visualData = [];
@@ -709,14 +712,26 @@ class AgentModuleWidget extends Widget
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
$visualData[$agent_id]['agent_name'] = $agent->name();
$visualData[$agent_id]['agent_alias'] = $agent->alias();
+ $visualData[$agent_id]['modules'] = [];
if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1'
) {
// MC should connect to nodes and retrieve information
// from targets.
+ $tmpModules = array_reduce(
+ $target_modules,
+ function ($carry, $item) {
+ // In this case, the modules come with '» ' chain.
+ $tmpCarry = explode('» ', $item);
+ $carry[trim($tmpCarry[1])] = null;
+
+ return $carry;
+ }
+ );
+
$modules = $agent->searchModules(
- ['id_agente_modulo' => $target_modules]
+ ['nombre' => array_keys($tmpModules)]
);
foreach ($modules as $module) {
diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php
index 3330cc2ae6..602533e73a 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php
@@ -750,7 +750,7 @@ class EventsListWidget extends Widget
$table->data[$i] = $data;
$bg_color = 'background: #E8E8E8;';
- if ($config['style'] === 'pandora_black') {
+ if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'background: #222;';
}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php
index 32ca90c3cb..dba9035877 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php
@@ -378,6 +378,8 @@ class GraphModuleHistogramWidget extends Widget
$size = parent::getSize();
+ $output = '';
+
// Desactive scroll bars only this item.
$id_agent = $this->values['agentId'];
$id_module = $this->values['moduleId'];
diff --git a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php
index d4c0e39b6a..af25b2c056 100755
--- a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php
@@ -350,7 +350,7 @@ class GroupsStatusWidget extends Widget
// Agent Not Init.
$table->data[2][1] = $this->getCellCounter(
$stats['agent_not_init'],
- '#5bb6e5'
+ '#4a83f3'
);
$data .= html_print_table($table, true);
@@ -424,7 +424,7 @@ class GroupsStatusWidget extends Widget
// Modules Not Init.
$table->data[2][1] = $this->getCellCounter(
$stats['monitor_not_init'],
- '#5bb6e5'
+ '#4a83f3'
);
$data .= html_print_table($table, true);
diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php
index 34e28dd8f1..2f59a29f0a 100755
--- a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php
@@ -323,11 +323,22 @@ class MapsStatusWidget extends Widget
$data = [];
$url = $config['homeurl'];
- $url .= 'index.php?sec=visualc';
- $url .= '&sec2=operation/visual_console/render_view&refr=60';
+ if (\is_metaconsole() === true) {
+ $url .= sprintf(
+ 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&refr=%s&id_visualmap=%s',
+ $config['vc_refr'],
+ $id_layout
+ );
+ } else {
+ $url .= sprintf(
+ 'index.php?sec=visualc&sec2=operation/visual_console/render_view&refr=%s&id=%s',
+ $config['vc_refr'],
+ $id_layout
+ );
+ }
// This will give us the group name.
- $data[0] = '';
+ $data[0] = ' ';
$data[0] .= $user_layouts[$id_layout]['name'];
$data[0] .= ' ';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/network_map.php b/pandora_console/include/lib/Dashboard/Widgets/network_map.php
index 8d263cc8f9..c07e09758f 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/network_map.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/network_map.php
@@ -253,6 +253,14 @@ class NetworkMapWidget extends Widget
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
+ $inputs[] = [
+ 'label' => \ui_print_info_message(
+ __('It is recommended to have only one such widget in the control panel.'),
+ '',
+ true
+ ),
+ ];
+
// Default values.
if (isset($values['xOffset']) === false) {
$values['xOffset'] = 0;
@@ -317,7 +325,7 @@ class NetworkMapWidget extends Widget
'type' => 'select',
'fields' => $fields,
'name' => 'networkmapId',
- 'selected' => $values['networkmapId'],
+ 'selected' => $selected,
'return' => true,
],
];
diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_view.php b/pandora_console/include/lib/Dashboard/Widgets/service_view.php
index ec1749671a..d838861659 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/service_view.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/service_view.php
@@ -318,7 +318,7 @@ class ServiceViewWidget extends Widget
// Css Files.
\ui_require_css_file('tree', 'include/styles/', true);
- if ($config['style'] == 'pandora_black') {
+ if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
\ui_require_css_file('pandora_black', 'include/styles/', true);
}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php
index 446f15af21..24845cec87 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php
@@ -455,6 +455,7 @@ class TopNWidget extends Widget
$data_hbar = [];
foreach ($modules as $module) {
+ $module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
$item_name = '';
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
$data_hbar[$item_name]['g'] = $module[$display];
diff --git a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
index bca4c3f366..fe76b94ec0 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php
@@ -542,7 +542,7 @@ class TreeViewWidget extends Widget
// Css Files.
\ui_require_css_file('tree', 'include/styles/', true);
- if ($config['style'] == 'pandora_black') {
+ if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
\ui_require_css_file('pandora_black', 'include/styles/', true);
}
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
index f369324dcf..286d766c14 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
@@ -346,9 +346,7 @@ final class Group extends Item
$countStatus = \db_get_row_sql($sql);
- if ($countStatus['fired'] > 0) {
- $status = AGENT_STATUS_ALERT_FIRED;
- } else if ($countStatus['critical'] > 0) {
+ if ($countStatus['critical'] > 0) {
$status = AGENT_STATUS_CRITICAL;
} else if ($countStatus['warning'] > 0) {
$status = AGENT_STATUS_WARNING;
@@ -359,7 +357,7 @@ final class Group extends Item
}
} else {
// Get the status img src.
- $status = \groups_get_status($groupId);
+ $status = \groups_get_status($groupId, true);
}
$imagePath = \visual_map_get_image_status_element($data, $status);
@@ -408,7 +406,7 @@ final class Group extends Item
$html .= '';
$html .= $groupName;
$html .= '
';
- $html .= '';
+ $html .= '
';
// Critical.
$html .= '
';
$html .= '
';
diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css
index 83cd96dcc1..d1ec1241f8 100644
--- a/pandora_console/include/styles/dashboards.css
+++ b/pandora_console/include/styles/dashboards.css
@@ -411,6 +411,14 @@ table.widget_agent_module tbody tr td {
padding: 5px;
}
+table.widget_agent_module tbody tr:first-child > th {
+ background-color: #373737;
+ color: #fff;
+ font-size: 7.5pt;
+ letter-spacing: 0.3pt;
+ line-height: 16pt;
+}
+
.container-center .widget-histogram-chart .flot-text .flot-x-axis div {
white-space: nowrap;
font-family: inherit !important;
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 63dd45113d..c457176f49 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -776,6 +776,10 @@ select:-internal-list-box {
.padding-bottom-4 {
padding-bottom: 4em;
}
+
+.padding-bottom-5px {
+ padding-bottom: 5px;
+}
.padding-right-2 {
padding-right: 2em;
}
@@ -1357,7 +1361,7 @@ td.datos2f9 {
font-weight: bold;
}
.blue {
- color: #5ab7e5;
+ color: #4a83f3;
font-weight: bold;
}
.black {
@@ -2506,7 +2510,7 @@ tr.group_view_ok,
tr.group_view_not_init,
.group_view_not_init {
- background-color: #5bb6e5;
+ background-color: #4a83f3;
color: #fff;
}
@@ -7301,6 +7305,10 @@ div.graph div.legend table {
background-color: #5bb6e5;
}
+.bg_4a83f3 {
+ background-color: #4a83f3;
+}
+
.bg_aaaaaa {
background-color: #aaaaaa;
}
@@ -8430,3 +8438,34 @@ div.stat-win-spinner img {
margin: 5px;
font-size: 12px;
}
+
+.stat_win_histogram {
+ width: 95%;
+ margin: 0 auto;
+ margin-top: 18%;
+}
+
+#stat-win-module-graph .stat_win_histogram div.nodata_container {
+ width: 100%;
+}
+
+/* For backups dt, can be useful for others */
+#backups_list > thead > tr > th:last-child,
+#backups_list > tbody > tr > td:last-child {
+ text-align: center;
+}
+
+/* err_msg_centralised */
+div#err_msg_centralised div {
+ margin-top: 1em;
+ font-size: 14px;
+}
+
+div#err_msg_centralised img {
+ width: 100px;
+ margin-right: 3em;
+}
+div#err_msg_centralised {
+ display: flex;
+ flex-direction: row;
+}
diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css
index 3e7e773895..40ecaf11ba 100644
--- a/pandora_console/include/styles/tables.css
+++ b/pandora_console/include/styles/tables.css
@@ -301,6 +301,7 @@ a.pandora_pagination.current:hover {
display: inline;
padding: 7pt;
margin-left: 10px;
+ background-color: transparent;
}
.dt-button.buttons-csv.buttons-html5 span {
font-size: 0;
diff --git a/pandora_console/include/styles/visual_maps.css b/pandora_console/include/styles/visual_maps.css
index f4653375a6..a62a780505 100644
--- a/pandora_console/include/styles/visual_maps.css
+++ b/pandora_console/include/styles/visual_maps.css
@@ -454,6 +454,10 @@ div.label strong span {
color: inherit;
}
+.zindex999 {
+ z-index: 999;
+}
+
/*.termframe{
background-color: #82b92e;
}*/
diff --git a/pandora_console/index.php b/pandora_console/index.php
index d6d3be20e0..7828b2c700 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -424,6 +424,8 @@ if (! isset($config['id_user'])) {
// Process logout.
include 'general/logoff.php';
}
+
+ $validatedCSRF = true;
} else {
// process_user_login is a virtual function which should be defined in each auth file.
// It accepts username and password. The rest should be internal to the auth file.
@@ -1121,6 +1123,63 @@ if ($config['pure'] == 0) {
include 'godmode/menu.php';
}
+if (has_metaconsole() === true
+ && (bool) $config['centralized_management'] === true
+) {
+ $MR = (float) $config['MR'];
+ // Node attached to a metaconsole.
+ $server_id = $config['metaconsole_node_id'];
+
+ // Connect to meta.
+ metaconsole_load_external_db(
+ [
+ 'dbhost' => $config['replication_dbhost'],
+ 'dbuser' => $config['replication_dbuser'],
+ 'dbpass' => io_output_password($config['replication_dbpass']),
+ 'dbname' => $config['replication_dbname'],
+ ]
+ );
+ $metaMR = (float) db_get_value(
+ 'value',
+ 'tconfig',
+ 'token',
+ 'MR',
+ false,
+ false
+ );
+
+ // Return connection to node.
+ metaconsole_restore_db();
+
+ if ($MR !== $metaMR) {
+ $err = '
'.html_print_image(
+ '/images/warning_modern.png',
+ true
+ );
+
+ $err .= '
'.__(
+ 'Metaconsole MR (%d) is different than this one (%d)',
+ $metaMR,
+ $MR
+ );
+
+ $err .= ' ';
+ $err .= __('Please keep all environment updated to same version.');
+ $err .= '
';
+ ?>
+
+ \n";
// Values from PHP to be recovered from JAVASCRIPT.
require 'include/php_to_js_values.php';
-
-
?>
-
+
$config['id_user'],
+ 'id_user_task' => $id_user_task,
+ 'args' => serialize($parameters),
+ 'scheduled' => $scheduled,
+ 'flag_delete' => 1,
+ ];
+
+ $result = db_process_sql_insert('tuser_task_scheduled', $values);
+
+ $report_type = $parameters[4];
+
+ ui_print_result_message(
+ $result,
+ __('Your report has been planned, and the system will email you a '.$report_type.' file with the report as soon as its finished'),
+ __('An error has ocurred')
+ );
+ echo '
';
+}
+
// ------------------- INIT HEADER --------------------------------------
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure";
@@ -249,16 +285,18 @@ if (reporting_get_description($id_report)) {
$table->data[0][1] = '
'.reporting_get_name($id_report).'
';
}
-$table->data[0][1] .= '
'.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
-$html_enterprise = enterprise_hook(
- 'reporting_print_button_PDF',
- [$id_report]
-);
-if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
- $table->data[0][1] .= $html_enterprise;
+$table->data[0][1] .= '
'.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true).'';
+
+$html_menu_export = enterprise_hook('reporting_print_button_export');
+if ($html_menu_export === ENTERPRISE_NOT_HOOK) {
+ $html_menu_export = '';
}
+
$table->data[0][1] .= '
';
+$table->data[0][1] .= $html_menu_export;
+
+
$table->data[1][1] = '
'.__('From').':
';
$table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php
index 9fe7d7f9ce..de6461ccec 100755
--- a/pandora_console/operation/search_agents.php
+++ b/pandora_console/operation/search_agents.php
@@ -36,7 +36,8 @@ if (!$agents || !$searchAgents) {
$table->width = '98%';
$table->class = 'databox';
- $table->head = [];
+ $table->head = [];
+
if ($only_count) {
$table->head[0] = __('Agent');
$table->head[1] = __('Description');
@@ -57,6 +58,18 @@ if (!$agents || !$searchAgents) {
$table->head[8] = __('Last contact').' '.'
'.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).' '.'
'.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).' ';
$table->head[9] = '';
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: left';
+ $table->headstyle[2] = 'text-align: left';
+ $table->headstyle[3] = 'text-align: left';
+ $table->headstyle[4] = 'text-align: left';
+ $table->headstyle[5] = 'text-align: left';
+ $table->headstyle[6] = 'text-align: left';
+ $table->headstyle[7] = 'text-align: left';
+ $table->headstyle[8] = 'text-align: left';
+ $table->headstyle[9] = 'text-align: center';
+
$table->align = [];
$table->align[0] = 'left';
$table->align[1] = 'left';
diff --git a/pandora_console/operation/search_alerts.php b/pandora_console/operation/search_alerts.php
index 76beda6166..90e55a963e 100755
--- a/pandora_console/operation/search_alerts.php
+++ b/pandora_console/operation/search_alerts.php
@@ -42,6 +42,13 @@ if ($alerts === false || $totalAlerts == 0 || !$searchAlerts) {
$table->align[3] = 'left';
$table->align[4] = 'left';
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: center';
+ $table->headstyle[1] = 'text-align: left';
+ $table->headstyle[2] = 'text-align: left';
+ $table->headstyle[3] = 'text-align: left';
+ $table->headstyle[4] = 'text-align: left';
+
$table->valign = [];
$table->valign[0] = 'top';
$table->valign[1] = 'top';
diff --git a/pandora_console/operation/search_graphs.php b/pandora_console/operation/search_graphs.php
index 8f76f0dea8..0150d2f56c 100755
--- a/pandora_console/operation/search_graphs.php
+++ b/pandora_console/operation/search_graphs.php
@@ -29,6 +29,10 @@ if ($graphs === false || !$searchGraphs) {
$table->head[0] = __('Graph name');
$table->head[1] = __('Description');
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: left';
+
$table->data = [];
foreach ($graphs as $graph) {
array_push(
diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php
index 813ef1b004..58f75e0ca5 100644
--- a/pandora_console/operation/search_main.php
+++ b/pandora_console/operation/search_main.php
@@ -32,21 +32,21 @@ $table->id = 'summary';
$table->width = '98%';
$table->style = [];
-$table->style[0] = 'font-weight: bold; text-align: center;';
-$table->style[1] = 'font-weight: bold; text-align: center;';
-$table->style[2] = 'font-weight: bold; text-align: center;';
-$table->style[3] = 'font-weight: bold; text-align: center;';
-$table->style[4] = 'font-weight: bold; text-align: center;';
-$table->style[5] = 'font-weight: bold; text-align: center;';
-$table->style[6] = 'font-weight: bold; text-align: center;';
-$table->style[7] = 'font-weight: bold; text-align: center;';
-$table->style[8] = 'font-weight: bold; text-align: center;';
-$table->style[9] = 'font-weight: bold; text-align: center;';
-$table->style[10] = 'font-weight: bold; text-align: center;';
-$table->style[11] = 'font-weight: bold; text-align: center;';
-$table->style[13] = 'font-weight: bold; text-align: center;';
-$table->style[14] = 'font-weight: bold; text-align: center;';
-$table->style[15] = 'font-weight: bold; text-align: center;';
+$table->style[0] = 'font-weight: bold; text-align: left;';
+$table->style[1] = 'font-weight: bold; text-align: left;';
+$table->style[2] = 'font-weight: bold; text-align: left;';
+$table->style[3] = 'font-weight: bold; text-align: left;';
+$table->style[4] = 'font-weight: bold; text-align: left;';
+$table->style[5] = 'font-weight: bold; text-align: left;';
+$table->style[6] = 'font-weight: bold; text-align: left;';
+$table->style[7] = 'font-weight: bold; text-align: left;';
+$table->style[8] = 'font-weight: bold; text-align: left;';
+$table->style[9] = 'font-weight: bold; text-align: left;';
+$table->style[10] = 'font-weight: bold; text-align: left;';
+$table->style[11] = 'font-weight: bold; text-align: left;';
+$table->style[13] = 'font-weight: bold; text-align: left;';
+$table->style[14] = 'font-weight: bold; text-align: left;';
+$table->style[15] = 'font-weight: bold; text-align: left;';
diff --git a/pandora_console/operation/search_maps.php b/pandora_console/operation/search_maps.php
index 0ab656d9b5..6b6aeeb423 100755
--- a/pandora_console/operation/search_maps.php
+++ b/pandora_console/operation/search_maps.php
@@ -32,6 +32,13 @@ if ($maps === false || !$searchMaps) {
$table->align[1] = 'center';
$table->align[2] = 'center';
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: center';
+ $table->headstyle[1] = 'text-align: center';
+
+
+
$table->data = [];
foreach ($maps as $map) {
array_push(
diff --git a/pandora_console/operation/search_modules.php b/pandora_console/operation/search_modules.php
index 81ec17cf39..d055d29946 100644
--- a/pandora_console/operation/search_modules.php
+++ b/pandora_console/operation/search_modules.php
@@ -51,6 +51,17 @@ if (!$modules || !$searchModules) {
$table->align[7] = 'left';
$table->align[8] = 'left';
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: left';
+ $table->headstyle[2] = 'text-align: left';
+ $table->headstyle[3] = 'text-align: left';
+ $table->headstyle[4] = 'text-align: left';
+ $table->headstyle[5] = 'text-align: left';
+ $table->headstyle[6] = 'text-align: left';
+ $table->headstyle[7] = 'text-align: left';
+ $table->headstyle[8] = 'text-align: left';
+
$table->data = [];
$id_type_web_content_string = db_get_value(
diff --git a/pandora_console/operation/search_reports.php b/pandora_console/operation/search_reports.php
index d86b0c5446..e16507a624 100755
--- a/pandora_console/operation/search_reports.php
+++ b/pandora_console/operation/search_reports.php
@@ -44,6 +44,8 @@ if ($reports === false || !$searchReports) {
$table->head[3] = __('XML');
$table->size[0] = '50%';
$table->size[1] = '20%';
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: left';
$table->size[2] = '2%';
$table->headstyle[2] = 'min-width: 35px;text-align: left;';
$table->size[3] = '2%';
diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php
index 5e0fa14384..9951ec528e 100644
--- a/pandora_console/operation/search_results.php
+++ b/pandora_console/operation/search_results.php
@@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
enterprise_include('operation/reporting/custom_reporting.php');
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
-$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AR');
+$searchUsers = $searchPolicies = (check_acl($config['id_user'], 0, 'AR') && enterprise_installed());
$searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'RR');
$searchMaps = check_acl($config['id_user'], 0, 'VR');
$searchMain = true;
diff --git a/pandora_console/operation/search_users.php b/pandora_console/operation/search_users.php
index 3f397129db..ead204915d 100755
--- a/pandora_console/operation/search_users.php
+++ b/pandora_console/operation/search_users.php
@@ -30,6 +30,14 @@ if (!$users || !$searchUsers) {
$table->align = [];
$table->align[4] = 'center';
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align: left';
+ $table->headstyle[1] = 'text-align: left';
+ $table->headstyle[2] = 'text-align: left';
+ $table->headstyle[3] = 'text-align: left';
+ $table->headstyle[4] = 'text-align: center';
+ $table->headstyle[5] = 'text-align: left';
+
$table->head = [];
$table->head[0] = __('User ID').' '.'
'.html_print_image('images/sort_up.png', true, ['style' => $selectUserIDUp]).' '.'
'.html_print_image('images/sort_down.png', true, ['style' => $selectUserIDDown]).' ';
$table->head[1] = __('Name').' '.'
'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).' '.'
'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).' ';
@@ -38,6 +46,8 @@ if (!$users || !$searchUsers) {
$table->head[4] = __('Profile').' '.'
'.html_print_image('images/sort_up.png', true, ['style' => $selectProfileUp]).' '.'
'.html_print_image('images/sort_down.png', true, ['style' => $selectProfileDown]).' ';
$table->head[5] = __('Description');
+
+
$table->data = [];
foreach ($users as $user) {
diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php
index 03f64c8107..45c2b53614 100755
--- a/pandora_console/operation/tree.php
+++ b/pandora_console/operation/tree.php
@@ -330,7 +330,7 @@ enterprise_hook('close_meta_frame');