';
+ $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.
*
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..54de518144 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -3231,9 +3231,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 +3556,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 +3676,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..63e39a652a 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;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 3f7624fee0..34a45685d2 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -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_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/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/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..afa55434c0 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 + " "
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/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/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/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 fad9c9179a..3a63daf264 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -1357,7 +1357,7 @@ td.datos2f9 {
font-weight: bold;
}
.blue {
- color: #5ab7e5;
+ color: #4a83f3;
font-weight: bold;
}
.black {
@@ -2506,7 +2506,7 @@ tr.group_view_ok,
tr.group_view_not_init,
.group_view_not_init {
- background-color: #5bb6e5;
+ background-color: #4a83f3;
color: #fff;
}
@@ -7301,6 +7301,10 @@ div.graph div.legend table {
background-color: #5bb6e5;
}
+.bg_4a83f3 {
+ background-color: #4a83f3;
+}
+
.bg_aaaaaa {
background-color: #aaaaaa;
}
@@ -8434,3 +8438,24 @@ div.stat-win-spinner img {
.fc-col-header-cell-cushion {
color: #fff;
}
+
+/* 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';
-
-
?>
-
+
var treeController = TreeController.getController();
-
+
processTreeSearch();
$("form#tree_search").submit(function(e) {
diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php
index 6c93b10a71..2a2d0427ed 100644
--- a/pandora_console/operation/users/user_edit.php
+++ b/pandora_console/operation/users/user_edit.php
@@ -186,6 +186,8 @@ if (isset($_GET['modified']) && !$view_mode) {
} else {
if (!empty($password_new) && !empty($password_confirm)) {
$success_msg = __('Password successfully updated');
+ } else if ($upd_info['id_skin'] !== $user_info['id_skin']) {
+ $success_msg = __('Skin successfully updated');
} else {
$return = false;
$error_msg = __('No changes have been made');
diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php
index 33a860ef22..8b51d0a8f6 100644
--- a/pandora_console/operation/visual_console/view.php
+++ b/pandora_console/operation/visual_console/view.php
@@ -398,6 +398,17 @@ if ($pure === false) {
echo '
';
if ($aclWrite === true || $aclManage === true) {
+ if (!is_metaconsole()) {
+ echo '
'.html_print_image(
+ 'images/target.png',
+ true,
+ [
+ 'title' => __('Force remote checks'),
+ 'class' => 'invert_filter',
+ ]
+ ).' ';
+ }
+
echo html_print_checkbox_switch('edit-mode', 1, false, true);
}
@@ -671,12 +682,14 @@ if ($edit_capable === true) {
if ($(this).prop('checked')) {
visualConsoleManager.visualConsole.enableEditMode();
visualConsoleManager.changeUpdateInterval(0);
+ $('#force_check').hide();
$('#edit-controls').css('visibility', '');
} else {
visualConsoleManager.visualConsole.disableEditMode();
visualConsoleManager.visualConsole.unSelectItems();
visualConsoleManager.changeUpdateInterval(); // To ms.
$('#edit-controls').css('visibility', 'hidden');
+ $('#force_check').show();
}
});
';
+ $.ajax({
+ type: "GET",
+ url: "ajax.php",
+ dataType: "json",
+ data: {
+ page: "include/ajax/visual_console.ajax",
+ force_remote_check: true,
+ id_layout: id_layout
+ },
+ success: function (data) {
+ if (data == 1) {
+ visualConsoleManager.changeUpdateInterval(5000);
+ setTimeout(resetInterval, 6000);
+ } else {
+ resetInterval();
+ }
+ },
+ error: function (data) {
+ resetInterval();
+ }
+ });
+ });
+
+ function resetInterval() {
+ visualConsoleManager.changeUpdateInterval();
+ }
+
/**
* Process ajax responses and shows a dialog with results.
*/
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 25894b5b50..95eda5272f 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.759
-%define release 211217
+%define release 220125
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 4eed4d223d..42ab6efb15 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.759
-%define release 211217
+%define release 220125
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 3313fa6a83..751f7bbb92 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.759
-%define release 211217
+%define release 220125
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 68861c50eb..0f766eea65 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -2856,7 +2856,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0,
`rules` text,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8;
@@ -2951,7 +2952,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` (
`id_policy` int(10) unsigned NOT NULL default '0',
`id_agent` int(10) unsigned NOT NULL default '0',
`operation` varchar(15) default '',
- `progress` int(10) unsigned NOT NULL default '0',
+ `progress` int(10) NOT NULL default '0',
`end_utimestamp` int(10) unsigned NOT NULL default 0,
`priority` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 644e0a533f..bcad5b2b80 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
-('MR', 50),
+('MR', 51),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
-('current_package', 758),
+('current_package', 759),
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 08203276ca..19c5962a71 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-server
-Version: 7.0NG.759-211217
+Version: 7.0NG.759-220125
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index e6ea8b19d2..0006a8bc4e 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.759-211217"
+pandora_version="7.0NG.759-220125"
package_cpan=0
package_pandora=1
diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new
index 7e53d28c39..7dc311915c 100644
--- a/pandora_server/conf/pandora_server.conf.new
+++ b/pandora_server/conf/pandora_server.conf.new
@@ -348,6 +348,9 @@ fsnmp /usr/bin/pandorafsnmp
autocreate_group 10
+# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both.
+#autocreate_group_name Unknown
+
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows
index 9d953cfa94..0a2717793c 100644
--- a/pandora_server/conf/pandora_server.conf.windows
+++ b/pandora_server/conf/pandora_server.conf.windows
@@ -274,6 +274,9 @@ dataserver_threads 2
autocreate_group 10
+# Works like autocreate_group, except the name of the group is specified (instead of its id). Do not set both.
+#autocreate_group_name Unknown
+
# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index c3505a7dc7..49dd0fbe9c 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.759";
-my $pandora_build = "211217";
+my $pandora_build = "220125";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@@ -398,6 +398,7 @@ sub pandora_load_config {
$pa_config->{'autocreate_group'} = -1;
$pa_config->{'autocreate_group_force'} = 1;
+ $pa_config->{'autocreate_group_name'} = '';
$pa_config->{'autocreate'} = 1;
# max log size (bytes)
@@ -942,6 +943,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) {
$pa_config->{'autocreate_group_force'}= clean_blank($1);
}
+ elsif ($parametro =~ m/^autocreate_group_name\s(.*)/i) {
+ $pa_config->{'autocreate_group_name'}= clean_blank($1);
+ }
elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) {
$pa_config->{'discovery_threads'}= clean_blank($1);
}
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index 1f21390b0f..9d1736266f 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -3846,7 +3846,8 @@ sub pandora_get_agent_group {
my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_;
my $group_id;
- my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($pa_config->{'autocreate_group'}, $agent_group) : ($agent_group, $pa_config->{'autocreate_group'});
+ my $auto_group = $pa_config->{'autocreate_group_name'} ne '' ? $pa_config->{'autocreate_group_name'} : $pa_config->{'autocreate_group'};
+ my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($auto_group, $agent_group) : ($agent_group, $auto_group);
foreach my $group (@groups) {
next unless defined($group);
@@ -5540,7 +5541,24 @@ sub pandora_process_policy_queue ($) {
}
if($operation->{'operation'} eq 'apply' || $operation->{'operation'} eq 'apply_db') {
- enterprise_hook('pandora_apply_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}, $operation->{'id'}, $operation->{'operation'}]);
+ my $policy_applied = enterprise_hook(
+ 'pandora_apply_policy',
+ [
+ $dbh,
+ $pa_config,
+ $operation->{'id_policy'},
+ $operation->{'id_agent'},
+ $operation->{'id'},
+ $operation->{'operation'}
+ ]
+ );
+
+ if($policy_applied == 0) {
+ sleep($pa_config->{'server_threshold'});
+ # Skip.
+ next;
+ }
+
}
elsif($operation->{'operation'} eq 'delete') {
if($operation->{'id_agent'} == 0) {
diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm
index f3b6fd63aa..2bd398cfda 100644
--- a/pandora_server/lib/PandoraFMS/DataServer.pm
+++ b/pandora_server/lib/PandoraFMS/DataServer.pm
@@ -89,11 +89,20 @@ sub new ($$;$) {
}
}
- if ($config->{'autocreate_group'} > 0 && !defined(get_group_name ($dbh, $config->{'autocreate_group'}))) {
- my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token).";
- logger($config, $msg, 3);
- print_message($config, $msg, 1);
- pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
+ if ($config->{'autocreate_group_name'} ne '') {
+ if (get_group_id($dbh, $config->{'autocreate_group_name'}) == -1) {
+ my $msg = "Group '" . $config->{'autocreate_group_name'} . "' does not exist (check autocreate_group_name config token).";
+ logger($config, $msg, 3);
+ print_message($config, $msg, 1);
+ pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
+ }
+ } elsif ($config->{'autocreate_group'} > 0) {
+ if (!defined(get_group_name ($dbh, $config->{'autocreate_group'}))) {
+ my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token).";
+ logger($config, $msg, 3);
+ print_message($config, $msg, 1);
+ pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
+ }
}
bless $self, $class;
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index d947768468..ee36608a39 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.759";
-my $pandora_build = "211217";
+my $pandora_build = "220125";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index ae3f9b8885..ad19682385 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.759
-%define release 211217
+%define release 220125
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 722b330dc7..a93bf4f664 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.759
-%define release 211217
+%define release 220125
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 2a82c0941f..63ed6aef08 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.759"
-PI_BUILD="211217"
+PI_BUILD="220125"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f281f9f680..b6704ddb5d 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
-my $version = "7.0NG.759 Build 211217";
+my $version = "7.0NG.759 Build 220125";
# Pandora server configuration
my %conf;
@@ -391,11 +391,11 @@ sub pandora_purgedb ($$) {
# Delete old log data
log_message ('PURGE', "Deleting old network configuration manager data.");
- if (defined($conf->{'days_purge_ncm'}) && $conf->{'days_purge_ncm'} > 0) {
- log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'days_purge_ncm'} . ' days.');
- enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'days_purge_ncm'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]);
+ if (defined($conf->{'_days_purge'}) && $conf->{'_days_purge'} > 0) {
+ log_message ('PURGE', 'Deleting NCM data older than ' . $conf->{'_days_purge'} . ' days.');
+ enterprise_hook ('pandora_purge_ncm', [$dbh, \&log_message, $conf->{'_days_purge'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}]);
} else {
- log_message ('PURGE', 'days_purge_ncm is set to 0. Old network configuration manager data will not be deleted.');
+ log_message ('PURGE', '_days_purge is set to 0. Old network configuration manager data will not be deleted.');
}
# Delete old special days
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index c6a0ffad37..511ef09bf4 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "7.0NG.759 Build 211217";
+my $version = "7.0NG.759 Build 220125";
# save program name for logging
my $progname = basename($0);