Merge remote-tracking branch 'origin/develop' into ent-5319-9412-mas-personalizacion-de-paradas-planificada

This commit is contained in:
alejandro.campos@artica.es 2022-08-29 10:06:41 +02:00
commit de55200659
45 changed files with 916 additions and 737 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.764-220816 Version: 7.0NG.764-220829
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.764-220816" pandora_version="7.0NG.764-220829"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.764'; use constant AGENT_VERSION => '7.0NG.764';
use constant AGENT_BUILD => '220816'; use constant AGENT_BUILD => '220829';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.764" PI_VERSION="7.0NG.764"
PI_BUILD="220816" PI_BUILD="220829"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220816} {220829}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.764 Build 220816") #define PANDORA_VERSION ("7.0NG.764 Build 220829")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.764(Build 220816))" VALUE "ProductVersion", "(7.0NG.764(Build 220829))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.764-220816 Version: 7.0NG.764-220829
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.764-220816" pandora_version="7.0NG.764-220829"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -43,20 +43,11 @@ function dbmanager_query($sql, &$error, $dbconnection)
$error = mysqli_error($dbconnection); $error = mysqli_error($dbconnection);
return false; return false;
} }
} else {
$result = mysql_query($sql, $dbconnection);
if ($result === false) {
$backtrace = debug_backtrace();
$error = mysql_error();
return false;
}
} }
if ($result === true) { if ($result === true) {
if ($config['mysqli']) { if ($config['mysqli']) {
return mysqli_affected_rows($dbconnection); return mysqli_affected_rows($dbconnection);
} else {
return mysql_affected_rows();
} }
} }
@ -64,23 +55,17 @@ function dbmanager_query($sql, &$error, $dbconnection)
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
array_push($retval, $row); array_push($retval, $row);
} }
} else {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
array_push($retval, $row);
}
} }
if ($config['mysqli']) { if ($config['mysqli']) {
mysqli_free_result($result); mysqli_free_result($result);
} else {
mysql_free_result($result);
} }
if (! empty($retval)) { if (! empty($retval)) {
return $retval; return $retval;
} }
// Return false, check with === or !== // Return false, check with === or !== .
return 'Empty'; return 'Empty';
} }
@ -171,20 +156,6 @@ function dbmgr_extension_main()
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>"; $data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
\enterprise_include_once('include/functions_metaconsole.php');
$servers = \metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$data[2][0] = html_print_textarea( $data[2][0] = html_print_textarea(
'sql', 'sql',
5, 5,
@ -195,6 +166,21 @@ function dbmgr_extension_main()
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Get the servers.
\enterprise_include_once('include/functions_metaconsole.php');
$servers = \metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$data[3][2] = html_print_input( $data[3][2] = html_print_input(
[ [
'name' => 'node_id', 'name' => 'node_id',
@ -223,7 +209,7 @@ function dbmgr_extension_main()
html_print_table($table); html_print_table($table);
echo '</form>'; echo '</form>';
// Processing SQL Code // Processing SQL Code.
if ($sql == '') { if ($sql == '') {
return; return;
} }
@ -271,7 +257,7 @@ function dbmgr_extension_main()
return; return;
} }
if (! is_array($result)) { if (is_array($result) === false) {
echo '<strong>Output: <strong>'.$result; echo '<strong>Output: <strong>'.$result;
db_pandora_audit( db_pandora_audit(
@ -315,11 +301,10 @@ if (is_metaconsole() === true) {
); );
extensions_add_meta_function('dbmgr_extension_main'); extensions_add_meta_function('dbmgr_extension_main');
} else {
} }
// This adds a option in the operation menu // This adds a option in the operation menu.
extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman'); extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman');
// This sets the function to be called when the extension is selected in the operation menu // This sets the function to be called when the extension is selected in the operation menu.
extensions_add_godmode_function('dbmgr_extension_main'); extensions_add_godmode_function('dbmgr_extension_main');

View File

@ -1,4 +1,3 @@
-- Active: 1653046769261@@127.0.0.1@3306@pandora
START TRANSACTION; START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tuser_task` ( CREATE TABLE IF NOT EXISTS `tuser_task` (
@ -40,6 +39,7 @@ ALTER TABLE `tautoconfig` ADD COLUMN `executed` TINYINT UNSIGNED NOT NULL DEFAUL
ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`; ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`;
ALTER TABLE `tagente` ADD COLUMN `fixed_ip` TINYINT UNSIGNED NOT NULL DEFAULT 0; ALTER TABLE `tagente` ADD COLUMN `fixed_ip` TINYINT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `fixed_ip` TINYINT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tipam_network` DROP FOREIGN KEY `tipam_network_ibfk_1`; ALTER TABLE `tipam_network` DROP FOREIGN KEY `tipam_network_ibfk_1`;
ALTER TABLE `tipam_network` MODIFY COLUMN `id_recon_task` INT UNSIGNED DEFAULT 0; ALTER TABLE `tipam_network` MODIFY COLUMN `id_recon_task` INT UNSIGNED DEFAULT 0;
ALTER TABLE `tipam_network` ADD CONSTRAINT `tipam_network_ibfk_1` FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE SET NULL ON UPDATE CASCADE; ALTER TABLE `tipam_network` ADD CONSTRAINT `tipam_network_ibfk_1` FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -3,4 +3,7 @@ START TRANSACTION;
ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_from` VARCHAR(100) DEFAULT ''; ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_from` VARCHAR(100) DEFAULT '';
ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_to` VARCHAR(100) DEFAULT ''; ALTER TABLE `tplanned_downtime` ADD COLUMN `cron_interval_to` VARCHAR(100) DEFAULT '';
SET @id_config := (SELECT id_config FROM tconfig WHERE `token` = 'metaconsole_node_id' AND `value` IS NOT NULL ORDER BY id_config DESC LIMIT 1);
DELETE FROM tconfig WHERE `token` = 'metaconsole_node_id' AND (id_config < @id_config OR `value` IS NULL);
COMMIT; COMMIT;

View File

@ -307,8 +307,8 @@ $table_ip .= '<div class="label_select_child_right">'.html_print_input(
'type' => 'switch', 'type' => 'switch',
'id' => 'fixed_ip', 'id' => 'fixed_ip',
'name' => 'fixed_ip', 'name' => 'fixed_ip',
'value' => $fixed_ip, 'value' => $fixed_ip
], ]
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>'; ).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
$table_ip .= '</div></div>'; $table_ip .= '</div></div>';

View File

@ -169,154 +169,6 @@ if ($delete === true) {
} }
} }
$table = new stdClass;
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->size = [];
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = [];
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(
false,
'AW',
true,
'id_group',
$id_group,
false,
'',
'',
true
);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox(
'recursion',
1,
$recursion,
true,
false
);
$status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select(
$status_list,
'status_agents',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
);
$table->data[1][2] = __('Show agents');
$table->data[1][3] = html_print_select(
[
0 => 'Only enabled',
1 => 'Only disabled',
],
'disabled',
2,
'',
__('All'),
2,
true,
false,
true,
'',
false,
'width:30%;'
);
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
$server_fields = [];
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
$table->data[2][2] = __('Node');
$table->data[2][3] = html_print_select(
$server_fields,
'nodes[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
}
$table->data[3][0] = __('Agents');
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents = [];
if (is_metaconsole() === false) {
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
}
$table->data[3][1] = html_print_select(
$agents,
'id_agents[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
$url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents'; $url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -324,10 +176,15 @@ if (is_metaconsole() === true) {
} }
echo '<form method="post" id="form_agent" action="'.$url.'">'; echo '<form method="post" id="form_agent" action="'.$url.'">';
html_print_table($table);
$params = [
'id_group' => $id_group,
'recursion' => $recursion,
];
echo get_table_inputs_masive_agents($params);
if (is_metaconsole() === true || is_management_allowed() === true) { if (is_metaconsole() === true || is_management_allowed() === true) {
attachActionButton('delete', 'delete', $table->width); attachActionButton('delete', 'delete', '100%');
} }
echo '</form>'; echo '</form>';
@ -342,54 +199,6 @@ ui_require_jquery_file('pandora.controls');
$(document).ready (function () { $(document).ready (function () {
// Check Metaconsole. // Check Metaconsole.
var metaconsole = '<?php echo (is_metaconsole() === true) ? 1 : 0; ?>'; var metaconsole = '<?php echo (is_metaconsole() === true) ? 1 : 0; ?>';
form_controls_massive_operations_agents(metaconsole);
// Listeners.
var recursion;
$("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});
var disabled;
$("#disabled").change(function () {
disabled = this.value;
$("#id_group").trigger("change");
});
var nodes;
$("#nodes").change(function () {
nodes = $("#nodes").val();
$("#id_group").trigger("change");
});
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
// Build data.
var data = {
status_agents: function () {
return $("#status_agents").val();
},
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {
return recursion;
},
disabled: function() {
return disabled;
},
}
if (metaconsole == 1) {
data.serialized = true;
data.serialized_separator = '|';
data.nodes = function() {
return nodes;
};
}
// Change agents.
$("#id_group").pandoraSelectGroupAgent(data);
}); });
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -68,11 +68,6 @@ $options_agents = [
'edit_agents' => __('Bulk agent edit'), 'edit_agents' => __('Bulk agent edit'),
'delete_agents' => __('Bulk agent delete'), 'delete_agents' => __('Bulk agent delete'),
]; ];
if (is_metaconsole() === true) {
$options_agents = [
'delete_agents' => __('Bulk agent delete'),
];
}
if (check_acl($config['id_user'], 0, 'UM')) { if (check_acl($config['id_user'], 0, 'UM')) {
$options_users = [ $options_users = [

View File

@ -111,6 +111,9 @@ if ($access_console_node === true) {
$sub['godmode/groups/modu_group_list']['text'] = __('Module groups'); $sub['godmode/groups/modu_group_list']['text'] = __('Module groups');
$sub['godmode/groups/modu_group_list']['id'] = 'Module groups'; $sub['godmode/groups/modu_group_list']['id'] = 'Module groups';
$sub['godmode/setup/os']['text'] = __('Operating systems');
$sub['godmode/setup/os']['id'] = 'Edit OS';
} }
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
@ -380,8 +383,6 @@ if ($access_console_node === true) {
} }
$sub['general']['sub2'] = $sub2; $sub['general']['sub2'] = $sub2;
$sub['godmode/setup/os']['text'] = __('Edit OS');
$sub['godmode/setup/os']['id'] = 'Edit OS';
$sub['godmode/setup/license']['text'] = __('License'); $sub['godmode/setup/license']['text'] = __('License');
$sub['godmode/setup/license']['id'] = 'License'; $sub['godmode/setup/license']['id'] = 'License';

View File

@ -833,23 +833,21 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
var added_config = { var added_config = {
"selector": "#tinyMCE_editor", "selector": "#tinyMCE_editor",
"elements": "text-label", "elements": "tinyMCE_editor",
"plugins": "noneditable", "plugins": "noneditable",
"theme_advanced_buttons1": "theme_advanced_buttons1": "bold,italic,|,justifyleft,justifycenter,justifyright,|,undo,redo,|,image,link,|,fontselect,|,forecolor,fontsizeselect,|,code",
"bold,italic,|,justifyleft,justifycenter,justifyright,|,undo,redo,|,image,link,|,fontselect,|,forecolor,fontsizeselect,|,code",
"valid_children": "+body[style]", "valid_children": "+body[style]",
"theme_advanced_font_sizes": "true", "theme_advanced_font_sizes": "true",
"content_css": "content_css": <?php echo '"'.ui_get_full_url('include/styles/pandora.css', false, false, false).'"'; ?>,
<?php echo '"'.ui_get_full_url('include/styles/pandora.css', false, false, false).'"'; ?>,
"editor_deselector": "noselected", "editor_deselector": "noselected",
"inline_styles": true, "inline_styles": true,
"nowrap": true, "nowrap": true,
"width": "400", "width": "400",
"height": "200", "height": "200",
} "body_class": "tinyMCEBody",
}
defineTinyMCE(added_config);
defineTinyMCE(added_config);
$("#dialog_label_editor").hide () $("#dialog_label_editor").hide ()
.dialog ({ .dialog ({
title: "<?php echo __('Edit label'); ?>", title: "<?php echo __('Edit label'); ?>",
@ -860,38 +858,33 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
opacity: 0.5, opacity: 0.5,
background: "black" background: "black"
}, },
width: 450, width: 530,
height: 300, height: 300,
autoOpen: false, autoOpen: false,
beforeClose: function() { beforeClose: function() {
var id_layout_data = $("#active_id_layout_data").val(); var id_layout_data = $("#active_id_layout_data").val();
var label = tinyMCE.activeEditor.getContent(); var label = tinyMCE.activeEditor.getContent();
$("#hidden-label_" + id_layout_data).val(label); $("#hidden-label_" + id_layout_data).val(label);
} }
}); });
var idText = $("#ip_text").html();
}); });
var idText = $("#ip_text").html();
function show_dialog_label_editor(id_layout_data) { function show_dialog_label_editor(id_layout_data) {
var label = $("#hidden-label_" + id_layout_data).val(); var label = $("#hidden-label_" + id_layout_data).val();
$("#active_id_layout_data").val(id_layout_data); $("#active_id_layout_data").val(id_layout_data);
$("#tinyMCE_editor").val(label);
tinyMCE.activeEditor.setContent(label); tinyMCE.activeEditor.setContent(label);
$("#dialog_label_editor").dialog("open"); $("#dialog_label_editor").dialog("open");
} }
function toggle_checkbox_multiple_delete() { function toggle_checkbox_multiple_delete() {
checked_head_multiple = $("input[name='head_multiple_delete']") checked_head_multiple = $("input[name='head_multiple_delete']")
.is(":checked"); .is(":checked");
$("input[name='multiple_delete_items']") $("input[name='multiple_delete_items']")
.prop("checked", checked_head_multiple); .prop("checked", checked_head_multiple);
} }
function submit_delete_multiple_items() { function submit_delete_multiple_items() {
delete_items = []; delete_items = [];
jQuery.each($("input[name='multiple_delete_items']:checked"), jQuery.each($("input[name='multiple_delete_items']:checked"),
@ -899,8 +892,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
delete_items.push($(item).val()); delete_items.push($(item).val());
} }
); );
$("input[name='id_item_json']").val(JSON.stringify(delete_items)); $("input[name='id_item_json']").val(JSON.stringify(delete_items));
$("#form_multiple_delete").submit(); $("#form_multiple_delete").submit();
} }

View File

@ -208,7 +208,7 @@ if ($is_management_allowed === true) {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
$headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of OS'); $headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of Operating Systems');
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
// Header. // Header.

View File

@ -324,7 +324,7 @@ switch ($section) {
} }
// Put header inside div for special sizing.(No right margin). // Put header inside div for special sizing.(No right margin).
echo '<div id="header_configuration" style="width: calc(100% + 3em);">'; echo '<div id="header_configuration" style="width: calc(100%);">';
// Header. // Header.
ui_print_page_header( ui_print_page_header(
__('Configuration').$subpage, __('Configuration').$subpage,

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC220816'; $build_version = 'PC220829';
$pandora_version = 'v7.0NG.764'; $pandora_version = 'v7.0NG.764';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -1279,7 +1279,8 @@ function events_get_all(
// Table tag for id_grupo. // Table tag for id_grupo.
'te.', 'te.',
// Alt table tag for id_grupo. // Alt table tag for id_grupo.
$user_admin_group_all $user_admin_group_all,
(bool) $filter['search_secondary_groups']
); );
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EW')) { } else if (check_acl($config['id_user'], 0, 'EW')) {
@ -1305,7 +1306,8 @@ function events_get_all(
// Table tag for id_grupo. // Table tag for id_grupo.
'te.', 'te.',
// Alt table tag for id_grupo. // Alt table tag for id_grupo.
$user_admin_group_all $user_admin_group_all,
(bool) $filter['search_secondary_groups']
); );
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EM')) { } else if (check_acl($config['id_user'], 0, 'EM')) {
@ -1331,7 +1333,8 @@ function events_get_all(
// Table tag for id_grupo. // Table tag for id_grupo.
'te.', 'te.',
// Alt table tag for id_grupo. // Alt table tag for id_grupo.
$user_admin_group_all $user_admin_group_all,
(bool) $filter['search_secondary_groups']
); );
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} }

View File

@ -95,3 +95,168 @@ function attachActionButton(
$return $return
); );
} }
/**
* Get table inputs for massive operation agents edit and delete.
*
* @param array $params Params.
*
* @return string Output.
*/
function get_table_inputs_masive_agents($params)
{
global $config;
$table = new stdClass;
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->size = [];
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = [];
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(
false,
'AW',
true,
'id_group',
$params['id_group'],
false,
'',
'',
true
);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox(
'recursion',
1,
$params['recursion'],
true,
false
);
$status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select(
$status_list,
'status_agents',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
);
$table->data[1][2] = __('Show agents');
$table->data[1][3] = html_print_select(
[
0 => 'Only enabled',
1 => 'Only disabled',
],
'disabled',
2,
'',
__('All'),
2,
true,
false,
true,
'',
false,
'width:30%;'
);
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
$server_fields = [];
foreach ($servers as $key => $server) {
$server_fields[$key] = $server['server_name'];
}
$table->data[2][2] = __('Node');
$table->data[2][3] = html_print_select(
$server_fields,
'nodes[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
}
$table->data[3][0] = __('Agents');
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents = [];
if (is_metaconsole() === false) {
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
}
$table->data[3][1] = html_print_select(
$agents,
'id_agents[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
$output = html_print_table($table, true);
return $output;
}

View File

@ -751,7 +751,8 @@ function tags_get_acl_tags(
$childrens_ids=[], $childrens_ids=[],
$force_group_and_tag=false, $force_group_and_tag=false,
$id_grupo_table_pretag='', $id_grupo_table_pretag='',
$alt_id_grupo_table_pretag='' $alt_id_grupo_table_pretag='',
$search_secondary_group=true
) { ) {
global $config; global $config;
@ -831,7 +832,8 @@ function tags_get_acl_tags(
$force_group_and_tag, $force_group_and_tag,
false, false,
$id_grupo_table_pretag, $id_grupo_table_pretag,
$alt_id_grupo_table_pretag $alt_id_grupo_table_pretag,
$search_secondary_group
); );
if (!empty($condition)) { if (!empty($condition)) {
@ -933,7 +935,8 @@ function tags_get_acl_tags_event_condition(
$force_group_and_tag=false, $force_group_and_tag=false,
$force_equal=false, $force_equal=false,
$id_grupo_table_pretag='', $id_grupo_table_pretag='',
$alt_id_grupo_table_pretag='' $alt_id_grupo_table_pretag='',
$search_secondary_group=true
) { ) {
global $config; global $config;
$condition = []; $condition = [];
@ -951,7 +954,13 @@ function tags_get_acl_tags_event_condition(
// Group condition (The module belongs to an agent of the group X) // Group condition (The module belongs to an agent of the group X)
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_children_ids($group_id, true))));. // $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_children_ids($group_id, true))));.
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')'; $group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id;
if ($search_secondary_group === true) {
$group_condition .= ' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id;
}
$group_condition .= ')';
// Tags condition (The module has at least one of the restricted tags). // Tags condition (The module has at least one of the restricted tags).
$tags_condition = ''; $tags_condition = '';
@ -987,7 +996,13 @@ function tags_get_acl_tags_event_condition(
} }
$in_group = implode(',', $without_tags); $in_group = implode(',', $without_tags);
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR '.$alt_id_grupo_table_pretag.'id_group IN (%s))', $in_group, $in_group); $condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s)', $in_group);
if ($search_secondary_group === true) {
$condition .= sprintf(' OR '.$alt_id_grupo_table_pretag.'id_group IN (%s)', $in_group);
}
$condition .= ')';
} }
$condition = !empty($condition) ? "($condition)" : ''; $condition = !empty($condition) ? "($condition)" : '';

View File

@ -473,9 +473,9 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
if ($user_access_node && check_acl($config['id_user'], $id_group, 'LW')) { if ($user_access_node && check_acl($config['id_user'], $id_group, 'LW')) {
// Actions table // Actions table
echo '<div class="w100p right mw300px right_align">'; echo '<div class="w100p right_align">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'" target="_blank">'; echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'" target="_blank">';
html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search"'); html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search" style="margin-right: 20px"');
echo '</a>'; echo '</a>';
echo '</div>'; echo '</div>';
} }

View File

@ -94,3 +94,55 @@ function showMassiveOperationMessage(message) {
}); });
} }
*/ */
// eslint-disable-next-line no-unused-vars
function form_controls_massive_operations_agents(metaconsole) {
// Listeners.
var recursion;
$("#checkbox-recursion").click(function() {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});
var disabled;
$("#disabled").change(function() {
disabled = this.value;
$("#id_group").trigger("change");
});
var nodes;
$("#nodes").change(function() {
nodes = $("#nodes").val();
$("#id_group").trigger("change");
});
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
// Build data.
var data = {
status_agents: function() {
return $("#status_agents").val();
},
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {
return recursion;
},
disabled: function() {
return disabled;
}
};
if (metaconsole == 1) {
data.serialized = true;
data.serialized_separator = "|";
data.nodes = function() {
return nodes;
};
}
// Change agents.
$("#id_group").pandoraSelectGroupAgent(data);
}

View File

@ -201,7 +201,7 @@ ol.steps li.visited a {
} }
/* White text */ /* White text */
a, a:not(.visual-console-item),
label, label,
#menu_tab_left li a, #menu_tab_left li a,
#menu_tab_left li span, #menu_tab_left li span,

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.764'; $version = '7.0NG.764';
$build = '220816'; $build = '220829';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -438,8 +438,7 @@ if ($access_console_node === true) {
) )
); );
$javascript = 'javascript: openSoundEventModal(`'.$data_sound.'`);';
$javascript = 'javascript: openSoundEventModal(\''.$data_sound.'\');';
$sub[$javascript]['text'] = __('Sound Events'); $sub[$javascript]['text'] = __('Sound Events');
$sub[$javascript]['id'] = 'Sound Events Modal'; $sub[$javascript]['id'] = 'Sound Events Modal';
$sub[$javascript]['type'] = 'direct'; $sub[$javascript]['type'] = 'direct';

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -3381,6 +3381,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0, `safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0,
`cps` INT NOT NULL DEFAULT 0, `cps` INT NOT NULL DEFAULT 0,
`satellite_server` INT NOT NULL DEFAULT 0, `satellite_server` INT NOT NULL DEFAULT 0,
`fixed_ip` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id_agente`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)), KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`), KEY `direccion` (`direccion`),

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.764-220816 Version: 7.0NG.764-220829
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.764-220816" pandora_version="7.0NG.764-220829"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.764"; my $pandora_version = "7.0NG.764";
my $pandora_build = "220816"; my $pandora_build = "220829";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -1543,14 +1543,20 @@ sub db_insert_get_values ($) {
######################################################################## ########################################################################
## Try to obtain the given lock. ## Try to obtain the given lock.
######################################################################## ########################################################################
sub db_get_lock($$;$) { sub db_get_lock($$;$$) {
my ($dbh, $lock_name, $lock_timeout) = @_; my ($dbh, $lock_name, $lock_timeout, $do_not_wait_lock) = @_;
# Only supported in MySQL. # Only supported in MySQL.
return 1 unless ($RDBMS eq 'mysql'); return 1 unless ($RDBMS eq 'mysql');
# Set a default lock timeout of 1 second # Set a default lock timeout of 1 second
$lock_timeout = 1 if (! defined ($lock_timeout)); $lock_timeout = 1 if (! defined ($lock_timeout));
if ($do_not_wait_lock) {
if (!db_is_free_lock($dbh, $lock_name)) {
return 0;
}
}
# Attempt to get the lock! # Attempt to get the lock!
my $sth = $dbh->prepare('SELECT GET_LOCK(?, ?)'); my $sth = $dbh->prepare('SELECT GET_LOCK(?, ?)');
@ -1563,6 +1569,26 @@ sub db_get_lock($$;$) {
return $lock; return $lock;
} }
########################################################################
## Check is lock is free.
########################################################################
sub db_is_free_lock($$) {
my ($dbh, $lock_name) = @_;
# Only supported in MySQL.
return 1 unless ($RDBMS eq 'mysql');
# Attempt to get the lock!
my $sth = $dbh->prepare('SELECT IS_FREE_LOCK(?)');
$sth->execute($lock_name);
my ($lock) = $sth->fetchrow;
# Something went wrong
return 0 if (! defined ($lock));
return $lock;
}
######################################################################## ########################################################################
## Release the given lock. ## Release the given lock.
######################################################################## ########################################################################

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.764"; my $pandora_version = "7.0NG.764";
my $pandora_build = "220816"; my $pandora_build = "220829";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.764 %define version 7.0NG.764
%define release 220816 %define release 220829
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.764" PI_VERSION="7.0NG.764"
PI_BUILD="220816" PI_BUILD="220829"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.764 Build 220816"; my $version = "7.0NG.764 Build 220829";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -1193,6 +1193,20 @@ if ($conf{'_force'} == 1) {
db_release_pandora_lock($dbh, $lock_name, $LOCK_TIMEOUT); db_release_pandora_lock($dbh, $lock_name, $LOCK_TIMEOUT);
} }
# Get a lock merging.
my $lock_merge = db_get_lock ($dbh, 'merge-working', $LOCK_TIMEOUT, 1);
if ($lock_merge == 0) {
log_message ('', " [*] Merge is running.\n\n");
exit 1;
}
# Get a lock on merging events.
my $lock_merge_events = db_get_lock ($dbh, 'merging-events', $LOCK_TIMEOUT, 1);
if ($lock_merge_events == 0) {
log_message ('', " [*] Merge events is running.\n\n");
exit 1;
}
# Get a lock on dbname. # Get a lock on dbname.
my $lock = db_get_pandora_lock ($dbh, $lock_name, $LOCK_TIMEOUT); my $lock = db_get_pandora_lock ($dbh, $lock_name, $LOCK_TIMEOUT);
if ($lock == 0) { if ($lock == 0) {

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.764 Build 220816"; my $version = "7.0NG.764 Build 220829";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);