#8365 ix merge conflict

This commit is contained in:
Jonathan 2023-12-07 10:58:45 +01:00
commit 78bb8e0bae
78 changed files with 1207 additions and 765 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.774-231130 Version: 7.0NG.774-231207
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.774-231130" pandora_version="7.0NG.774-231207"
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

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.774'; use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '231130'; use constant AGENT_BUILD => '231207';
# 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

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
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.774" PI_VERSION="7.0NG.774"
PI_BUILD="231130" PI_BUILD="231207"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{231130} {231207}
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.774 Build 231130") #define PANDORA_VERSION ("7.0NG.774 Build 231207")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.774(Build 231130))" VALUE "ProductVersion", "(7.0NG.774(Build 231207))"
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.774-231130 Version: 7.0NG.774-231207
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.774-231130" pandora_version="7.0NG.774-231207"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1720,3 +1720,4 @@ include/functions_integriaims.php
include/ajax/integria_incidents.ajax.php include/ajax/integria_incidents.ajax.php
enterprise/operation/log/log_source.php enterprise/operation/log/log_source.php
enterprise/include/class/LogSource.class.php enterprise/include/class/LogSource.class.php
include/chart_generator.php

View File

@ -1058,13 +1058,15 @@ UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=11; WHERE id=11;
-- Delete table tagent_access -- Delete table tagent_access
DROP TABLE tagent_access; DROP TABLE IF EXISTS tagent_access;
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`; ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`; ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
ALTER TABLE `tevent_filter`
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
-- Update macros for plugin oracle -- Update macros for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle'; UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
@ -1077,9 +1079,19 @@ INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app;
UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app; UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
-- Update lts updates
UPDATE tconfig SET value='1' WHERE token='lts_updates';
ALTER TABLE `tdashboard` ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`, ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`, ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`; ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc";
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
COMMIT; COMMIT;

View File

@ -600,43 +600,176 @@ html_print_div(
'content' => html_print_table($tableAgent, true).$CodeQRTable, 'content' => html_print_table($tableAgent, true).$CodeQRTable,
] ]
); );
/*
TODO REVIEW
$table_satellite = '';
if ($remote_agent === true) {
// Satellite server selector.
$satellite_servers = db_get_all_rows_filter(
'tserver',
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
[
'id_server',
'name',
]
);
$satellite_names = []; // Basic Options.
if (empty($satellite_servers) === false) { $tableBasicAgent = new stdClass();
foreach ($satellite_servers as $s_server) { $tableBasicAgent->class = 'filter-table-adv';
$satellite_names[$s_server['id_server']] = $s_server['name']; $tableBasicAgent->data = [];
$disabledBasic = false;
$tableClassDisabled = '';
if ($new_agent === true || $remote_agent === false || $has_remote_conf === false) {
$disabledBasic = true;
$tableClassDisabled = ' basic-options-disabled';
}
if (enterprise_installed()) {
// Get all plugins (BASIC OPTIONS).
$agent_plugin = new PandoraFMS\Agent($id_agente);
$plugins = $agent_plugin->getPlugins();
// Check if some plugin was enabled/disabled in conf.
foreach ($plugins as $key => $row) {
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$security_hardening = 0;
} else {
$security_hardening = 1;
}
} }
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>'; if ($id_os === '1' || $id_os === '8') {
$table_satellite .= '<div class="label_select_parent">'; if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
$table_satellite .= html_print_input( if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_inventory = 0;
} else {
$enable_inventory = 1;
}
}
} else {
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
if ($row['disabled'] === 1) {
$enable_inventory = 0;
} else {
$enable_inventory = 1;
}
}
}
}
if ($id_os === '9') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
}
}
unset($agent_plugin, $plugins);
if (($new_agent === true && $config['current_package'] >= 774) || ($agent_version >= 774 && $new_agent === false)) {
if ($disabledBasic === true || $has_remote_conf === false) {
$message = __('Remote config disabled, please activate to enable agent basic options');
$tableBasicAgent->data[] = '<span>'.$message.'</span>';
}
$tableBasicAgent->data[] = html_print_label_input_block(
__('Enable security hardening monitoring'),
html_print_input(
[ [
'type' => 'select', 'type' => 'switch',
'fields' => $satellite_names, 'id' => 'security_hardening',
'name' => 'satellite_server', 'name' => 'security_hardening',
'selected' => $satellite_server, 'value' => $security_hardening,
'nothing' => __('None'), 'disabled' => $disabledBasic,
'nothinf_value' => 0,
'return' => true,
] ]
).'<div class="label_select_child_icons"></div></div></div>'; ).html_print_input_hidden('options_package', '1', true)
);
$tableBasicAgent->data[] = html_print_label_input_block(
__('Enable log collection'),
html_print_input(
[
'type' => 'switch',
'id' => 'enable_log_collector',
'name' => 'enable_log_collector',
'value' => $enable_log_collector,
'disabled' => $disabledBasic,
]
)
);
} }
$tableBasicAgent->data[] = html_print_label_input_block(
__('Enable inventory'),
html_print_input(
[
'type' => 'switch',
'id' => 'enable_inventory',
'name' => 'enable_inventory',
'value' => $enable_inventory,
'disabled' => $disabledBasic,
]
).html_print_input_hidden('enable_basic_options', '1', true)
);
if ($config['ehorus_enabled'] === '1') {
$pandoraRC_Id = html_print_image(
'images/alert_recovered@svg.svg',
true,
[
'class' => 'invert_filter main_menu_icon',
'title' => __('Pandora RC connected with id ').$config['ehorus_custom_field'],
]
);
} else {
$pandoraRC_Id = html_print_image(
'images/alerts.svg',
true,
[
'class' => 'invert_filter main_menu_icon',
'title' => __('This agent do not have a Pandora RC agent installed, install one.'),
]
);
} }
*/
$tableBasicAgent->data[] = html_print_label_input_block(
__('Enable remote control'),
$pandoraRC_Id
);
$WarningPackage = '';
if (($new_agent === true && $config['current_package'] < 774) || ($agent_version < 774 && $new_agent === false)) {
$WarningPackage = html_print_image(
'images/alert-yellow@svg.svg',
true,
[
'title' => __('Only available for agents 774 or higher'),
'alt' => __('Only available for agents 774 or higher'),
'class' => 'main_menu_icon mrgn_lft_5px',
]
);
}
} else {
$tableBasicAgent->data[] = '<span>'.__('Remote config is enabled only in the Enteprise version').'</span>';
$tableBasicAgent->data[] .= html_print_input_hidden(
'enable_basic_options',
'0',
true
);
}
ui_toggle(
html_print_table($tableBasicAgent, true),
'<span class="subsection_header_title">'.__('Basic options').$WarningPackage.'</span>',
'',
'basic_options',
true,
false,
'white_box_content',
'no-border white_table_graph'.$tableClassDisabled,
'box-flat white_table_graph invisible'
);
// Advanced options. // Advanced options.
$tableAdvancedAgent = new stdClass(); $tableAdvancedAgent = new stdClass();
@ -1256,7 +1389,8 @@ ui_require_jquery_file('bgiframe');
}); });
$("#checkbox-cascade_protection").change(function () { $("#checkbox-cascade_protection").change(function () {
var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) { var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) {
$("#cascade_protection_module").removeAttr("disabled"); $("#cascade_protection_module").removeAttr("disabled");
$("#text-id_parent").attr("required", "required"); $("#text-id_parent").attr("required", "required");
} }
@ -1266,7 +1400,7 @@ ui_require_jquery_file('bgiframe');
$("#text-id_parent").removeAttr("required"); $("#text-id_parent").removeAttr("required");
} }
}); });
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
if (safe_mode_checked) { if (safe_mode_checked) {
$("#safe_mode_module").removeAttr("disabled"); $("#safe_mode_module").removeAttr("disabled");
@ -1274,10 +1408,10 @@ ui_require_jquery_file('bgiframe');
else { else {
$("#safe_mode_module").attr("disabled", 'disabled'); $("#safe_mode_module").attr("disabled", 'disabled');
} }
$("#checkbox-safe_mode").change(function () { $("#checkbox-safe_mode").change(function () {
var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); var safe_mode_checked = $("#checkbox-safe_mode").is(":checked");
if (safe_mode_checked) { if (safe_mode_checked) {
$("#safe_mode_module").removeAttr("disabled"); $("#safe_mode_module").removeAttr("disabled");
} }
@ -1311,5 +1445,17 @@ ui_require_jquery_file('bgiframe');
} }
}); });
check_basic_options();
$('#id_os').on('change', function(){
check_basic_options();
})
}); });
function check_basic_options(){
if ($('#id_os').val() == 1 || $('#id_os').val() == 8 || $('#id_os').val() == 9) {
$('#basic_options').removeClass('invisible');
} else {
$('#basic_options').addClass('invisible');
}
}
</script> </script>

View File

@ -232,7 +232,7 @@ if ($create_agent) {
$cps = (int) get_parameter_switch('cps', -1); $cps = (int) get_parameter_switch('cps', -1);
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0); $fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2); $vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
$agent_version = $config['current_package'];
$secondary_groups = (array) get_parameter('secondary_groups_selected', ''); $secondary_groups = (array) get_parameter('secondary_groups_selected', '');
$fields = db_get_all_fields_in_table('tagent_custom_fields'); $fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -300,6 +300,7 @@ if ($create_agent) {
'cps' => $cps, 'cps' => $cps,
'fixed_ip' => $fixed_ip, 'fixed_ip' => $fixed_ip,
'vul_scan_enabled' => $vul_scan_enabled, 'vul_scan_enabled' => $vul_scan_enabled,
'agent_version' => $agent_version,
] ]
); );
} else { } else {
@ -1015,6 +1016,13 @@ if ($update_agent) {
$satellite_server = (int) get_parameter('satellite_server', 0); $satellite_server = (int) get_parameter('satellite_server', 0);
$fixed_ip = (int) get_parameter_switch('fixed_ip', 0); $fixed_ip = (int) get_parameter_switch('fixed_ip', 0);
$vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2); $vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2);
$security_vunerability = (int) get_parameter_switch('security_vunerability', 0);
$security_hardening = (int) get_parameter_switch('security_hardening', 0);
$security_monitoring = (int) get_parameter_switch('security_monitoring', 0);
$enable_log_collector = (int) get_parameter_switch('enable_log_collector', 0);
$enable_inventory = (int) get_parameter_switch('enable_inventory', 0);
$enable_basic_options = get_parameter('enable_basic_options');
$options_package = get_parameter('options_package', '0');
if ($fields === false) { if ($fields === false) {
$fields = []; $fields = [];
@ -1243,6 +1251,81 @@ if ($update_agent) {
); );
} }
} }
if ($enable_basic_options === '1') {
// Get all plugins (BASIC OPTIONS).
$agent = new PandoraFMS\Agent($id_agente);
$plugins = $agent->getPlugins();
foreach ($plugins as $key => $row) {
// Only check plugins when agent package is bigger than 774.
if ($options_package === '1') {
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
if ($security_hardening === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disablePlugins($row['raw']);
}
}
}
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disablePlugins($row['raw']);
}
}
}
}
// Inventory switch enable when basic options are enabled.
if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) {
if ($enable_inventory === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disablePlugins($row['raw']);
}
}
}
// Inventory switch enable when basic options are enabled.
if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) {
if ($enable_inventory === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disablePlugins($row['raw']);
}
}
}
}
$modules = $agent->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) {
$agent->enableModule($row['module_name'], $row);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disableModule($row['module_name'], $row);
}
}
}
}
}
} }
// Read agent data // Read agent data
@ -1300,6 +1383,19 @@ if ($id_agente) {
$satellite_server = (int) $agent['satellite_server']; $satellite_server = (int) $agent['satellite_server'];
$fixed_ip = (int) $agent['fixed_ip']; $fixed_ip = (int) $agent['fixed_ip'];
$vul_scan_enabled = (int) $agent['vul_scan_enabled']; $vul_scan_enabled = (int) $agent['vul_scan_enabled'];
if (strpos($agent['agent_version'], '(')) {
$agent_version = (int) explode('.', explode('(', $agent['agent_version'])[0])[2];
} else {
if (strpos($agent['agent_version'], 'build') || strpos($agent['agent_version'], 'Build')) {
$agent_version = (int) explode('.', explode('build', $agent['agent_version'])[0])[2];
} else {
if (strpos($agent['agent_version'], '.')) {
$agent_version = (int) explode('.', $agent['agent_version'])[2];
} else {
$agent_version = $agent['agent_version'];
}
}
}
} }
$update_module = (bool) get_parameter('update_module'); $update_module = (bool) get_parameter('update_module');

View File

@ -171,7 +171,7 @@ foreach ($password_fields as $k => $p) {
} }
$(document).ready(function () { $(document).ready(function () {
if ($("#id_plugin").val() === 0) { if ($("#id_plugin").val() !== 0) {
changePluginSelect(); changePluginSelect();
} }
}); });

View File

@ -256,7 +256,7 @@ $schedule = io_safe_output(
$data[0] = ''; $data[0] = '';
$data[0] .= html_print_input_hidden('schedule', $schedule, true); $data[0] .= html_print_input_hidden('schedule', $schedule, true);
$data[0] .= '<div id="calendar_map"></div>'; $data[0] .= '<div id="calendar_map" class="alert_view_calendar"></div>';
$data[1] = ''; $data[1] = '';
$table_conditions->data[] = $data; $table_conditions->data[] = $data;

View File

@ -243,10 +243,15 @@ switch ($action) {
$map_default_altitude = get_parameter('map_default_altitude'); $map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id'); $map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom', 16); $map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list')); $map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$map_connection_list_temp_string = implode(',', $map_connection_list_temp);
if (strlen($map_connection_list_temp_string) > 0) {
$where_map_connection = ' WHERE id_tmap_connection IN('.$map_connection_list_temp_string.')';
} else {
$where_map_connection = '';
}
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'); $listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'.$where_map_connection);
foreach ($map_connection_list_temp as $index => $value) { foreach ($map_connection_list_temp as $index => $value) {
$cleanValue = trim($value); $cleanValue = trim($value);
@ -256,7 +261,6 @@ switch ($action) {
} }
$map_connection_default = get_parameter('map_connection_default'); $map_connection_default = get_parameter('map_connection_default');
$map_connection_list = []; $map_connection_list = [];
foreach ($listConnectionTemp as $idMapConnection) { foreach ($listConnectionTemp as $idMapConnection) {
$default = 0; $default = 0;
@ -345,7 +349,7 @@ function deleteConnectionMap(idConnectionMap) {
checked = $("#radiobtn0001", $("#map_connection_" + idConnectionMap)).attr('checked'); checked = $("#radiobtn0001", $("#map_connection_" + idConnectionMap)).attr('checked');
$("#map_connection_" + idConnectionMap).remove(); $("#map_connection_" + idConnectionMap).remove();
if (checked) { if (checked) {
//Checked first, but not is index = 0 maybe. //Checked first, but not is index = 0 maybe.
@ -485,7 +489,7 @@ foreach ($listConnectionTemp as $connectionTemp) {
$table->data[1][0] = __('Add Map connection').$iconError; $table->data[1][0] = __('Add Map connection').$iconError;
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'> $table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
<tr> <tr>
<td>".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)." <td>".html_print_select($listConnection, 'select-map_connection_list', '', '', '', '0', true)."
</td> </td>
<td > <td >
<a href='javascript: addConnectionMap();'>".html_print_image( <a href='javascript: addConnectionMap();'>".html_print_image(

View File

@ -163,7 +163,10 @@ switch ($activeTab) {
$background_color = (string) get_parameter('background_color'); $background_color = (string) get_parameter('background_color');
$width = (int) get_parameter('width'); $width = (int) get_parameter('width');
$height = (int) get_parameter('height'); $height = (int) get_parameter('height');
$visualConsoleName = (string) io_safe_input(get_parameter('name')); $visualConsoleName = (string) get_parameter('name');
$visualConsoleName = str_replace('&lt;', '', $visualConsoleName);
$visualConsoleName = str_replace('&gt;', '', $visualConsoleName);
$visualConsoleName = (string) io_safe_input($visualConsoleName);
$is_favourite = (int) get_parameter('is_favourite_sent'); $is_favourite = (int) get_parameter('is_favourite_sent');
$auto_adjust = (int) get_parameter('auto_adjust_sent'); $auto_adjust = (int) get_parameter('auto_adjust_sent');

View File

@ -405,19 +405,6 @@ $table->data[$i++][] = html_print_label_input_block(
$table->data[$i][] = html_print_label_input_block( $table->data[$i][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(
'activate_sflow',
1,
$config['activate_sflow'],
$rbt_disabled,
'',
'',
true
),
);
$table->data[$i++][] = html_print_label_input_block(
__('General network path'), __('General network path'),
html_print_input_text( html_print_input_text(
'general_network_path', 'general_network_path',

View File

@ -83,6 +83,19 @@ $table->data[3][] = html_print_label_input_block(
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true) html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
); );
$table->data[4][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(
'activate_sflow',
1,
$config['activate_sflow'],
$rbt_disabled,
'',
'',
true
),
);
echo '<form class="max_floating_element_size" id="netflow_setup" method="post">'; echo '<form class="max_floating_element_size" id="netflow_setup" method="post">';
html_print_table($table); html_print_table($table);
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);

View File

@ -61,7 +61,7 @@ $license = db_get_value(
); );
if (isset($config['lts_updates']) === false) { if (isset($config['lts_updates']) === false) {
$config['lts_updates'] = false; $config['lts_updates'] = true;
} }
if (empty($license) === true) { if (empty($license) === true) {

View File

@ -0,0 +1,111 @@
<?php
/**
* Modal LTS versions update manager.
*
* @category Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
check_login();
// The ajax is in include/ajax/update_manager.php.
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/vendor/autoload.php';
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if ($php_version_array[0] < 7) {
include_once 'general/php_message.php';
}
?>
<!-- Lts Updates. -->
<div id="lts-updates" title="
<?php echo __('LTS versions'); ?>
" class="invisible">
<div style="display: flex; justify-content: space-between">
<div style="width: 250px; padding: 36px">
<?php
echo html_print_image(
'images/info-warning.svg',
true,
[ 'style' => 'padding-top: 30px' ]
);
?>
</div>
<div style="padding: 5px 90px 5px 5px;">
<p class="lato font_10pt bolder">
<?php
echo __('There are two types of versions in Pandora FMS: the LTS versions (Long-Term Support), e.g: 772 LTS, and the RRR (Regular Rolling Release) versions, e.g: 771, 773, 774, 775.');
?>
</p>
<p class="lato font_10pt bolder">
<?php
echo __('LTS versions have frequent, periodic updates (fixes), correcting both security problems and critical bugs detected in the tool. These are the versions we recommend to use in production environments.');
?>
</p>
<p class="lato font_10pt bolder">
<?php
echo __('RRR versions incorporate new features in each version, as well as bug fixes, but due to their dynamic nature, errors are more likely.');
?>
</p>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
// Lts Updates.
$("#lts-updates").dialog({
resizable: true,
draggable: true,
modal: true,
width: 740,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: true,
buttons: [{
text: "OK",
click: function() {
$(this).dialog("close");
}
}],
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
}
});
});
</script>

View File

@ -119,11 +119,13 @@ switch ($tab) {
case 'setup': case 'setup':
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php'; include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
case 'offline': case 'offline':
$mode = \UpdateManager\UI\Manager::MODE_OFFLINE; $mode = \UpdateManager\UI\Manager::MODE_OFFLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
case 'online': case 'online':
@ -163,5 +165,6 @@ switch ($tab) {
$mode = \UpdateManager\UI\Manager::MODE_ONLINE; $mode = \UpdateManager\UI\Manager::MODE_ONLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
include $config['homedir'].'/godmode/update_manager/modal_lts_update.php';
break; break;
} }

View File

@ -63,6 +63,10 @@ if (users_is_admin()) {
} }
} }
if (isset($config['lts_updates']) === false) {
config_update_value('lts_updates', 1);
}
if (!$action_update_url_update_manager) { if (!$action_update_url_update_manager) {
$url_update_manager = get_parameter( $url_update_manager = get_parameter(
'url_update_manager', 'url_update_manager',

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/20/desacoplar-ventana</title>
<g id="Icons/Dark/20/desacoplar-ventana" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Back" transform="translate(3, 1)">
<rect id="Rectangle-2" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x="0" y="0" width="20" height="16" rx="1"></rect>
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
<g id="Front" transform="translate(0, 8)">
<rect id="Rectangle-2" fill="#3F3F3F" x="0" y="0" width="20" height="16" rx="1"></rect>
<path d="M3,4 C3.55228475,4 4,3.55228475 4,3 C4,2.44771525 3.55228475,2 3,2 C2.44771525,2 2,2.44771525 2,3 C2,3.55228475 2.44771525,4 3,4 Z M6,4 C6.55228475,4 7,3.55228475 7,3 C7,2.44771525 6.55228475,2 6,2 C5.44771525,2 5,2.44771525 5,3 C5,3.55228475 5.44771525,4 6,4 Z M9,4 C9.55228475,4 10,3.55228475 10,3 C10,2.44771525 9.55228475,2 9,2 C8.44771525,2 8,2.44771525 8,3 C8,3.55228475 8.44771525,4 9,4 Z" id="Oval-2" fill="#FFFFFF"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/20/minimizar</title>
<g id="Icons/Dark/20/minimizar" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" fill="#3F3F3F" x="2" y="18" width="20" height="4" rx="2"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 436 B

View File

@ -435,6 +435,7 @@ if ($get_agent_alerts_datatable === true) {
} }
$idGroup = $filter_alert['ag_group']; $idGroup = $filter_alert['ag_group'];
$search_sg = $filter_alert['search_sg'];
$tag_filter = $filter_alert['tag']; $tag_filter = $filter_alert['tag'];
$action_filter = $filter_alert['action']; $action_filter = $filter_alert['action'];
@ -658,10 +659,9 @@ if ($get_agent_alerts_datatable === true) {
$id_groups = array_keys( $id_groups = array_keys(
users_get_groups($config['id_user'], 'AR', false) users_get_groups($config['id_user'], 'AR', false)
); );
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter); $countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
} }
} else { } else {
if ($idAgent !== 0) { if ($idAgent !== 0) {
@ -673,9 +673,9 @@ if ($get_agent_alerts_datatable === true) {
users_get_groups($config['id_user'], $access, false) users_get_groups($config['id_user'], $access, false)
); );
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false); $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false, $search_sg);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false); $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
} }
} }

View File

@ -314,6 +314,7 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search'); $values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
@ -382,6 +383,7 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search'); $values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
@ -641,6 +643,8 @@ function load_form_filter() {
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$('#text-search').val(val); $('#text-search').val(val);
if (i == 'regex')
$('#text-regex').val(val);
if (i == 'not_search') if (i == 'not_search')
$('#checkbox-not_search').val(val); $('#checkbox-not_search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
@ -971,6 +975,7 @@ function save_new_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(), "not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
@ -1051,6 +1056,7 @@ function save_update_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(), "not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
@ -2645,6 +2651,8 @@ if ($get_events_fired) {
$filter['date_to'] = date('Y-m-d', $end); $filter['date_to'] = date('Y-m-d', $end);
$filter['time_from'] = date('H:i:s', $start); $filter['time_from'] = date('H:i:s', $start);
$filter['time_to'] = date('H:i:s', $end); $filter['time_to'] = date('H:i:s', $end);
$filter['severity'] = explode(',', $filter['severity']);
$data = events_get_all( $data = events_get_all(
['te.*'], ['te.*'],
$filter $filter

View File

@ -1,324 +0,0 @@
<?php
/**
* Generate charts with given parameters.
*
* @category ChartGenerator.
* @package Pandora FMS
* @subpackage Opensource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once __DIR__.'/config.php';
require_once __DIR__.'/functions.php';
require_once __DIR__.'/functions_db.php';
require_once __DIR__.'/auth/mysql.php';
require_once $config['homedir'].'/include/lib/User.php';
require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_custom_graphs.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php';
$data_raw = get_parameter('data');
$data_decoded = json_decode(io_safe_output($data_raw), true);
if (json_last_error() === JSON_ERROR_NONE) {
$data = $data_decoded['data'];
$session_id = $data_decoded['session_id'];
$type_graph_pdf = $data_decoded['type_graph_pdf'];
$id_user = $data_decoded['id_user'];
$slicebar = $data_decoded['slicebar'];
$slicebar_value = $data_decoded['slicebar_value'];
$data_combined = [];
if (isset($data_decoded['data_combined']) === true) {
$data_combined = $data_decoded['data_combined'];
}
$data_module_list = [];
if (isset($data_decoded['data_module_list']) === true) {
$data_module_list = $data_decoded['data_module_list'];
}
}
// Initialize session.
global $config;
// Care whit this!!! check_login not working if you remove this.
$config['id_user'] = $id_user;
$_SESSION['id_usuario'] = $id_user;
// Checks for server api req.
$bypassLogin = false;
if ($data_decoded['apipass'] !== null
&& ($config['server_unique_identifier'] === $_SESSION['id_usuario'])
) {
$apiPassword = io_output_password(
db_get_value_filter(
'value',
'tconfig',
['token' => 'api_password']
)
);
if ($apiPassword === $data_decoded['apipass']) {
$bypassLogin = true;
}
}
if (!isset($config[$slicebar])) {
$config[$slicebar] = $slicebar_value;
}
// Try to initialize session using existing php session id.
$user = new PandoraFMS\User(['phpsessionid' => $session_id]);
if (check_login(false) === false && $bypassLogin !== true) {
// Error handler.
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Access denied</title>
<link rel="stylesheet" href="styles/pandora.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui.min.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js?v=<?php echo $config['current_package']; ?>'></script>
</head>
<body>
<h1>Access is not granted</h1>
<div id="container-chart-generator-item" style="display:none; margin:0px;width:100px;height:100px;">
</body>
</html>
<?php
exit;
}
// Access granted.
$params = $data;
if (isset($params['backgroundColor']) === false) {
$params['backgroundColor'] = 'inherit';
}
// Metaconsole connection to the node.
$server_id = 0;
if (isset($params['server_id']) === true) {
$server_id = $params['server_id'];
}
if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting.
if (metaconsole_connect($server) !== NOERR) {
?>
<html>
<body>
<?php
ui_print_error_message(
__('There was a problem connecting with the node')
);
?>
</body>
</html>
<?php
exit;
}
}
$user_language = get_user_language($config['id_user']);
if (file_exists('languages/'.$user_language.'.mo') === true) {
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
$l10n = new gettext_reader($cfr);
$l10n->load_tables();
}
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
?>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph</title>
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/pandora_minimal.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui.min.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url($hack_metaconsole.'include/styles/js/jquery-ui_custom.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora_ui.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.current.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/jquery-ui.min.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url($hack_metaconsole.'include/javascript/pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.time.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.pie.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.crosshair.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.stack.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.selection.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.resize.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.threshold.multiple.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script type="text/javascript">
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
</script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
</head>
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
<?php
$params['only_image'] = false;
$params['menu'] = false;
$params['disable_black'] = true;
$params_combined = $data_combined;
$module_list = $data_module_list;
$viewport = [
'width' => 0,
'height' => 0,
];
$style = 'width:100%;';
if (isset($params['options']['viewport']) === true) {
$viewport = $params['options']['viewport'];
if (empty($viewport['width']) === false) {
$style .= 'width:'.$viewport['width'].'px;';
}
if (empty($viewport['height']) === false) {
$style .= 'height:'.$viewport['height'].'px;';
}
}
echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
switch ($type_graph_pdf) {
case 'combined':
$params['pdf'] = true;
$result = graphic_combined_module(
$module_list,
$params,
$params_combined
);
echo $result;
break;
case 'sparse':
$params['pdf'] = true;
echo grafico_modulo_sparse($params);
break;
case 'pie_graph':
$params['pdf'] = true;
$chart = get_build_setup_charts(
'PIE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'vbar_graph':
$params['pdf'] = true;
$chart = get_build_setup_charts(
'BAR',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'ring_graph':
$params['pdf'] = true;
$params['options']['width'] = 500;
$params['options']['height'] = 500;
$chart = get_build_setup_charts(
'DOUGHNUT',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);
delete_config_token($params['tokem_config']);
echo flot_slicesbar_graph(
$params['graph_data'],
$params['period'],
$params['width'],
$params['height'],
$params['legend'],
$params['colors'],
$params['fontpath'],
$params['round_corner'],
$params['homeurl'],
$params['watermark'],
$params['adapt_key'],
$params['stat_winalse'],
$params['id_agent'],
$params['full_legend_daterray'],
$params['not_interactive'],
$params['ttl'],
$params['sizeForTicks'],
$params['show'],
$params['date_to'],
$params['server_id']
);
break;
default:
// Code...
break;
}
echo '</div>';
?>
</body>
</html>

View File

@ -2383,7 +2383,7 @@ class ConsoleSupervisor
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
'title' => __('This instance is not registered in the Update manager section'), 'title' => __('This instance is not registered in the Warp Update section'),
'message' => __('Click here to start the registration process'), 'message' => __('Click here to start the registration process'),
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
] ]
@ -2404,13 +2404,17 @@ class ConsoleSupervisor
{ {
global $config; global $config;
include_once $config['homedir'].'/include/functions_update_manager.php'; include_once $config['homedir'].'/include/functions_update_manager.php';
$server_name = db_get_value_filter(
'name',
'tserver',
[ 'server_type' => '1' ]
);
if (update_manager_verify_api() === false) { if (update_manager_verify_api() === false) {
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.API.ACCESS', 'type' => 'NOTIF.API.ACCESS',
'title' => __('Cannot access the Pandora FMS API '), 'title' => __('Cannot access the Pandora FMS API '),
'message' => __('Please check the configuration, some components may fail due to this misconfiguration.'), 'message' => __('Please check the configuration, some components may fail due to this misconfiguration in '.$server_name.' ('.$config['public_url'].')'),
] ]
); );
} else { } else {

View File

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

View File

@ -4374,48 +4374,22 @@ function generator_chart_to_pdf(
$module_list=false $module_list=false
) { ) {
global $config; global $config;
$hack_metaconsole = '';
if (is_metaconsole()) { if (is_metaconsole() === true) {
$hack_metaconsole = '../..'; $hack_metaconsole = '../..';
} else {
$hack_metaconsole = '';
} }
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
if (!$params['return_img_base_64']) { if (!$params['return_img_base_64']) {
$img_file = 'img_'.uniqid().'.png'; $img_file = 'img_'.uniqid().'.png';
$img_path = $config['homedir'].'/attachment/'.$img_file; $img_path = $config['homedir'].'/attachment/'.$img_file;
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; $img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
} }
$session_id = session_id(); if ($type_graph_pdf !== 'combined') {
if ($type_graph_pdf === 'combined') { $params_combined = [];
$data = [ $module_list = [];
'data' => $params,
'session_id' => $session_id,
'type_graph_pdf' => $type_graph_pdf,
'data_module_list' => $module_list,
'data_combined' => $params_combined,
'id_user' => $config['id_user'],
'slicebar' => $_SESSION['slicebar'],
'slicebar_value' => $config[$_SESSION['slicebar']],
'apipass' => get_parameter('apipass', null),
];
} else {
$data = [
'data' => $params,
'session_id' => $session_id,
'type_graph_pdf' => $type_graph_pdf,
'id_user' => $config['id_user'],
'slicebar' => $_SESSION['slicebar'],
'slicebar_value' => $config[$_SESSION['slicebar']],
'apipass' => get_parameter('apipass', null),
];
} }
unset($data['data']['graph_data']);
// If not install chromium avoid 500 convert tu images no data to show. // If not install chromium avoid 500 convert tu images no data to show.
$chromium_dir = io_safe_output($config['chromium_path']); $chromium_dir = io_safe_output($config['chromium_path']);
$result_ejecution = exec($chromium_dir.' --version'); $result_ejecution = exec($chromium_dir.' --version');
@ -4435,22 +4409,16 @@ function generator_chart_to_pdf(
// Creates a new page. // Creates a new page.
$page = $browser->createPage(); $page = $browser->createPage();
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url); // Generate Html.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $html = chart_generator(
curl_setopt($curl, CURLOPT_POSTFIELDS, ['data' => json_encode($data)]); $type_graph_pdf,
$params,
$params_combined,
$module_list
);
$response = curl_exec($curl); $page->setHtml($html);
curl_close($curl);
$page->setHtml($response);
/*
//For debug url with parameters.
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
*/
// Dynamic. // Dynamic.
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue(); $dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();
@ -4497,6 +4465,211 @@ function generator_chart_to_pdf(
} }
/**
* Html print chart for chromium
*
* @param string $type_graph_pdf Chart mode.
* @param array $params Params.
* @param array $params_combined Params Combined charts.
* @param array $module_list Module list Combined charts.
*
* @return string Output Html.
*/
function chart_generator(
string $type_graph_pdf,
array $params,
array $params_combined=[],
array $module_list=[]
) : string {
global $config;
include_once $config['homedir'].'/include/graphs/functions_d3.php';
if (isset($params['backgroundColor']) === false) {
$params['backgroundColor'] = 'inherit';
}
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
$output = '<!DOCTYPE>';
$output .= '<html>';
$output .= '<head>';
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
$output .= '<title>Pandora FMS Graph</title>';
$output .= '<script type="text/javascript">';
$output .= 'var phpTimezone = "'.date_default_timezone_get().'";';
$output .= 'var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";';
$output .= '</script>';
$css_files = [
'pandora' => 'include/styles/',
'pandora_minimal' => 'include/styles/',
'jquery-ui.min' => 'include/styles/js/',
'jquery-ui_custom' => 'include/styles/js/',
];
foreach ($css_files as $name => $path) {
$output .= ui_require_css_file($name, $path, true, true);
}
$js_files = [
'pandora_ui' => 'include/javascript/',
'jquery.current' => 'include/javascript/',
'jquery.pandora' => 'include/javascript/',
'jquery-ui.min' => 'include/javascript/',
'date' => 'include/javascript/timezone/src/',
'pandora' => 'include/javascript/',
'jquery.flot' => 'include/graphs/flot/',
'jquery.flot.min' => 'include/graphs/flot/',
'jquery.flot.time' => 'include/graphs/flot/',
'jquery.flot.pie' => 'include/graphs/flot/',
'jquery.flot.crosshair.min' => 'include/graphs/flot/',
'jquery.flot.stack.min' => 'include/graphs/flot/',
'jquery.flot.selection.min' => 'include/graphs/flot/',
'jquery.flot.resize.min' => 'include/graphs/flot/',
'jquery.flot.threshold' => 'include/graphs/flot/',
'jquery.flot.threshold.multiple' => 'include/graphs/flot/',
'jquery.flot.symbol.min' => 'include/graphs/flot/',
'jquery.flot.exportdata.pandora' => 'include/graphs/flot/',
'jquery.flot.axislabels' => 'include/graphs/flot/',
'pandora.flot' => 'include/graphs/flot/',
'chart' => 'include/graphs/chartjs/',
'chartjs-plugin-datalabels.min' => 'include/graphs/chartjs/',
];
foreach ($js_files as $name => $path) {
$output .= ui_require_javascript_file($name, $path, true, true);
}
$output .= include_javascript_d3(true, true);
$output .= '</head>';
$output .= '<body style="width:794px; margin: 0px; background-color:'.$params['backgroundColor'].';">';
$params['only_image'] = false;
$params['menu'] = false;
$params['disable_black'] = true;
$viewport = [
'width' => 0,
'height' => 0,
];
$style = 'width:100%;';
if (isset($params['options']['viewport']) === true) {
$viewport = $params['options']['viewport'];
if (empty($viewport['width']) === false) {
$style .= 'width:'.$viewport['width'].'px;';
}
if (empty($viewport['height']) === false) {
$style .= 'height:'.$viewport['height'].'px;';
}
}
$output .= '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
switch ($type_graph_pdf) {
case 'combined':
$params['pdf'] = true;
$result = graphic_combined_module(
$module_list,
$params,
$params_combined
);
$output .= $result;
break;
case 'sparse':
$params['pdf'] = true;
$output .= grafico_modulo_sparse($params);
break;
case 'pie_graph':
$params['pdf'] = true;
$chart = get_build_setup_charts(
'PIE',
$params['options'],
$params['chart_data']
);
$output .= $chart->render(true);
break;
case 'vbar_graph':
$params['pdf'] = true;
$chart = get_build_setup_charts(
'BAR',
$params['options'],
$params['chart_data']
);
$output .= $chart->render(true);
break;
case 'ring_graph':
$params['pdf'] = true;
$params['options']['width'] = 500;
$params['options']['height'] = 500;
$chart = get_build_setup_charts(
'DOUGHNUT',
$params['options'],
$params['chart_data']
);
$output .= $chart->render(true);
break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
$output .= $chart->render(true);
break;
case 'slicebar':
$output .= flot_slicesbar_graph(
$params['graph_data'],
$params['period'],
$params['width'],
$params['height'],
$params['legend'],
$params['colors'],
$params['fontpath'],
$params['round_corner'],
$params['homeurl'],
$params['watermark'],
$params['adapt_key'],
$params['stat_winalse'],
$params['id_agent'],
$params['full_legend_daterray'],
$params['not_interactive'],
$params['ttl'],
$params['sizeForTicks'],
$params['show'],
$params['date_to'],
$params['server_id']
);
break;
default:
// Code...
break;
}
$output .= '</div>';
$output .= '</body>';
$output .= '</html>';
return $output;
}
/** /**
* Get the product name. * Get the product name.
* *

View File

@ -2169,13 +2169,16 @@ function get_group_alerts(
$strict_user=false, $strict_user=false,
$tag=false, $tag=false,
$action_filter=false, $action_filter=false,
$alert_action=true $alert_action=true,
$search_sg=false
) { ) {
global $config; global $config;
$group_query = ''; $group_query = '';
if (!empty($idGroup)) { if (!empty($idGroup)) {
$group_query = ' AND id_grupo = '.$idGroup; $group_query = ' AND id_grupo = '.$idGroup;
if ((bool) $search_sg === true) {
$group_query .= ' OR tasg.id_group = '.$idGroup;
}
} }
if (is_array($filter)) { if (is_array($filter)) {

View File

@ -82,7 +82,7 @@ function parseOtherParameter($other, $otherType, $rawDecode)
case 'url_encode': case 'url_encode':
$returnVar = [ $returnVar = [
'type' => 'string', 'type' => 'string',
'data' => urldecode($other), 'data' => $rawDecode ? rawurldecode($other) : urldecode($other),
]; ];
break; break;

View File

@ -249,10 +249,6 @@ function config_update_config()
$error_update[] = __('Enable Netflow'); $error_update[] = __('Enable Netflow');
} }
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) { if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) {
$error_update[] = __('Enable Feedback'); $error_update[] = __('Enable Feedback');
} }
@ -1623,6 +1619,10 @@ function config_update_config()
if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) { if (config_update_value('netflow_get_ip_hostname', (int) get_parameter('netflow_get_ip_hostname'), true) === false) {
$error_update[] = __('Name resolution for IP address'); $error_update[] = __('Name resolution for IP address');
} }
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
break; break;
case 'sflow': case 'sflow':

View File

@ -127,6 +127,58 @@ function events_translate_event_type($event_type)
} }
/**
* Module status event_type into descriptive text.
*
* @param integer $event_type Event type.
*
* @return string Module status.
*/
function events_status_module_event_type($event_type)
{
$module_status = '';
switch ($event_type) {
case 'alert_fired':
case 'alert_recovered':
case 'alert_ceased':
case 'alert_manual_validation':
$module_status = AGENT_MODULE_STATUS_CRITICAL_ALERT;
break;
case 'going_down_normal':
case 'going_up_normal':
$module_status = AGENT_MODULE_STATUS_NORMAL;
break;
case 'going_unknown':
case 'unknown':
$module_status = AGENT_MODULE_STATUS_UNKNOWN;
break;
case 'going_up_warning':
case 'going_down_warning':
$module_status = AGENT_MODULE_STATUS_WARNING;
break;
case 'going_up_critical':
case 'going_down_critical':
$module_status = AGENT_MODULE_STATUS_CRITICAL_BAD;
break;
case 'recon_host_detected':
case 'system':
case 'error':
case 'new_agent':
case 'configuration_change':
default:
$module_status = AGENT_MODULE_STATUS_NOT_INIT;
break;
}
return $module_status;
}
/** /**
* Translates a numeric value event_status into descriptive text. * Translates a numeric value event_status into descriptive text.
* *
@ -2617,7 +2669,6 @@ function events_print_type_img(
$urlImage = ui_get_full_url(false); $urlImage = ui_get_full_url(false);
$icon = ''; $icon = '';
$style = 'main_menu_icon'; $style = 'main_menu_icon';
switch ($type) { switch ($type) {
case 'alert_recovered': case 'alert_recovered':
$icon = 'images/alert_recovered@svg.svg'; $icon = 'images/alert_recovered@svg.svg';
@ -2683,16 +2734,6 @@ function events_print_type_img(
if ($only_url) { if ($only_url) {
$output = $urlImage.'/'.$icon; $output = $urlImage.'/'.$icon;
} else { } else {
/*
$output .= html_print_div(
[
'title' => events_print_type_description($type, true),
'class' => $style,
'style' => ((empty($icon) === false) ? 'background-image: url('.$icon.'); background-repeat: no-repeat;' : ''),
],
true
);
*/
$output .= html_print_image( $output .= html_print_image(
$icon, $icon,
true, true,

View File

@ -1585,7 +1585,7 @@ function gis_add_conection_maps_in_form($map_connection_list)
<tr class="row_0"> <tr class="row_0">
<td>'.html_print_input_text('map_connection_name_'.$mapConnection['id_conection'], $mapConnectionRowDB['conection_name'], '', 20, 40, true, true).'</td> <td>'.html_print_input_text('map_connection_name_'.$mapConnection['id_conection'], $mapConnectionRowDB['conection_name'], '', 20, 40, true, true).'</td>
<td>'.$radioButton.'</td> <td>'.$radioButton.'</td>
<td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter']).'</a></td> <td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter main_menu_icon']).'</a></td>
</tr> </tr>
</tbody> </tbody>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1003,7 +1003,7 @@ if (is_ajax()) {
$dialogButtons = []; $dialogButtons = [];
$dialogButtons[] = html_print_button( $dialogButtons[] = html_print_button(
__('Update manager'), __('Warp update'),
'update_manager', 'update_manager',
false, false,
'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"', 'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"',

View File

@ -251,6 +251,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
unset($new_module['id_agente_modulo']); unset($new_module['id_agente_modulo']);
unset($new_module['id_agente']); unset($new_module['id_agente']);
// Set debug content.
if (empty($new_module['debug_content']) === false) {
$new_module['debug_content'] = str_replace("'", '"', $new_module['debug_content']);
}
$id_new_module = modules_create_agent_module( $id_new_module = modules_create_agent_module(
$id_destiny_agent, $id_destiny_agent,
$new_module['nombre'], $new_module['nombre'],

View File

@ -1066,7 +1066,7 @@ function notification_filter()
break; break;
case 'UPDATEMANAGER': case 'UPDATEMANAGER':
$type_name = 'UPDATE MANAGER'; $type_name = 'WARP UPDATE';
break; break;
case 'ALLOWOVERRIDE': case 'ALLOWOVERRIDE':

View File

@ -15994,171 +15994,174 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
return false; return false;
} }
$module_interval = modules_get_interval( if ($metaconsole_on && $server_name != '') {
$content['id_agent_module'] // Restore db connection.
); metaconsole_restore_db();
$slice = ($content['period'] / $module_interval); }
$result_sla = reporting_advanced_sla( $filter = [
$content['id_agent_module'], 'id_agentmodule' => $content['id_agent_module'],
($report['datetime'] - $content['period']), 'group_rep' => EVENT_GROUP_REP_ALL,
$report['datetime'], 'date_to' => date('Y-m-d', ($report['datetime'] - $content['period'])),
null, 'time_to' => date('H:i:s', ($report['datetime'] - $content['period'])),
null, ];
if ($metaconsole_on && $server_name != '') {
$filter['id_server'] = $connection['id'];
}
$previous_event = events_get_all(
['te.event_type, te.timestamp, te.utimestamp'],
$filter,
0, 0,
null,
null,
null,
$slice,
1, 1,
'desc',
'timestamp',
true true
); );
// Select Warning and critical values. $status = '';
$agentmodule_info = modules_get_agentmodule($content['id_agent_module']); if ($previous_event !== false) {
$min_value_critical = ($agentmodule_info['min_critical'] == 0) ? null : $agentmodule_info['min_critical']; $previous_event = end($previous_event);
$status = $previous_event['event_type'];
}
// Check if module type is string. $date_start = ($report['datetime'] - $content['period']);
$modules_is_string = modules_is_string($agentmodule_info['id_agente_modulo']); $filter = [
'id_agentmodule' => $content['id_agent_module'],
'group_rep' => EVENT_GROUP_REP_ALL,
'date_from' => date('Y-m-d', $date_start),
'date_to' => date('Y-m-d', $report['datetime']),
'time_from' => date('H:i:s', $date_start),
'time_to' => date('H:i:s', $report['datetime']),
];
if ($modules_is_string === false) { if ($metaconsole_on && $server_name != '') {
if ($agentmodule_info['max_critical'] == 0) { $filter['id_server'] = $connection['id'];
$max_value_critical = null; }
if ($agentmodule_info['min_critical'] == 0) {
if ((bool) $content['dinamic_proc'] === true) { $events = events_get_all(
$max_value_critical = 0.01; ['te.event_type, te.timestamp, te.utimestamp'],
} $filter,
null,
null,
null,
null,
true
);
// Metaconsole connection.
if ($metaconsole_on && $server_name != '') {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
ui_print_error_message('Error connecting to '.$server_name);
}
}
$not_init_data = [];
$previous_data = [
'event_type' => $status,
'utimestamp' => $date_start,
];
if (empty($status) === true) {
// Si viene de no iniciado busco el primer dato del modulo y si es de histórico.
$first_utimestamp = false;
$search_historydb = false;
$extract_first_data = modules_get_first_date($content['id_agent_module'], 0);
if (empty($extract_first_data) === false) {
$first_utimestamp = $extract_first_data['first_utimestamp'];
$search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false;
}
// Si se encuentra algun dato.
// Si no hay eventos, la fecha del primer dato no sea mayor al fin del report (seria un bloque completo de no iniciado).
// Se comprueba que si existen eventos el dato no sea previo al evento.
if ($first_utimestamp !== false
&& ((empty($events) === true && $first_utimestamp < $report['datetime']) || (empty($events) === false && $first_utimestamp < $events[0]['utimestamp']))
) {
// Tenemos en cuenta si el modulo es de tipo string.
$module = modules_get_agentmodule($content['id_agent_module']);
$module_type = $module['id_tipo_modulo'];
$module_type_str = modules_get_type_name($module_type);
$table = 'tagente_datos';
if (strstr($module_type_str, 'string') !== false) {
$table = 'tagente_datos_string';
}
$query = sprintf(
'SELECT datos,utimestamp
FROM %s
WHERE id_agente_modulo = %d
AND utimestamp = %d
',
$table,
$content['id_agent_module'],
$first_utimestamp
);
$data = db_get_all_rows_sql($query, $search_historydb);
if ($data !== false) {
$not_init_data = [
'event_type' => $status,
'utimestamp' => $date_start,
];
$previous_data = [
'event_type' => 'going_up_normal',
'utimestamp' => $data[0]['utimestamp'],
];
} }
} else {
$max_value_critical = $agentmodule_info['max_critical'];
}
} else {
if ($agentmodule_info['str_critical'] == '') {
$max_value_critical = null;
} else {
$max_value_critical = $agentmodule_info['str_critical'];
} }
} }
$inverse_critical = $agentmodule_info['critical_inverse']; $array_result = [];
$time_total = $content['period'];
$min_value_warning = ($agentmodule_info['min_warning'] == 0) ? null : $agentmodule_info['min_warning']; $check_total = 0;
$check_ok = 0;
if ($modules_is_string === false) { $time_ok = 0;
if ($agentmodule_info['max_warning'] == 0) { if (empty($events) === true) {
$max_value_warning = null; $events = [];
} else {
$max_value_warning = $agentmodule_info['max_warning'];
}
} else {
if ($agentmodule_info['str_warning'] == '') {
$max_value_warning = null;
} else {
$max_value_warning = $agentmodule_info['str_warning'];
}
} }
$inverse_warning = $agentmodule_info['warning_inverse']; // Añadimos el dato previo.
array_unshift($events, $previous_data);
if (empty($not_init_data) === false) {
// Añadimos si viene de no iniciado el no iniciado.
array_unshift($events, $not_init_data);
}
$data = []; $current_time = time();
$data['time_total'] = 0;
$data['time_ok'] = 0;
$data['time_error'] = 0;
$data['time_warning'] = 0;
$data['time_unknown'] = 0;
$data['time_not_init'] = 0;
$data['time_downtime'] = 0;
$data['checks_total'] = 0;
$data['checks_ok'] = 0;
$data['checks_error'] = 0;
$data['checks_warning'] = 0;
$data['checks_unknown'] = 0;
$data['checks_not_init'] = 0;
$array_graph = [];
$i = 0; $i = 0;
foreach ($result_sla as $value_sla) { foreach ($events as $event) {
$data['time_total'] += $value_sla['time_total']; $array_result[$i]['data'] = events_status_module_event_type($event['event_type']);
$data['time_ok'] += $value_sla['time_ok']; if (isset($events[($i + 1)]) === true) {
$data['time_error'] += $value_sla['time_error']; $period = ($events[($i + 1)]['utimestamp'] - $event['utimestamp']);
$data['time_warning'] += $value_sla['time_warning']; $array_result[$i]['utimestamp'] = $period;
$data['time_unknown'] += $value_sla['time_unknown'];
$data['time_downtime'] += $value_sla['time_downtime'];
$data['time_not_init'] += $value_sla['time_not_init'];
$data['checks_total'] += $value_sla['checks_total'];
$data['checks_ok'] += $value_sla['checks_ok'];
$data['checks_error'] += $value_sla['checks_error'];
$data['checks_warning'] += $value_sla['checks_warning'];
$data['checks_unknown'] += $value_sla['checks_unknown'];
$data['checks_not_init'] += $value_sla['checks_not_init'];
// Generate raw data for graph.
if ($value_sla['time_total'] != 0) {
if ($value_sla['time_error'] > 0) {
// ERR.
$array_graph[$i]['data'] = 3;
} else if ($value_sla['time_unknown'] > 0) {
// UNKNOWN.
$array_graph[$i]['data'] = 4;
} else if ($value_sla['time_warning'] > 0) {
// Warning.
$array_graph[$i]['data'] = 2;
} else if ($value_sla['time_not_init'] == $value_sla['time_total']) {
// NOT INIT.
$array_graph[$i]['data'] = 6;
} else {
$array_graph[$i]['data'] = 1;
}
} else { } else {
$array_graph[$i]['data'] = 7; $period = ($report['datetime'] - $event['utimestamp']);
// El ultimo evento solo lo arrastramos hasta la fecha actual.
// Si pedimos mas fecha sera desconocido.
if ($report['datetime'] > $current_time) {
$period = ($current_time - $event['utimestamp']);
}
$array_result[$i]['utimestamp'] = $period;
} }
$array_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']); if ($array_result[$i]['data'] === AGENT_MODULE_STATUS_NORMAL) {
$check_ok++;
$time_ok += $period;
}
$check_total++;
$i++; $i++;
} }
$data['sla_value'] = reporting_sla_get_compliance_from_array( // Bloque por si se pide mas fecha.
$data if ($report['datetime'] > $current_time) {
); $array_result[$i]['data'] = AGENT_MODULE_STATUS_UNKNOWN;
$array_result[$i]['utimestamp'] = ($report['datetime'] - $current_time);
$data['sla_fixed'] = sla_truncate(
$data['sla_value'],
$config['graph_precision']
);
$data_init = -1;
$acum = 0;
$sum = 0;
$array_result = [];
$i = 0;
foreach ($array_graph as $value) {
if ($data_init == -1) {
$data_init = $value['data'];
$acum = $value['utimestamp'];
} else {
if ($data_init == $value['data']) {
$acum = ($acum + $value['utimestamp']);
} else {
$array_result[$i]['data'] = $data_init;
$array_result[$i]['utimestamp'] = $acum;
$array_result[$i]['real_data'] = $sum;
$i++;
$data_init = $value['data'];
$acum = $value['utimestamp'];
}
}
} }
if (count($array_result) == 0) {
$array_result = $array_graph;
} else {
$array_result[$i]['data'] = $data_init;
$array_result[$i]['utimestamp'] = $acum;
$array_result[$i]['real_data'] = $sum;
}
$time_total = $data['time_total'];
// Slice graphs calculation.
$return['agent'] = modules_get_agentmodule_agent_alias( $return['agent'] = modules_get_agentmodule_agent_alias(
$content['id_agent_module'] $content['id_agent_module']
); );
@ -16166,37 +16169,21 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
$content['id_agent_module'] $content['id_agent_module']
); );
$return['max_critical'] = $max_value_critical; $return['data_ok'] = $check_ok;
$return['min_critical'] = $min_value_critical; $return['data_total'] = $check_total;
$return['critical_inverse'] = $inverse_critical; if ($check_total > 0) {
$return['max_warning'] = $max_value_warning; $return['percent_ok'] = (($time_ok * 100) / $content['period']);
$return['min_warning'] = $min_value_warning;
$return['warning_inverse'] = $inverse_warning;
$return['data_not_init'] = $data['checks_not_init'];
$return['data_unknown'] = $data['checks_unknown'];
$return['data_critical'] = $data['checks_error'];
$return['data_warning'] = $data['checks_warning'];
$return['data_ok'] = $data['checks_ok'];
$return['data_total'] = $data['checks_total'];
$return['time_not_init'] = $data['time_not_init'];
$return['time_unknown'] = $data['time_unknown'];
$return['time_critical'] = $data['time_error'];
$return['time_warning'] = $data['time_warning'];
$return['time_ok'] = $data['time_ok'];
if ($data['checks_total'] > 0) {
$return['percent_ok'] = (($data['checks_ok'] * 100) / $data['checks_total']);
} else { } else {
$return['percent_ok'] = 0; $return['percent_ok'] = 0;
} }
$colors = [ $colors = [
1 => COL_NORMAL, AGENT_MODULE_STATUS_CRITICAL_ALERT => COL_ALERTFIRED,
2 => COL_WARNING, AGENT_MODULE_STATUS_NORMAL => COL_NORMAL,
3 => COL_CRITICAL, AGENT_MODULE_STATUS_UNKNOWN => COL_UNKNOWN,
4 => COL_UNKNOWN, AGENT_MODULE_STATUS_WARNING => COL_WARNING,
5 => COL_DOWNTIME, AGENT_MODULE_STATUS_CRITICAL_BAD => COL_CRITICAL,
6 => COL_NOTINIT, AGENT_MODULE_STATUS_NOT_INIT => COL_NOTINIT,
7 => COL_IGNORED,
]; ];
$width_graph = 100; $width_graph = 100;

View File

@ -1016,12 +1016,12 @@ function reports_get_report_types($template=false, $not_editor=false)
$types['vuls_attack_complexity'] = [ $types['vuls_attack_complexity'] = [
'optgroup' => __('Vulnerabilities'), 'optgroup' => __('Vulnerabilities'),
'name' => __('Attack complexity graph donut'), 'name' => __('Attack complexity doughnut chart'),
]; ];
$types['vuls_by_packages'] = [ $types['vuls_by_packages'] = [
'optgroup' => __('Vulnerabilities'), 'optgroup' => __('Vulnerabilities'),
'name' => __('By packages in graph pie'), 'name' => __('By packages in pie chart'),
]; ];
$types['vuls_by_agent'] = [ $types['vuls_by_agent'] = [

View File

@ -1978,15 +1978,21 @@ function ui_print_help_icon(
* *
* @return boolean True if the file was added. False if the file doesn't exist. * @return boolean True if the file was added. False if the file doesn't exist.
*/ */
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false) function ui_require_css_file($name, $path='include/styles/', $echo_tag=false, $return=false)
{ {
global $config; global $config;
$filename = $path.$name.'.css'; $filename = $path.$name.'.css';
if ($echo_tag === true) { if ($echo_tag === true) {
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">'; $filename .= '?v='.$config['current_package'];
return null; $tag_name = '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
if ($return === false) {
echo $tag_name;
return null;
} else {
return $tag_name;
}
} }
if (! isset($config['css'])) { if (! isset($config['css'])) {
@ -2035,15 +2041,20 @@ function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
* *
* @return boolean True if the file was added. False if the file doesn't exist. * @return boolean True if the file was added. False if the file doesn't exist.
*/ */
function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false) function ui_require_javascript_file($name, $path='include/javascript/', $echo_tag=false, $return=false)
{ {
global $config; global $config;
$filename = $path.$name.'.js'; $filename = $path.$name.'.js';
if ($echo_tag) { if ($echo_tag === true) {
echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>'; $filename .= '?v='.$config['current_package'];
return null; $tag_name = '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
if ($return === false) {
echo $tag_name;
return null;
} else {
return $tag_name;
}
} }
if (! isset($config['js'])) { if (! isset($config['js'])) {

View File

@ -1004,6 +1004,13 @@ function get_build_setup_charts($type, $options, $data)
} }
} }
// Set display grid true or false.
if (isset($options['grid']) === true) {
$scales = $chart->options()->getScales();
$scales->getX()->grid()->setDrawOnChartArea($options['grid']);
$scales->getY()->grid()->setDrawOnChartArea($options['grid']);
}
// Radius is null maximum possible. // Radius is null maximum possible.
if (isset($options['radius']) === true if (isset($options['radius']) === true
&& empty($options['radius']) === false && empty($options['radius']) === false

View File

@ -11,14 +11,14 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
function include_javascript_d3($return=false) function include_javascript_d3($return=false, $force=false)
{ {
global $config; global $config;
static $is_include_javascript = false; static $is_include_javascript = false;
$output = ''; $output = '';
if (!$is_include_javascript) { if (!$is_include_javascript || $force === true) {
$is_include_javascript = true; $is_include_javascript = true;
$output .= '<script type="text/javascript" src="'; $output .= '<script type="text/javascript" src="';

View File

@ -756,9 +756,8 @@ function flot_slicesbar_graph(
global $config; global $config;
if ($ttl == 2) { if ($ttl == 2) {
$tokem_config = uniqid('slicebar');
$params = [ $params = [
'tokem_config' => $tokem_config, 'graph_data' => $graph_data,
'period' => $period, 'period' => $period,
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
@ -781,9 +780,6 @@ function flot_slicesbar_graph(
'server_id' => $server_id, 'server_id' => $server_id,
]; ];
update_check_config_token($tokem_config, json_encode($graph_data));
$_SESSION['slicebar'] = $tokem_config;
$_SESSION['slicebar_value'] = json_encode($graph_data);
$graph = '<img src="data:image/png;base64,'; $graph = '<img src="data:image/png;base64,';
$graph .= generator_chart_to_pdf('slicebar', $params); $graph .= generator_chart_to_pdf('slicebar', $params);
$graph .= '" />'; $graph .= '" />';

View File

@ -1035,6 +1035,7 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
modal: false, modal: false,
width: 600, width: 600,
height: 600, height: 600,
dialogClass: "modal-sound",
open: function() { open: function() {
$.ajax({ $.ajax({
method: "post", method: "post",
@ -1095,10 +1096,10 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
if (reload == false && dialog_parameters != undefined) { if (reload == false && dialog_parameters != undefined) {
if ($("#button-start-search").hasClass("play")) { if ($("#button-start-search").hasClass("play")) {
$("#filter_id").val(dialog_parameters["filter_id"]); $("#filter_id").val(dialog_parameters.filter_id);
$("#interval").val(dialog_parameters["interval"]); $("#interval").val(dialog_parameters.interval);
$("#time_sound").val(dialog_parameters["time_sound"]); $("#time_sound").val(dialog_parameters.time_sound);
$("#sound_id").val(dialog_parameters["sound_id"]); $("#sound_id").val(dialog_parameters.sound_id);
$("#filter_id").trigger("change"); $("#filter_id").trigger("change");
$("#interval").trigger("change"); $("#interval").trigger("change");
@ -1155,14 +1156,15 @@ function openSoundEventsDialog(settings, dialog_parameters, reload) {
} }
function openSoundEventModal(settings) { function openSoundEventModal(settings) {
var win = "";
if ($("#hidden-metaconsole_activated").val() === "1") { if ($("#hidden-metaconsole_activated").val() === "1") {
var win = open( win = open(
"../../operation/events/sound_events.php", "../../operation/events/sound_events.php",
"day_123", "day_123",
"width=600,height=500" "width=600,height=500"
); );
} else { } else {
var win = open( win = open(
"operation/events/sound_events.php", "operation/events/sound_events.php",
"day_123", "day_123",
"width=600,height=500" "width=600,height=500"
@ -1533,11 +1535,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
typeof requestBody.includes === "function" && typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1") requestBody.includes("drawConsoleSound=1")
) { ) {
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute // Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]'); var dialog = $('[aria-describedby="modal-sound"]');
@ -1547,62 +1544,32 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Add the minimize button before the close button // Add the minimize button before the close button
var minimizeButton = $("<button>", { var minimizeButton = $("<button>", {
class: class:
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize", "ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize minimize-buttom-image",
type: "button", type: "button",
title: "Minimize", title: "Minimize"
style: "float: right;margin-right: 1.5em;"
}).insertBefore(closeButton); }).insertBefore(closeButton);
// Add the minimize icon to the minimize button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-minusthick",
style: "background-color: #fff;"
}).appendTo(minimizeButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(minimizeButton);
// Add the disengage button before the minimize button // Add the disengage button before the minimize button
var disengageButton = $("<button>", { var disengageButton = $("<button>", {
class: class:
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage", "ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage disengage-buttom-image",
type: "button", type: "button",
title: "Disengage", title: "Disengage"
style: "float: right;margin-right: 0.5em; position:relative;"
}).insertBefore(minimizeButton); }).insertBefore(minimizeButton);
// Add the disengage icon to the disengage button
$("<span>", {
class: "ui-button-icon ui-icon ui-icon-circle-triangle-n",
style: "background-color: #fff;"
}).appendTo(disengageButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(disengageButton);
minimizeButton.click(function(e) { minimizeButton.click(function(e) {
console.log("here");
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) { if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down"); $("#minimize_arrow_event_sound").addClass("arrow_menu_down");
} else if ( } else if (
$("#minimize_arrow_event_sound").hasClass("arrow_menu_down") $("#minimize_arrow_event_sound").hasClass("arrow_menu_down")
) { ) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up"); $("#minimize_arrow_event_sound").addClass("arrow_menu_up");
} }
if (!dialog.data("isMinimized")) { if (!dialog.data("isMinimized")) {
$(".ui-widget-overlay").hide(); $(".ui-widget-overlay").hide();
console.log("Minimize Window");
dialog.data("originalPos", dialog.position()); dialog.data("originalPos", dialog.position());
dialog.data("originalSize", { dialog.data("originalSize", {
width: dialog.width(), width: dialog.width(),
@ -1613,7 +1580,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
dialog.animate( dialog.animate(
{ {
height: "40px", height: "40px",
top: 0,
top: $(window).height() - 100 top: $(window).height() - 100
}, },
200, 200,
@ -1628,17 +1594,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
}, },
5 5
); );
//dialog.find(".ui-dialog-content").hide();
} else { } else {
console.log("Restore Window");
$(".ui-widget-overlay").show(); $(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false); dialog.data("isMinimized", false);
dialog.animate( dialog.animate(
{ {
height: "40px", height: "40px",
top: 0,
top: $(window).height() - 100 top: $(window).height() - 100
}, },
5 5

View File

@ -581,6 +581,12 @@ class EventsListWidget extends Widget
$customFilter = \events_get_event_filter($this->values['customFilter']); $customFilter = \events_get_event_filter($this->values['customFilter']);
if ($customFilter !== false) { if ($customFilter !== false) {
$filter = $customFilter; $filter = $customFilter;
if (in_array('0', $this->values['groupId'])) {
$filter['id_group_filter'] = 0;
} else {
$filter['id_group_filter'] = (!empty($this->values['groupId'][0])) ? $this->values['groupId'] : 0;
}
$filter['tag_with'] = base64_encode( $filter['tag_with'] = base64_encode(
io_safe_output($filter['tag_with']) io_safe_output($filter['tag_with'])
); );

View File

@ -120,6 +120,23 @@ final class EventsHistory extends Item
$moduleId = static::parseIntOr($linkedModule['moduleId'], null); $moduleId = static::parseIntOr($linkedModule['moduleId'], null);
$legendColor = static::extractLegendColor($data); $legendColor = static::extractLegendColor($data);
$metaconsoleId = $linkedModule['metaconsoleId'];
// Maybe connect to node.
$nodeConnected = false;
if (\is_metaconsole() === true && $metaconsoleId !== null) {
$nodeConnected = \metaconsole_connect(
null,
$metaconsoleId
) === NOERR;
if ($nodeConnected === false) {
throw new \InvalidArgumentException(
'error connecting to the node'
);
}
}
if ($agentId === null) { if ($agentId === null) {
throw new \InvalidArgumentException('missing agent Id'); throw new \InvalidArgumentException('missing agent Id');
} }
@ -166,6 +183,11 @@ final class EventsHistory extends Item
$data['html'] = $html; $data['html'] = $html;
// Restore connection.
if ($nodeConnected === true) {
\metaconsole_restore_db();
}
return $data; return $data;
} }

View File

@ -538,3 +538,7 @@ div.container-filter-buttons {
.ui-state-active { .ui-state-active {
border-radius: 0px !important; border-radius: 0px !important;
} }
.ui-dialog.modal-sound .ui-widget-header {
display: flex !important;
}

View File

@ -46,15 +46,10 @@
} }
.ui-dialog .ui-dialog-titlebar-minimize { .ui-dialog .ui-dialog-titlebar-minimize {
position: absolute; position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px; height: 20px;
bottom: 30%; width: 20px;
top: 2em; margin-right: 1px;
background-color: #fff !important;
} }
.ui-dialog .ui-dialog-titlebar-minimize:hover { .ui-dialog .ui-dialog-titlebar-minimize:hover {
@ -63,16 +58,9 @@
.ui-dialog .ui-dialog-titlebar-disengage { .ui-dialog .ui-dialog-titlebar-disengage {
position: relative; position: relative;
right: 1.5em;
width: 21px;
margin: 0px 0 0 0;
padding: 1px;
height: 20px; height: 20px;
bottom: 30%; width: 20px;
background-color: #fff !important; margin-right: 5px;
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
} }
.ui-dialog .ui-dialog-titlebar-disengage:hover { .ui-dialog .ui-dialog-titlebar-disengage:hover {

View File

@ -10837,6 +10837,13 @@ button div.fail {
-webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain; -webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain;
} }
button div.refresh {
mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/refresh@svg.svg) no-repeat center / contain;
width: 22px;
height: 22px;
}
button div.force { button div.force {
mask: url(../../images/force@svg.svg) no-repeat center / contain; mask: url(../../images/force@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/force@svg.svg) no-repeat center / contain; -webkit-mask: url(../../images/force@svg.svg) no-repeat center / contain;
@ -12781,6 +12788,10 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
.alert_view_calendar > .fc-view-harness > .fc-view > .fc-scrollgrid {
width: auto !important;
}
.title_tactical { .title_tactical {
padding: 10px 0px 10px 0px; padding: 10px 0px 10px 0px;
text-align: center; text-align: center;
@ -12859,7 +12870,26 @@ tr.shown td.details-control {
color: black; color: black;
} }
.basic-options-disabled tr > td,
.basic-options-disabled tr > td > div > label {
color: gray;
font-weight: bold;
}
#cluetip-inner > #example { #cluetip-inner > #example {
position: absolute; position: absolute;
margin-left: 5px; margin-left: 5px;
} }
.disengage-buttom-image {
background-color: rgb(51, 51, 51);
mask: url(../../images/desacoplar-ventana.svg) no-repeat right / contain;
-webkit-mask: url(../../images/desacoplar-ventana.svg) no-repeat right /
contain;
}
.minimize-buttom-image {
background-color: rgb(51, 51, 51);
mask: url(../../images/minimizar.svg) no-repeat right / contain;
-webkit-mask: url(../../images/minimizar.svg) no-repeat right / contain;
}

View File

@ -132,6 +132,11 @@
border-radius: 5px; border-radius: 5px;
} }
#filter-agent-security div {
display: flex;
flex-direction: column;
}
@media (max-width: 1500px) { @media (max-width: 1500px) {
.col-md-3 { .col-md-3 {
width: 40%; width: 40%;

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.774'; $version = '7.0NG.774';
$build = '231130'; $build = '231207';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -66,7 +66,8 @@ function printFormFilterAlert(
$action_filter=false, $action_filter=false,
$return=false, $return=false,
$strict_user=false, $strict_user=false,
$access='AR' $access='AR',
$search_sg=0
) { ) {
global $config; global $config;
include_once $config['homedir'].'/include/functions_tags.php'; include_once $config['homedir'].'/include/functions_tags.php';
@ -160,7 +161,12 @@ function printFormFilterAlert(
$callbackTag $callbackTag
); );
$table->data[1][0] = html_print_label_input_block( $table->data[3][0] = html_print_label_input_block(
__('Also search in secondary groups'),
html_print_checkbox_switch_extended('search_sg', 0, 0, false, '', '', true)
);
$table->data[2][0] = html_print_label_input_block(
__('Free text for search').ui_print_help_tip( __('Free text for search').ui_print_help_tip(
__('Filter by agent name, module name, template name or action name'), __('Filter by agent name, module name, template name or action name'),
true true
@ -168,7 +174,7 @@ function printFormFilterAlert(
html_print_input_text('free_search', $free_search, '', 20, 40, true) html_print_input_text('free_search', $free_search, '', 20, 40, true)
); );
$table->data[1][1] = html_print_label_input_block( $table->data[2][1] = html_print_label_input_block(
__('Standby'), __('Standby'),
html_print_select( html_print_select(
$alert_standby, $alert_standby,
@ -187,7 +193,7 @@ function printFormFilterAlert(
); );
$alert_action = alerts_get_alert_actions_filter(); $alert_action = alerts_get_alert_actions_filter();
$table->data[1][2] = html_print_label_input_block( $table->data[2][2] = html_print_label_input_block(
__('Action'), __('Action'),
html_print_select( html_print_select(
$alert_action, $alert_action,

View File

@ -58,7 +58,7 @@ $filter_standby = get_parameter('standby', 'all');
$id_group = (int) get_parameter('ag_group', 0); $id_group = (int) get_parameter('ag_group', 0);
// 0 is the All group (selects all groups) // 0 is the All group (selects all groups)
$free_search = get_parameter('free_search', ''); $free_search = get_parameter('free_search', '');
$search_sg = get_parameter('search_sg', 0);
$user_tag_array = tags_get_user_tags($config['id_user'], 'AR', true); $user_tag_array = tags_get_user_tags($config['id_user'], 'AR', true);
if ($user_tag_array) { if ($user_tag_array) {
@ -578,6 +578,14 @@ $(document).ready ( function () {
}); });
}); });
$('#checkbox-search_sg').click(function(){
if ($('#checkbox-search_sg').val() == 0) {
$('#checkbox-search_sg').val(1);
}else {
$('#checkbox-search_sg').val(0);
}
});
$('table.alert-status-filter #ag_group').change (function () { $('table.alert-status-filter #ag_group').change (function () {
var strict_user = $("#text-strict_user_hidden").val(); var strict_user = $("#text-strict_user_hidden").val();
var is_meta = $("#text-is_meta_hidden").val(); var is_meta = $("#text-is_meta_hidden").val();

View File

@ -130,6 +130,11 @@ $severity = get_parameter(
'filter[severity]', 'filter[severity]',
($filter['severity'] ?? '') ($filter['severity'] ?? '')
); );
$regex = get_parameter(
'filter[regex]',
(io_safe_output($filter['regex']) ?? '')
);
unset($filter['regex']);
$status = get_parameter( $status = get_parameter(
'filter[status]', 'filter[status]',
($filter['status'] ?? '') ($filter['status'] ?? '')
@ -473,7 +478,7 @@ if (is_ajax() === true) {
$data = array_reduce( $data = array_reduce(
$events, $events,
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event) { function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event, $regex) {
global $config; global $config;
$tmp = (object) $item; $tmp = (object) $item;
@ -1208,12 +1213,34 @@ if (is_ajax() === true) {
} }
} }
if (empty($tmp) === false && $regex !== '') {
$regex_validation = false;
foreach (json_decode(json_encode($tmp), true) as $key => $field) {
if (preg_match('/'.$regex.'/', $field)) {
$regex_validation = true;
}
}
if ($regex_validation === false) {
unset($tmp);
}
}
$carry[] = $tmp; $carry[] = $tmp;
return $carry; return $carry;
} }
); );
} }
$data = array_values(
array_filter(
$data,
function ($item) {
return (bool) (array) $item;
}
)
);
$count = count($data);
// RecordsTotal && recordsfiltered resultados totales. // RecordsTotal && recordsfiltered resultados totales.
echo json_encode( echo json_encode(
[ [
@ -1294,6 +1321,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$severity = $filter['severity']; $severity = $filter['severity'];
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$regex = $filter['regex'];
$not_search = $filter['not_search']; $not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
@ -1862,6 +1890,13 @@ if (enterprise_hook(
'eventos', 'eventos',
'execute_event_responses', 'execute_event_responses',
] ]
) === false && enterprise_hook(
'enterprise_acl',
[
$config['id_user'],
'eventos',
'operation/events/events',
]
) === false ) === false
) { ) {
$readonly = true; $readonly = true;
@ -2058,6 +2093,12 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
// REGEX search datatable.
$in = '<div class="filter_input"><label>'.__('Regex search').ui_print_help_tip(__('Regular expresion to filter.'), true).'</label>';
$in .= html_print_input_text('regex', $regex, '', '', 255, true);
$in .= '</div>';
$inputs[] = $in;
// User private filter. // User private filter.
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true); $inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
// Trick view in table. // Trick view in table.
@ -3489,6 +3530,10 @@ $(document).ready( function() {
click_button_remove_tag("without"); click_button_remove_tag("without");
}); });
$('#myInputTextField').keyup(function(){
$("#table_events").search($(this).val()).draw() ;
});
$("#button-events_form_search_bt").click(function(){ $("#button-events_form_search_bt").click(function(){
show_events_graph(); show_events_graph();
}); });

View File

@ -774,7 +774,7 @@ if ($access_console_node === true) {
// Check if was displayed inside other menu. // Check if was displayed inside other menu.
if ($extension['operation_menu']['fatherId'] == '') { if ($extension['operation_menu']['fatherId'] == '') {
if ($extension_menu['name'] == 'Update manager') { if ($extension_menu['name'] == 'Warp update') {
continue; continue;
} }

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
# 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

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
# 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.774 %define version 7.0NG.774
%define release 231130 %define release 231207
%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

@ -290,16 +290,6 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- snmp_oid is also used for WMI query -- snmp_oid is also used for WMI query
-- -----------------------------------------------------
-- Table `tagent_access`
-- -----------------------------------------------------
-- CREATE TABLE IF NOT EXISTS `tagent_access` (
-- `id_agent` INT UNSIGNED NOT NULL DEFAULT 0,
-- `utimestamp` BIGINT NOT NULL DEFAULT 0,
-- KEY `agent_index` (`id_agent`),
-- KEY `idx_utimestamp` USING BTREE (`utimestamp`)
-- ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `talert_snmp` -- Table `talert_snmp`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -1272,6 +1262,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0, `custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT, `owner_user` TEXT,
`private_filter_user` TEXT, `private_filter_user` TEXT,
`regex` TEXT,
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -156,7 +156,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('gotty', '/usr/bin/gotty'), ('gotty', '/usr/bin/gotty'),
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'), ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'),
('server_unique_identifier', replace(uuid(),'-','')), ('server_unique_identifier', replace(uuid(),'-','')),
('lts_name', ''); ('lts_name', ''),
('lts_updates', 1);
UNLOCK TABLES; UNLOCK TABLES;
-- --

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.774-231130 Version: 7.0NG.774-231207
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.774-231130" pandora_version="7.0NG.774-231207"
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.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231130"; my $pandora_build = "231207";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -1836,6 +1836,34 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
. $base64_data . "\n"; . $base64_data . "\n";
} }
# Image that comes from module macro substitution.
if ($field3 =~ /cid:moduledata_/) {
$content_type = 'multipart/related; boundary="'.$boundary.'"';
$boundary = "--" . $boundary;
$field3 = $boundary . "\n"
. "Content-Type: " . $html_content_type . "\n\n"
# "Content-Transfer-Encoding: quoted-printable\n\n"
. $field3 . "\n";
my @matches = ($field3 =~ /cid:moduledata_(\d+)/g);
foreach my $module_id (@matches) {
# Get base64 Image for the module.
my $module_data = get_db_value($dbh, 'SELECT datos FROM tagente_estado WHERE id_agente_modulo = ?', $module_id);
my $base64_data = substr($module_data, 23); # remove first 23 characters: 'data:image/png;base64, '
$cid = 'moduledata_'.$module_id;
my $filename = $cid . ".png";
$field3 .= $boundary . "\n"
. "Content-Type: image/png; name=\"" . $filename . "\"\n"
. "Content-Disposition: inline; filename=\"" . $filename . "\"\n"
. "Content-Transfer-Encoding: base64\n"
. "Content-ID: <" . $cid . ">\n"
. "Content-Location: " . $filename . "\n\n"
. $base64_data . "\n";
}
}
if ($pa_config->{"mail_in_separate"} != 0){ if ($pa_config->{"mail_in_separate"} != 0){
foreach my $address (split (',', $field1)) { foreach my $address (split (',', $field1)) {
# Remove blanks # Remove blanks
@ -5154,6 +5182,11 @@ sub on_demand_macro($$$$$$;$) {
elsif (defined($unit_mod) && $unit_mod ne '') { elsif (defined($unit_mod) && $unit_mod ne '') {
$field_value .= $unit_mod; $field_value .= $unit_mod;
} }
if ($field_value =~ /^data:image\/png;base64, /) {
# macro _data_ substitution in case is image.
$field_value = '<img style="height: 150px;" src="cid:moduledata_' . $id_mod . '"/>';
}
return(defined($field_value)) ? $field_value : ''; return(defined($field_value)) ? $field_value : '';
} elsif ($macro eq '_secondarygroups_') { } elsif ($macro eq '_secondarygroups_') {

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.774"; my $pandora_version = "7.0NG.774";
my $pandora_build = "231130"; my $pandora_build = "231207";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -181,6 +181,7 @@ our @EXPORT = qw(
check_cron_value check_cron_value
check_cron_element check_cron_element
cron_check cron_check
p_pretty_json
); );
# ID of the different servers # ID of the different servers
@ -2977,6 +2978,18 @@ sub get_server_name {
return "UNKNOWN"; return "UNKNOWN";
} }
################################################################################
# Pretty print json.
################################################################################
sub p_pretty_json {
my ($data) = @_;
# Initialize JSON manager.
my $j = JSON->new->utf8(1)->pretty(1)->indent(1);
my $output = $j->encode($data);
return $output;
}
1; 1;
__END__ __END__

View File

@ -7,7 +7,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.774 %define version 7.0NG.774
%define release 231130 %define release 231207
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.774 Build 231130"; my $version = "7.0NG.774 Build 231207";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -142,10 +142,18 @@ sub pandora_purgedb ($$$) {
# Delete manually disabled agents after some period # Delete manually disabled agents after some period
if (defined ($conf->{'_delete_disabled_agents'}) && $conf->{'_delete_disabled_agents'} > 0) { if (defined ($conf->{'_delete_disabled_agents'}) && $conf->{'_delete_disabled_agents'} > 0) {
log_message('PURGE', "Deleting old disabled agents (More than " . $conf->{'_delete_disabled_agents'} . " days)."); log_message('PURGE', "Deleting old disabled agents (More than " . $conf->{'_delete_disabled_agents'} . " days).");
db_do ($dbh, "DELETE FROM tagente my @agents_to_delete = get_db_rows (
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW()) $dbh,
AND disabled = 1 "SELECT id_agente FROM tagente
AND modo != 2", $conf->{'_delete_disabled_agents'} * 8600); WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
AND disabled = 1
AND modo != 2",
$conf->{'_delete_disabled_agents'} * 8600
);
foreach my $agent_to_delete (@agents_to_delete) {
pandora_delete_agent($dbh, $agent_to_delete->{'id_agente'}, $conf);
}
} }
# Delete old data # Delete old data
@ -322,14 +330,22 @@ sub pandora_purgedb ($$$) {
AND id_rc NOT IN (SELECT id_report_content FROM treport_content_sla_combined)"); AND id_rc NOT IN (SELECT id_report_content FROM treport_content_sla_combined)");
} }
# Delete disabled autodisable agents after some period
# Delete disabled autodisable agents after some period if (defined ($conf->{'_days_autodisable_deletion'}) && $conf->{'_days_autodisable_deletion'} > 0) {
log_message ('PURGE', 'Delete autodisabled agents where last contact is bigger than ' . $conf->{'_days_autodisable_deletion'} . ' days.'); log_message ('PURGE', 'Delete autodisabled agents where last contact is bigger than ' . $conf->{'_days_autodisable_deletion'} . ' days.');
db_do ($dbh, "DELETE FROM tagente my @agents_autodisable_to_delete = get_db_rows (
WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW()) $dbh,
AND disabled=1 "SELECT id_agente FROM tagente
AND modo=2", $conf->{'_days_autodisable_deletion'}*8600); WHERE UNIX_TIMESTAMP(ultimo_contacto) + ? < UNIX_TIMESTAMP(NOW())
AND disabled = 1
AND modo = 2",
$conf->{'_days_autodisable_deletion'} * 8600
);
foreach my $agent_autodisable_to_delete (@agents_autodisable_to_delete) {
pandora_delete_agent($dbh, $agent_autodisable_to_delete->{'id_agente'}, $conf);
}
}
# Delete old netflow data # Delete old netflow data
if (!defined($conf->{'_netflow_max_lifetime'})){ if (!defined($conf->{'_netflow_max_lifetime'})){
@ -442,7 +458,7 @@ sub pandora_compactdb {
my $last_compact_offset = pandora_get_config_value($dbh, "last_compact_offset"); my $last_compact_offset = pandora_get_config_value($dbh, "last_compact_offset");
unless ($last_compact_offset) { if ($last_compact_offset eq "") {
db_do($dbh, "INSERT INTO tconfig (token, value) VALUES ('last_compact_offset', '0')"); db_do($dbh, "INSERT INTO tconfig (token, value) VALUES ('last_compact_offset', '0')");
$last_compact_offset = 0; $last_compact_offset = 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.774 Build 231130"; my $version = "7.0NG.774 Build 231207";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);