Merge remote-tracking branch 'origin/develop' into ent-12307-automonitorizacion-mysql-reads

This commit is contained in:
Calvo 2023-10-26 11:48:18 +02:00
commit 82d8af0fb5
60 changed files with 7227 additions and 6287 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773.3-231023
Version: 7.0NG.773.3-231026
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -313,6 +313,6 @@ module_plugin autodiscover --default
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca -t 150
#module_absoluteinterval 7d
#module_end
#module_end

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="231023"
PI_BUILD="231026"
OS_NAME=`uname -s`
FORCE=0

View File

@ -526,7 +526,7 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
# Hardening plugin for security compliance analysis.
#module_begin
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_sca.exe"
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_sca.exe -t 150"
#module_absoluteinterval 7d
#module_end

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d93bd9d56c938063045fa2093198d324746f84df2b74567648f3baebd635657
size 5248006
oid sha256:db207ef67053764be7e9b42cd04ea5509cc2a023548aab1c037745ca277b68a3
size 4858753

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231023}
{231026}
ViewReadme
{Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 231023))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 231026))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-231023
Version: 7.0NG.773.3-231026
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -106,6 +106,7 @@ enterprise/godmode/alerts/alert_events.php
enterprise/godmode/alerts/alert_events_list.php
enterprise/godmode/alerts/alert_events_rules.php
enterprise/godmode/alerts/configure_alert_rule.php
enterprise/godmode/alerts/alert_correlation.php
enterprise/include/functions_networkmap.php
enterprise/operation/agentes/pandora_networkmap.view.php
enterprise/include/ajax/map_enterprise.ajax.php

View File

@ -1,4 +1,4 @@
pandorafms.vmware=459175dce8ab811e874ce2e7216f0db4
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6

View File

@ -5,6 +5,98 @@ ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
CREATE TABLE IF NOT EXISTS `tlog_alert` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` TEXT ,
`description` MEDIUMTEXT,
`order` INT UNSIGNED DEFAULT 0,
`mode` ENUM('PASS','DROP'),
`field1` TEXT ,
`field2` TEXT ,
`field3` TEXT ,
`field4` TEXT ,
`field5` TEXT ,
`field6` TEXT ,
`field7` TEXT ,
`field8` TEXT ,
`field9` TEXT ,
`field10` TEXT ,
`time_threshold` INT NOT NULL DEFAULT 86400,
`max_alerts` INT UNSIGNED NOT NULL DEFAULT 1,
`min_alerts` INT UNSIGNED NOT NULL DEFAULT 0,
`time_from` time DEFAULT '00:00:00',
`time_to` time DEFAULT '00:00:00',
`monday` TINYINT DEFAULT 1,
`tuesday` TINYINT DEFAULT 1,
`wednesday` TINYINT DEFAULT 1,
`thursday` TINYINT DEFAULT 1,
`friday` TINYINT DEFAULT 1,
`saturday` TINYINT DEFAULT 1,
`sunday` TINYINT DEFAULT 1,
`recovery_notify` TINYINT DEFAULT 0,
`field1_recovery` TEXT,
`field2_recovery` TEXT,
`field3_recovery` TEXT,
`field4_recovery` TEXT,
`field5_recovery` TEXT,
`field6_recovery` TEXT,
`field7_recovery` TEXT,
`field8_recovery` TEXT,
`field9_recovery` TEXT,
`field10_recovery` TEXT,
`id_group` MEDIUMINT UNSIGNED NULL DEFAULT 0,
`internal_counter` INT DEFAULT 0,
`last_fired` BIGINT NOT NULL DEFAULT 0,
`last_reference` BIGINT NOT NULL DEFAULT 0,
`times_fired` INT NOT NULL DEFAULT 0,
`disabled` TINYINT DEFAULT 0,
`standby` TINYINT DEFAULT 0,
`priority` TINYINT DEFAULT 0,
`force_execution` TINYINT DEFAULT 0,
`group_by` enum ('','id_agente','id_agentmodule','id_alert_am','id_grupo') DEFAULT '',
`special_days` TINYINT DEFAULT 0,
`disable_event` TINYINT DEFAULT 0,
`id_template_conditions` INT UNSIGNED NOT NULL DEFAULT 0,
`id_template_fields` INT UNSIGNED NOT NULL DEFAULT 0,
`last_evaluation` BIGINT NOT NULL DEFAULT 0,
`pool_occurrences` INT UNSIGNED NOT NULL DEFAULT 0,
`schedule` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tlog_rule` (
`id_log_rule` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`operation` ENUM('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
`order` INT UNSIGNED DEFAULT 0,
`window` INT NOT NULL DEFAULT 0,
`count` INT NOT NULL DEFAULT 1,
`name` TEXT,
`log_content` TEXT,
`log_source` TEXT,
`log_agent` TEXT,
`operator_log_content` TEXT COMMENT 'Operator for log_content',
`operator_log_source` TEXT COMMENT 'Operator for log_source',
`operator_log_agent` TEXT COMMENT 'Operator for log_agent',
PRIMARY KEY (`id_log_rule`),
KEY `idx_id_log_alert` (`id_log_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tlog_alert_action` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`id_alert_action` INT UNSIGNED NOT NULL,
`fires_min` INT UNSIGNED DEFAULT 0,
`fires_max` INT UNSIGNED DEFAULT 0,
`module_action_threshold` INT NOT NULL DEFAULT 0,
`last_execution` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_log_alert`) REFERENCES tlog_alert(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
@ -267,5 +359,13 @@ SET @id_os = 9;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
ALTER TABLE tagente_modulo ADD COLUMN `last_compact` TIMESTAMP NOT NULL DEFAULT 0;
UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_alert SET disabled=1 WHERE er.log_agent IS NOT NULL OR er.log_content IS NOT NULL OR er.log_source IS NOT NULL;
ALTER TABLE `tnetwork_explorer_filter`
MODIFY COLUMN `id` INT NOT NULL AUTO_INCREMENT;
COMMIT;

View File

@ -1348,6 +1348,14 @@ if ($update_module === true || $create_module === true) {
}
$configuration_data = (string) get_parameter('configuration_data');
$array_configuration_data = explode(PHP_EOL, io_safe_output($configuration_data));
$configuration_data = '';
foreach ($array_configuration_data as $value) {
$configuration_data .= trim($value).PHP_EOL;
}
$configuration_data = io_safe_input($configuration_data);
$old_configuration_data = (string) get_parameter('old_configuration_data');
$new_configuration_data = '';
@ -1488,6 +1496,14 @@ if ($update_module === true || $create_module === true) {
}
$plugin_parameter = (string) get_parameter('plugin_parameter');
$array_plugin_parameter = explode(PHP_EOL, io_safe_output($plugin_parameter));
$plugin_parameter = '';
foreach ($array_plugin_parameter as $value) {
$plugin_parameter .= trim($value).PHP_EOL;
}
$plugin_parameter = io_safe_input($plugin_parameter);
}
$parent_module_id = (int) get_parameter('parent_module_id');

View File

@ -318,7 +318,7 @@ foreach ($texts as $code => $text) {
return;
}
$(plugin_parameter).val('task_begin\ncookie 0\nresource 0\ntask_end');
$(plugin_parameter).val('task_begin\nget https://demoweb.com/page/\ncheck_string text string or HTML code to search (regexp)\ntask_end\n');
$('#button-btn_loadbasic').attr('disabled', 'disabled');

View File

@ -384,6 +384,7 @@ if ($access_console_node === true) {
$sub['godmode/alerts/alert_special_days']['pages'] = ['godmode/alerts/configure_alert_special_days'];
enterprise_hook('eventalerts_submenu');
enterprise_hook('alert_log_submenu');
$sub['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
$sub['godmode/snmpconsole/snmp_alert']['id'] = 'SNMP_alerts';
enterprise_hook('alert_inventory_submenu');

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 28.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:#3F3F3F;}
</style>
<g>
<path class="st0" d="M4.8,8C4.8,8,4.8,8,4.8,8C4.8,8,4.9,8,4.8,8c0.3,0.1,0.5,0.1,0.7,0.2c0,0,0.1,0,0.1,0c0.3,0,0.5,0.1,0.8,0.1
c0.1,0,0.1,0,0.2,0c0.2,0,0.4,0,0.7,0.1c0.1,0,0.2,0,0.2,0c0.3,0,0.6,0,0.9,0c0.3,0,0.6,0,0.9,0c0.1,0,0.2,0,0.2,0
c0.2,0,0.4,0,0.7-0.1c0.1,0,0.1,0,0.2,0c0.3,0,0.5-0.1,0.8-0.1c0,0,0.1,0,0.1,0c0.2,0,0.4-0.1,0.6-0.1c0,0,0.1,0,0.1,0c0,0,0,0,0,0
c2-0.5,3.3-1.4,3.3-2.4V4.2c0-1.6-3.1-2.8-6.8-2.8S1.6,2.6,1.6,4.2v1.4C1.6,6.6,2.9,7.5,4.8,8z"/>
<path class="st0" d="M13.8,8.8c0.5,0.1,1,0.2,1.4,0.4l0-1.2C14.8,8.4,14.3,8.6,13.8,8.8z"/>
<path class="st0" d="M7.6,17.3c-1.1-0.6-1.9-1.4-2.7-2.3c-0.7-0.1-1.3-0.3-1.9-0.5c-0.5-0.2-1-0.5-1.5-0.8v1.8
c0,0.9,1.1,1.8,2.9,2.3c0,0,0,0,0,0c0,0,0,0,0.1,0c0.2,0.1,0.5,0.1,0.8,0.2c0.1,0,0.1,0,0.2,0C5.6,18,5.9,18,6.2,18.1
c0,0,0.1,0,0.1,0c0.3,0,0.6,0.1,0.9,0.1c0.1,0,0.1,0,0.2,0c0.3,0,0.6,0,1,0c0.3,0,0.7,0,1,0c0,0,0.1,0,0.1,0
C8.9,18,8.2,17.7,7.6,17.3z"/>
<path class="st0" d="M4,13.3c0.1-0.2,0.3-0.4,0.4-0.6c1-1.2,2.1-2.2,3.6-3c-0.4,0-0.8,0-1.2-0.1c-0.2,0-0.3,0-0.5-0.1
c-0.3,0-0.7-0.1-1-0.2C4.4,9.3,3.7,9.1,3,8.9C2.5,8.7,2,8.4,1.6,8l0,3.2C1.6,12.1,2.5,12.8,4,13.3z"/>
</g>
<g>
<path class="st0" d="M5.4,13.6c0.1-0.2,0.3-0.4,0.4-0.6c0.8-1.1,1.8-1.9,3.1-2.5c0.8-0.4,1.7-0.6,2.6-0.7c1.8-0.2,3.4,0.3,4.8,1.3
c0.9,0.6,1.8,1.5,2.4,2.3c0.2,0.2,0.2,0.4,0,0.7c-0.8,1.1-1.7,1.9-2.8,2.6c-0.9,0.5-2,0.9-3.1,1.1c-1.6,0.1-3.1-0.2-4.4-1.1
C7.3,16,6.5,15,5.6,14c0-0.1-0.1-0.1-0.1-0.2C5.4,13.7,5.4,13.6,5.4,13.6z M12.1,10.8c-1.6,0-2.7,1.4-2.7,2.9s1.4,2.7,2.9,2.7
c1.5,0,2.7-1.4,2.7-2.9C15,12,13.6,10.8,12.1,10.8z"/>
<path class="st0" d="M12.2,12.1c0.8,0,1.5,0.6,1.5,1.5c0,0.8-0.6,1.6-1.6,1.6c-0.8,0-1.5-0.6-1.5-1.5
C10.7,12.8,11.3,12.1,12.2,12.1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -256,6 +256,7 @@ class ConsoleSupervisor
/*
* Check if performance variables are corrects
*/
$this->checkPerformanceVariables();
/*
@ -289,6 +290,12 @@ class ConsoleSupervisor
*/
$this->checkMYSQLSettings();
/*
* Check log alerts version
*/
$this->checkLogAlerts();
}
@ -3106,4 +3113,32 @@ class ConsoleSupervisor
}
/**
* Checks log alerts version.
*
* @return void
*/
public function checkLogAlerts()
{
global $config;
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$current_package = (int) $config['current_package'];
if ($current_package >= 774 && $current_package <= 777) {
$url = '__url__index.php?sec=galertas&sec2=enterprise/godmode/alerts/event_alerts';
$this->notify(
[
'type' => 'NOTIF.LOG.ALERT',
'title' => __('Alert correlation changed since version 774'),
'message' => __('Log correlation and log correlation with events will be disabled in this update. Some event correlation alerts may need to be modified to adapt to the new format'),
'url' => $url,
]
);
} else {
$this->cleanNotifications('NOTIF.LOG.ALERT');
}
}
}
}

View File

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

View File

@ -441,6 +441,7 @@ define('SERVER_TYPE_ALERT', 21);
define('SERVER_TYPE_CORRELATION', 22);
define('SERVER_TYPE_NCM', 23);
define('SERVER_TYPE_NETFLOW', 24);
define('SERVER_TYPE_LOG', 25);
// REPORTS.
define('REPORT_TOP_N_MAX', 1);
@ -887,3 +888,8 @@ define('HOME_SCREEN_ALERT_DETAIL', 'alert_detail');
define('HOME_SCREEN_EXTERNAL_LINK', 'external_link');
define('HOME_SCREEN_OTHER', 'other');
define('HOME_SCREEN_DASHBOARD', 'dashboard');
// Alert correlation.
define('EVENT_ALERTS', 1);
define('LOG_ALERTS', 2);

View File

@ -5409,7 +5409,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='',
$formStyle = ' style="'.$formStyle.'"';
}
$html = '<form method="POST"'.$formStyle.'>';
$html = '<form method="POST"'.$formStyle.' class="link-with-params">';
switch ($type) {
case 'image':
$html .= html_print_input_image($text, $text, $text, $style, true);

View File

@ -906,7 +906,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
'images/logs@svg.svg',
true,
[
'title' => __('Log server'),
'title' => __('Syslog server'),
'class' => 'main_menu_icon invert_filter',
]
);
@ -979,6 +979,19 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
$id_modulo = 0;
break;
case SERVER_TYPE_LOG:
$server['img'] = html_print_image(
'images/log_server.svg',
true,
[
'title' => __('Log server'),
'class' => 'main_menu_icon invert_filter',
]
);
$server['type'] = 'log';
$id_modulo = 0;
break;
default:
$server['img'] = '';
$server['type'] = 'unknown';

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,8 @@ namespace PandoraFMS\Dashboard;
global $config;
require_once $config['homedir'].'/include/functions_inventory.php';
/**
* Inventory Widget.
*/
@ -608,7 +610,7 @@ class InventoryWidget extends Widget
}
}
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
$table = ui_print_datatable(
[
'id' => $id_table,
@ -619,7 +621,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [],
'data_element' => $data,
'searching' => true,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'order' => [
'field' => $columns[0],
'direction' => 'asc',
@ -727,7 +729,7 @@ class InventoryWidget extends Widget
}
}
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid'];
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
$table = ui_print_datatable(
[
@ -739,7 +741,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [],
'data_element' => $data,
'searching' => true,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'order' => [
'field' => $columns[0],
'direction' => 'asc',
@ -893,7 +895,7 @@ class InventoryWidget extends Widget
}
}
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'];
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.uniqid().'_'.$row['id_agente'];
$table = ui_print_datatable(
[
@ -905,7 +907,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [],
'data_element' => $data,
'searching' => true,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'order' => [
'field' => $columns[0],
'direction' => 'asc',
@ -985,7 +987,7 @@ class InventoryWidget extends Widget
array_push($data, $data_tmp);
}
$id_table = 'id_'.$row['id_module_inventory'];
$id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid();
}
if ($count_rows > 1) {
@ -999,7 +1001,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [],
'data_element' => $data,
'searching' => true,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'order' => [
'field' => $columns[0],
'direction' => 'asc',
@ -1035,7 +1037,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [],
'data_element' => $data,
'searching' => true,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'order' => [
'field' => $columns[0],
'direction' => 'asc',
@ -1098,7 +1100,7 @@ class InventoryWidget extends Widget
'columns' => $columns,
'column_names' => $columns_names,
'ordering' => $ordering,
'dom_elements' => 'frtilp',
'dom_elements' => 'rtilp',
'searching' => $searching,
'order' => [
'field' => $columns[0],

View File

@ -300,6 +300,10 @@ class SingleGraphWidget extends Widget
$values['period'] = SECONDS_1DAY;
}
if (isset($values['period_projection']) === false) {
$values['period_projection'] = SECONDS_1DAY;
}
if (isset($values['showLegend']) === false) {
$values['showLegend'] = 1;
}
@ -439,7 +443,7 @@ class SingleGraphWidget extends Widget
$trickHight = 0;
if ($this->values['showLegend'] === 1) {
// Needed for legend.
$trickHight = 40;
$trickHight = 60;
}
$output = '<div class="container-center widget-mrgn-0px">';
@ -448,10 +452,16 @@ class SingleGraphWidget extends Widget
'period' => $this->values['period'],
'date' => strtotime(date('Y-m-d H:i:s')),
'only_image' => false,
'homeurl' => ui_get_full_url(false, false, false, false).'/',
'height' => ((int) $size['height'] - $trickHight),
'landscape' => $content['landscape'],
'return_img_base_64' => true,
'show_legend' => $this->values['showLegend'],
'width' => '100%',
'height' => ((int) $size['height'] - $trickHight),
'title' => $module_name,
'unit' => $units_name,
'homeurl' => $config['homeurl'],
'menu' => false,
];
$params_combined = [

View File

@ -949,3 +949,7 @@ input.resize_button {
bottom: 3%;
right: 6%;
}
.parent_graph > .graph {
margin-left: 10px;
}

View File

@ -1292,6 +1292,11 @@ p.center {
margin: 0 5px;
}
.loading-text {
font-size: 19px;
text-align: center;
}
/* Legacy spinner */
#loading {
position: fixed;

View File

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

View File

@ -36,6 +36,7 @@ require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_inventory.php';
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_omnishell.php');

View File

@ -87,7 +87,7 @@ if (is_ajax() === true) {
$filter_id = (int) get_parameter('filter_id', 0);
$filter['id_name'] = get_parameter('new_filter_name', '');
$filter['id_group'] = (int) get_parameter('assign_group', 0);
$filter['aggregate'] = get_parameter('aggregate', '');
$filter['aggregate'] = get_parameter('aggregate', 'dstip');
$filter['ip_dst'] = get_parameter('ip_dst', '');
$filter['ip_src'] = get_parameter('ip_src', '');
$filter['dst_port'] = get_parameter('dst_port', '');
@ -169,7 +169,8 @@ if ($custom_date === '1') {
$date_from = strtotime($date_init);
$date_to = strtotime($date_end);
// Read buttons.
$draw = get_parameter('draw_button', '');
// Change default value for not autoload default filter when load view.
$draw = get_parameter('draw_button', 1);
$save = get_parameter('save_button', '');
$update = get_parameter('update_button', '');
@ -663,6 +664,7 @@ if (empty($draw) === false) {
// Draw the netflow chart.
html_print_div(
[
'id' => 'container_netflow',
'class' => $netflowContainerClass,
'content' => netflow_draw_item(
$date_from,
@ -677,6 +679,22 @@ if (empty($draw) === false) {
),
]
);
$spinner = html_print_div(
[
'content' => '<span></span>',
'class' => 'spinner-fixed inherit',
'style' => 'position: initial;',
],
true
);
html_print_div(
[
'id' => 'spinner',
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
'class' => 'invisible',
'style' => 'position: initial;',
]
);
}
} else {
ui_print_info_message(__('No data to show'));
@ -934,6 +952,11 @@ ui_include_time_picker();
$('#filter_group_color').css('color', '#000000');
}
});
$("#button-draw_button").on('click', function(){
$("#container_netflow").remove();
$("#spinner").removeClass("invisible");
});
});
$("#text-time, #text-time_lower").timepicker({

View File

@ -135,11 +135,53 @@ if ($advanced_filter !== '') {
$filter['advanced_filter'] = $advanced_filter;
}
$filter_name = get_parameter('filter_name');
$order_by = get_parameter('order_by', 'bytes');
if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
$order_by = 'bytes';
}
$save = get_parameter('save_button', '');
$update = get_parameter('update_button', '');
// Save user defined filter.
if ($save != '' && check_acl($config['id_user'], 0, 'AW')) {
// Save filter args.
$data['filter_name'] = $filter_name;
$data['top'] = $top;
$data['action'] = $action;
$data['advanced_filter'] = $advanced_filter;
$filter_id = db_process_sql_insert('tnetwork_explorer_filter', $data);
if ($filter_id === false) {
$filter_id = 0;
ui_print_error_message(__('Error creating filter'));
} else {
ui_print_success_message(__('Filter created successfully'));
}
} else if ($update != '' && check_acl($config['id_user'], 0, 'AW')) {
// Update current filter.
// Do not update the filter name and group.
$data['top'] = $top;
$data['action'] = $action;
$data['advanced_filter'] = $advanced_filter;
$result = db_process_sql_update(
'tnetwork_explorer_filter',
$data,
['id' => $filter_id]
);
ui_print_result_message(
$result,
__('Filter updated successfully'),
__('Error updating filter')
);
}
// Build the table.
$filterTable = new stdClass();
$filterTable->id = '';
@ -176,6 +218,59 @@ $filterTable->data[0][1] = html_print_label_input_block(
html_print_select_date_range('date', true)
);
$filterTable->data[1][0] = html_print_label_input_block(
__('Data to show'),
html_print_select(
network_get_report_actions(),
'action',
$action,
'',
'',
0,
true
)
);
$advanced_toggle = new stdClass();
$advanced_toggle->class = 'filter-table-adv';
$advanced_toggle->size = [];
$advanced_toggle->size[0] = '50%';
$advanced_toggle->size[1] = '50%';
$advanced_toggle->width = '100%';
$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
$user_groups[0] = 0;
// Add all groups.
$sql = 'SELECT * FROM tnetwork_explorer_filter';
$advanced_toggle->data[0][0] = html_print_label_input_block(
__('Load Filter'),
html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true, false, true, false, 'width:100%;')
);
$advanced_toggle->data[0][1] = html_print_label_input_block(
__('Filter name'),
html_print_input_text('filter_name', $filter_name, false, 40, 45, true, false, false, '', 'w100p')
);
$advanced_toggle->colspan[1][0] = 2;
$advanced_toggle->data[1][0] = html_print_label_input_block(
__('Filter').ui_print_help_icon('pcap_filter', true),
html_print_textarea('advanced_filter', 4, 10, $advanced_filter, 'style="width:100%"', true)
);
$filterTable->colspan[2][0] = 3;
$filterTable->data[2][0] = html_print_label_input_block(
'',
ui_toggle(
html_print_table($advanced_toggle, true),
__('Advanced'),
'',
'',
true,
true,
'',
'white-box-content',
'box-flat white_table_graph'
)
);
$filterInputTable = '<form method="POST">';
$filterInputTable .= html_print_input_hidden('order_by', $order_by);
$filterInputTable .= html_print_table($filterTable, true);
@ -262,12 +357,16 @@ $data = netflow_get_top_summary(
// Get the params to return the builder.
$hidden_main_link = [
'time_greater' => $time_greater,
'date_greater' => $date_greater,
'time_lower' => $time_lower,
'date_lower' => $date_lower,
'top' => $top,
'action' => $action,
'custom_date' => get_parameter('custom_date', '0'),
'date' => get_parameter('date', SECONDS_1DAY),
'date_init' => get_parameter('date_init'),
'time_init' => get_parameter('time_init'),
'date_end' => get_parameter('date_end'),
'time_end' => get_parameter('time_end'),
'date_text' => get_parameter('date_text'),
'date_units' => get_parameter('date_units'),
'top' => $top,
'action' => $action,
];
unset($table);
@ -449,6 +548,7 @@ if (empty($data)) {
// Print results.
html_print_div(
[
'id' => 'content-netflow',
'style' => 'max-width: -webkit-fill-available; display: flex',
'class' => '',
'content' => $resultsTable.$pieGraph,
@ -456,11 +556,25 @@ if (empty($data)) {
);
}
$spinner = html_print_div(
[
'content' => '<span></span>',
'class' => 'spinner-fixed inherit',
'style' => 'position: initial;',
],
true
);
html_print_div(
[
'id' => 'spinner',
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
'class' => 'invisible',
'style' => 'position: initial;',
]
);
?>
<script>
$(document).ready(function(){
nf_view_click_period();
$('#filter_id').change(function(){
jQuery.post (
"ajax.php",
@ -473,9 +587,42 @@ $(document).ready(function(){
$('#action').val(data.action).trigger('change');
$('#top').val(data.top).trigger('change');
$('#textarea_advanced_filter').val(data.advanced_filter);
$('#text-filter_name').val(data.filter_name);
$('select#filter_id').select2('close');
}, 'json');
});
$('#button-update').on('click', function(){
if ($('.info_box_information').length > 0) {
$('.info_box_information').remove();
}
if ($('#content-netflow').length > 0) {
$('#content-netflow').remove();
}
if ($('#spinner').length > 0) {
$('#spinner').removeClass("invisible");
}
if ($('.link-with-params').length > 0) {
$('.link-with-params').remove();
}
});
$('.link-with-params').on('submit', function(e){
setTimeout(() => {
if ($('.info_box_information').length > 0) {
$('.info_box_information').remove();
}
if ($('#content-netflow').length > 0) {
$('#content-netflow').remove();
}
if ($('#spinner').length > 0) {
$('#spinner').removeClass("invisible");
}
if ($('.link-with-params').length > 0) {
$('.link-with-params').remove();
}
}, 100); // Prevent fields from being deleted before being sent.
})
});
// Configure jQuery timepickers.

View File

@ -336,7 +336,7 @@ ui_toggle(
$has_data = false;
if ((bool) get_parameter('update_netflow') === true) {
if ((bool) get_parameter('update_netflow', 1) === true) {
$map_data = netflow_build_map_data(
$date_from,
$date_to,
@ -354,6 +354,23 @@ if ($has_data === true) {
ui_print_info_message(__('No data to show'));
}
$spinner = html_print_div(
[
'content' => '<span></span>',
'class' => 'spinner-fixed inherit',
'style' => 'position: initial;',
],
true
);
html_print_div(
[
'id' => 'spinner',
'content' => '<p class="loading-text">'.__('Loading netflow data, please wait...').'</p>'.$spinner,
'class' => 'invisible',
'style' => 'position: initial;',
]
);
?>
<style>
.networkconsole {
@ -363,7 +380,6 @@ if ($has_data === true) {
<script>
$(document).ready(function(){
nf_view_click_period();
$('#filter_id').change(function(){
jQuery.post (
@ -380,6 +396,12 @@ $(document).ready(function(){
$('select#filter_id').select2('close');
}, 'json');
});
$('#button-update_netflow').on('click', function(){
$('.info_box_information').remove();
$('.networkconsole').remove();
$('#spinner').removeClass("invisible");
});
});
// Configure jQuery timepickers.

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 231023
%define release 231026
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 231023
%define release 231026
# User and Group under which Apache is running
%define httpd_name httpd

View File

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

View File

@ -276,6 +276,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`warning_time` INT UNSIGNED DEFAULT 0,
`quiet_by_downtime` TINYINT NOT NULL DEFAULT 0,
`disabled_by_downtime` TINYINT NOT NULL DEFAULT 0,
`last_compact` TIMESTAMP NOT NULL DEFAULT 0,
PRIMARY KEY (`id_agente_modulo`),
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
KEY `tam_agente` (`id_agente`),
@ -3131,6 +3132,110 @@ CREATE TABLE IF NOT EXISTS `tevent_alert_action` (
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- -----------------------------------------------------
-- Table `tlog_alert`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlog_alert` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` TEXT ,
`description` MEDIUMTEXT,
`order` INT UNSIGNED DEFAULT 0,
`mode` ENUM('PASS','DROP'),
`field1` TEXT ,
`field2` TEXT ,
`field3` TEXT ,
`field4` TEXT ,
`field5` TEXT ,
`field6` TEXT ,
`field7` TEXT ,
`field8` TEXT ,
`field9` TEXT ,
`field10` TEXT ,
`time_threshold` INT NOT NULL DEFAULT 86400,
`max_alerts` INT UNSIGNED NOT NULL DEFAULT 1,
`min_alerts` INT UNSIGNED NOT NULL DEFAULT 0,
`time_from` time DEFAULT '00:00:00',
`time_to` time DEFAULT '00:00:00',
`monday` TINYINT DEFAULT 1,
`tuesday` TINYINT DEFAULT 1,
`wednesday` TINYINT DEFAULT 1,
`thursday` TINYINT DEFAULT 1,
`friday` TINYINT DEFAULT 1,
`saturday` TINYINT DEFAULT 1,
`sunday` TINYINT DEFAULT 1,
`recovery_notify` TINYINT DEFAULT 0,
`field1_recovery` TEXT,
`field2_recovery` TEXT,
`field3_recovery` TEXT,
`field4_recovery` TEXT,
`field5_recovery` TEXT,
`field6_recovery` TEXT,
`field7_recovery` TEXT,
`field8_recovery` TEXT,
`field9_recovery` TEXT,
`field10_recovery` TEXT,
`id_group` MEDIUMINT UNSIGNED NULL DEFAULT 0,
`internal_counter` INT DEFAULT 0,
`last_fired` BIGINT NOT NULL DEFAULT 0,
`last_reference` BIGINT NOT NULL DEFAULT 0,
`times_fired` INT NOT NULL DEFAULT 0,
`disabled` TINYINT DEFAULT 0,
`standby` TINYINT DEFAULT 0,
`priority` TINYINT DEFAULT 0,
`force_execution` TINYINT DEFAULT 0,
`group_by` enum ('','id_agente','id_agentmodule','id_alert_am','id_grupo') DEFAULT '',
`special_days` TINYINT DEFAULT 0,
`disable_event` TINYINT DEFAULT 0,
`id_template_conditions` INT UNSIGNED NOT NULL DEFAULT 0,
`id_template_fields` INT UNSIGNED NOT NULL DEFAULT 0,
`last_evaluation` BIGINT NOT NULL DEFAULT 0,
`pool_occurrences` INT UNSIGNED NOT NULL DEFAULT 0,
`schedule` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- -----------------------------------------------------
-- Table `tlog_rule`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlog_rule` (
`id_log_rule` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`operation` ENUM('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
`order` INT UNSIGNED DEFAULT 0,
`window` INT NOT NULL DEFAULT 0,
`count` INT NOT NULL DEFAULT 1,
`name` TEXT,
`log_content` TEXT,
`log_source` TEXT,
`log_agent` TEXT,
`operator_log_content` TEXT COMMENT 'Operator for log_content',
`operator_log_source` TEXT COMMENT 'Operator for log_source',
`operator_log_agent` TEXT COMMENT 'Operator for log_agent',
PRIMARY KEY (`id_log_rule`),
KEY `idx_id_log_alert` (`id_log_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- -----------------------------------------------------
-- Table `tevent_alert_action`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlog_alert_action` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_log_alert` INT UNSIGNED NOT NULL,
`id_alert_action` INT UNSIGNED NOT NULL,
`fires_min` INT UNSIGNED DEFAULT 0,
`fires_max` INT UNSIGNED DEFAULT 0,
`module_action_threshold` INT NOT NULL DEFAULT 0,
`last_execution` BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_log_alert`) REFERENCES tlog_alert(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- -----------------------------------------------------
-- Table `tmodule_synth`
-- -----------------------------------------------------
@ -4368,7 +4473,7 @@ CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
-- Table `tnetwork_explorer_filter`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,

View File

@ -120,10 +120,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
('MR', 65),
('MR', 66),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package', 773),
('current_package', 774),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773.3-231023
Version: 7.0NG.773.3-231026
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -477,26 +477,30 @@ export_threads 1
eventserver 0
# Enable (1) or disable (0) Pandora FMS Correlation Server (PANDORA FMS ENTERPRISE ONLY).
# Number of threads for the Event Server (PANDORA FMS ENTERPRISE ONLY).
correlationserver 0
eventserver_threads 1
# Time in seconds to re-evaluate correlation alerts pool (PANDORA FMS ENTERPRISE ONLY).
correlation_threshold 30
# Correlated alerts, event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
# Event alerts, event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
event_window 3600
# Correlated Alerts, log window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
# Enable (1) or disable (0) Pandora FMS Log Server (PANDORA FMS ENTERPRISE ONLY).
logserver 0
# Number of threads for the Log Server (PANDORA FMS ENTERPRISE ONLY).
logserver_threads 1
# Event alerts, log window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
log_window 3600
# Pre-load windows on start with available information. (PANDORA FMS ENTERPRISE ONLY).
#preload_windows 0
# Correlated Alerts, group cache ttl (in seconds). Set to 0 to disable. (PANDORA FMS ENTERPRISE ONLY).
# Event alerts, group cache ttl (in seconds). Set to 0 to disable. (PANDORA FMS ENTERPRISE ONLY).
#event_server_cache_ttl 10
# Log retrieving, items per request. (High values could make elasticsearch crash)

View File

@ -470,26 +470,30 @@ export_threads 1
eventserver 0
# Enable (1) or disable (0) Pandora FMS Correlation Server (PANDORA FMS ENTERPRISE ONLY).
# Number of threads for the Event Server (PANDORA FMS ENTERPRISE ONLY).
correlationserver 0
eventserver_threads 1
# Time in seconds to re-evaluate correlation alerts pool (PANDORA FMS ENTERPRISE ONLY).
correlation_threshold 30
# Correlated alerts, event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
# Event alerts, event window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
event_window 3600
# Correlated Alerts, log window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
# Enable (1) or disable (0) Pandora FMS Log Server (PANDORA FMS ENTERPRISE ONLY).
logserver 0
# Number of threads for the Log Server (PANDORA FMS ENTERPRISE ONLY).
logserver_threads 1
# Log alerts, log window in seconds (3600 by default) (PANDORA FMS ENTERPRISE ONLY).
log_window 3600
# Pre-load windows on start with available information. (PANDORA FMS ENTERPRISE ONLY).
#preload_windows 0
# Correlated Alerts, group cache ttl (in seconds). Set to 0 to disable. (PANDORA FMS ENTERPRISE ONLY).
# Event alerts, group cache ttl (in seconds). Set to 0 to disable. (PANDORA FMS ENTERPRISE ONLY).
#event_server_cache_ttl 10
# Log retrieving, items per request. (High values could make elasticsearch crash)

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3";
my $pandora_build = "231023";
my $pandora_build = "231026";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -296,9 +296,10 @@ sub pandora_load_config {
$pa_config->{"update_parent"} = 0; # 3.1
$pa_config->{"google_maps_description"} = 0;
$pa_config->{'openstreetmaps_description'} = 0;
$pa_config->{"eventserver"} = 1; # 4.0
$pa_config->{"correlationserver"} = 0; # 757
$pa_config->{"correlation_threshold"} = 30; # 757
$pa_config->{"eventserver"} = 0; # 4.0
$pa_config->{"eventserver_threads"} = 1; # 4.0
$pa_config->{"logserver"} = 0; # 7.774
$pa_config->{"logserver_threads"} = 1; # 7.774
$pa_config->{"event_window"} = 3600; # 4.0
$pa_config->{"log_window"} = 3600; # 7.741
$pa_config->{"elastic_query_size"} = 10; # 7.754 Elements per request (ELK)
@ -512,7 +513,7 @@ sub pandora_load_config {
$pa_config->{"clean_wux_sessions"} = 1; # 7.0.746 (only selenium 3)
# Syslog Server
$pa_config->{"syslogserver"} = 1; # 7.0.716
$pa_config->{"syslogserver"} = 0; # 7.0.716
$pa_config->{"syslog_file"} = '/var/log/messages/'; # 7.0.716
$pa_config->{"syslog_max"} = 65535; # 7.0.716
$pa_config->{"syslog_threads"} = 4; # 7.0.716
@ -803,14 +804,17 @@ sub pandora_load_config {
$pa_config->{"transactional_pool"} = $pa_config->{"incomingdir"} . "/" . $tbuf;
}
}
elsif ($parametro =~ m/^eventserver\s+([0-9]*)/i) {
elsif ($parametro =~ m/^eventserver\s+([0-1])/i) {
$pa_config->{'eventserver'}= clean_blank($1);
}
elsif ($parametro =~ m/^correlationserver\s+([0-9]*)/i) {
$pa_config->{'correlationserver'}= clean_blank($1);
elsif ($parametro =~ m/^eventserver_threads\s+([0-9]*)/i) {
$pa_config->{'eventserver_threads'}= clean_blank($1);
}
elsif ($parametro =~ m/^correlation_threshold\s+([0-9]*)/i) {
$pa_config->{'correlation_threshold'}= clean_blank($1);
elsif ($parametro =~ m/^logserver\s+([0-1])/i) {
$pa_config->{'logserver'}= clean_blank($1);
}
elsif ($parametro =~ m/^logserver_threads\s+([0-9]*)/i) {
$pa_config->{'logserver_threads'}= clean_blank($1);
}
elsif ($parametro =~ m/^icmpserver\s+([0-9]*)/i) {
$pa_config->{'icmpserver'}= clean_blank($1);

View File

@ -313,6 +313,7 @@ our @ServerTypes = qw (
icmpserver
snmpserver
satelliteserver
transactionalserver
mfserver
syncserver
wuxserver
@ -323,6 +324,7 @@ our @ServerTypes = qw (
correlationserver
ncmserver
netflowserver
logserver
);
our @AlertStatus = ('Execute the alert', 'Do not execute the alert', 'Do not execute the alert, but increment its internal counter', 'Cease the alert', 'Recover the alert', 'Reset internal counter');
@ -804,9 +806,9 @@ Process an alert given the status returned by pandora_evaluate_alert.
=cut
##########################################################################
sub pandora_process_alert ($$$$$$$$;$$) {
sub pandora_process_alert ($$$$$$$$;$) {
my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp,
$extra_macros, $is_correlated_alert) = @_;
$extra_macros) = @_;
if (defined ($agent)) {
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
@ -814,15 +816,21 @@ sub pandora_process_alert ($$$$$$$$;$$) {
else {
logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10);
}
# Simple or event alert?
my ($id, $table) = (undef, undef);
if (defined ($alert->{'id_template_module'})) {
$id = $alert->{'id_template_module'};
$table = 'talert_template_modules';
} else {
} elsif (defined ($alert->{'_log_alert'})) {
$id = $alert->{'id'};
$table = 'tlog_alert';
} elsif (defined ($alert->{'_event_alert'})) {
$id = $alert->{'id'};
$table = 'tevent_alert';
} else {
logger($pa_config, "pandora_process_alert received invalid data", 10);
return;
}
# Do not execute
@ -874,10 +882,10 @@ sub pandora_process_alert ($$$$$$$$;$$) {
if ($pa_config->{'alertserver'} == 1 || $pa_config->{'alertserver_queue'} == 1) {
pandora_queue_alert($pa_config, $dbh, [$data, $agent, $module,
$alert, 0, $timestamp, 0, $extra_macros, $is_correlated_alert]);
$alert, 0, $timestamp, 0, $extra_macros]);
} else {
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 0, $dbh,
$timestamp, 0, $extra_macros, $is_correlated_alert);
$timestamp, 0, $extra_macros);
}
return;
}
@ -920,10 +928,10 @@ sub pandora_process_alert ($$$$$$$$;$$) {
if ($pa_config->{'alertserver'} == 1 || $pa_config->{'alertserver_queue'} == 1) {
pandora_queue_alert($pa_config, $dbh, [$data, $agent, $module,
$alert, 1, $timestamp, 0, $extra_macros, $is_correlated_alert]);
$alert, 1, $timestamp, 0, $extra_macros]);
} else {
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 1,
$dbh, $timestamp, 0, $extra_macros, $is_correlated_alert);
$dbh, $timestamp, 0, $extra_macros);
}
return;
}
@ -939,7 +947,7 @@ Execute the given alert.
sub pandora_execute_alert {
my ($pa_config, $data, $agent, $module,
$alert, $alert_mode, $dbh, $timestamp, $forced_alert,
$extra_macros, $is_correlated_alert) = @_;
$extra_macros) = @_;
# 'in-process' events can inhibit alers too.
if ($pa_config->{'event_inhibit_alerts'} == 1 && $alert_mode != RECOVERED_ALERT) {
@ -1029,7 +1037,7 @@ sub pandora_execute_alert {
}
}
# Event alert
else {
elsif (defined($alert->{'_event_alert'})) {
if ($alert_mode == RECOVERED_ALERT) {
@actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, tevent_alert_action.*, talert_actions.*, talert_commands.*
FROM tevent_alert_action, talert_actions, talert_commands
@ -1060,6 +1068,38 @@ sub pandora_execute_alert {
$alert->{'id_alert_action'});
}
}
# Log alert.
elsif (defined($alert->{'_log_alert'})) {
if ($alert_mode == RECOVERED_ALERT) {
@actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, tlog_alert_action.*, talert_actions.*, talert_commands.*
FROM tlog_alert_action, talert_actions, talert_commands
WHERE tlog_alert_action.id_alert_action = talert_actions.id
AND talert_actions.id_alert_command = talert_commands.id
AND tlog_alert_action.id_log_alert = ?
AND ((fires_min = 0 AND fires_max = 0)
OR ? >= fires_min)',
$alert->{'id'}, $alert->{'times_fired'});
} else {
@actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, tlog_alert_action.*, talert_actions.*, talert_commands.*
FROM tlog_alert_action, talert_actions, talert_commands
WHERE tlog_alert_action.id_alert_action = talert_actions.id
AND talert_actions.id_alert_command = talert_commands.id
AND tlog_alert_action.id_log_alert = ?
AND ((fires_min = 0 AND fires_max = 0)
OR (fires_min <= fires_max AND ? >= fires_min AND ? <= fires_max)
OR (fires_min > fires_max AND ? >= fires_min))',
$alert->{'id'}, $alert->{'times_fired'}, $alert->{'times_fired'}, $alert->{'times_fired'});
}
# Get default action
if ($#actions < 0) {
@actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, talert_actions.*, talert_commands.*
FROM talert_actions, talert_commands
WHERE talert_actions.id = ?
AND talert_actions.id_alert_command = talert_commands.id',
$alert->{'id_alert_action'});
}
}
# No actions defined
if ($#actions < 0) {
@ -1148,8 +1188,33 @@ sub pandora_execute_alert {
#If we've spotted an alert recovered, we set the new event's severity to 2 (NORMAL), otherwise the original value is maintained.
my ($text, $event, $severity) = ($alert_mode == RECOVERED_ALERT) ? ('recovered', 'alert_recovered', 2) : ('fired', 'alert_fired', $alert->{'priority'});
if (defined($is_correlated_alert) && $is_correlated_alert == 1) {
$text = "Correlated alert $text";
if (defined($alert->{'_event_alert'})) {
$text = "Event alert $text";
pandora_event (
$pa_config,
"$text (" . safe_output($alert->{'name'}) . ") ",
(defined ($agent) ? $agent->{'id_grupo'} : 0),
# id agent.
0,
$severity,
(defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
# id agent module.
0,
$event,
0,
$dbh,
'monitoring_server',
'',
'',
'',
'',
$critical_instructions,
$warning_instructions,
$unknown_instructions,
p_encode_json($pa_config, $custom_data)
);
} elsif (defined($alert->{'_log_alert'})) {
$text = "Log alert $text";
pandora_event (
$pa_config,
"$text (" . safe_output($alert->{'name'}) . ") ",

View File

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

View File

@ -67,7 +67,6 @@ our @EXPORT = qw(
INVENTORYSERVER
WEBSERVER
EVENTSERVER
CORRELATIONSERVER
ICMPSERVER
SNMPSERVER
SATELLITESERVER
@ -79,6 +78,7 @@ our @EXPORT = qw(
MIGRATIONSERVER
NCMSERVER
NETFLOWSERVER
LOGSERVER
METACONSOLE_LICENSE
OFFLINE_LICENSE
DISCOVERY_HOSTDEVICES
@ -205,9 +205,10 @@ use constant SYSLOGSERVER => 18;
use constant PROVISIONINGSERVER => 19;
use constant MIGRATIONSERVER => 20;
use constant ALERTSERVER => 21;
use constant CORRELATIONSERVER => 22;
use constant CORRELATIONSERVER => 22; # Deprecated.
use constant NCMSERVER => 23;
use constant NETFLOWSERVER => 24;
use constant LOGSERVER => 25;
# Module status
use constant MODULE_NORMAL => 0;
@ -2974,6 +2975,7 @@ sub get_server_name {
return "CORRELATIONSERVER" if ($server_type eq CORRELATIONSERVER);
return "NCMSERVER" if ($server_type eq NCMSERVER);
return "NETFLOWSERVER" if ($server_type eq NETFLOWSERVER);
return "LOGSERVER" if ($server_type eq LOGSERVER);
return "UNKNOWN";
}

View File

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

View File

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

View File

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

View File

@ -26,6 +26,9 @@ use POSIX qw(strftime);
use File::Path qw(rmtree);
use Time::HiRes qw(usleep);
use List::Util qw(min);
use List::Util qw(sum);
# Default lib dir for RPM and DEB packages
BEGIN { push @INC, '/usr/lib/perl5'; }
@ -35,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 231023";
my $version = "7.0NG.773.3 Build 231026";
# Pandora server configuration
my %conf;
@ -443,116 +446,187 @@ sub pandora_purgedb ($$$) {
###############################################################################
# Compact agent data.
###############################################################################
sub pandora_compactdb ($$$) {
my ($conf, $dbh, $dbh_conf) = @_;
sub pandora_compactdb {
my ($conf, $dbh, $dbh_conf) = @_;
my $total_modules = get_db_value($dbh, "SELECT COUNT(id_agente_modulo) FROM tagente_modulo");
# Interval in hours to compact.
my $compaction_interval = 24;
my $compaction_factor = (3600 * $compaction_interval) / 300;
# Number of agents to be proceced on this execution
my $agents_limit = int($total_modules / $compaction_factor);
my $last_compact_offset = pandora_get_config_value($dbh, "last_compact_offset");
unless ($last_compact_offset) {
db_do($dbh, "INSERT INTO tconfig (token, value) VALUES ('last_compact_offset', '0')");
$last_compact_offset = 0;
}
# Obtain a group of modules to compact.
my @module_groups = get_db_rows(
$dbh,
'SELECT id_agente_modulo, id_tipo_modulo, UNIX_TIMESTAMP(last_compact) as last_compact FROM tagente_modulo WHERE id_agente_modulo > ? LIMIT ?',
$last_compact_offset,
$agents_limit
);
# Compact the group of modules.
my $starting_time = time();
pandora_compact_modules($dbh, $conf, @module_groups);
my $ending_time = time();
log_message('COMPACT', "Time taken: " . ($ending_time - $starting_time) . " seconds.");
# Add the offset.
$last_compact_offset += $agents_limit;
# If the offset is higher than the max module start again
$last_compact_offset = 0 if ($last_compact_offset >= $total_modules);
# Save the new offset
db_do($dbh, "UPDATE tconfig SET value = ? WHERE token = 'last_compact_offset'", $last_compact_offset);
}
sub pandora_compact_modules {
my ($dbh, $conf, @module_groups) = @_;
# Obtain the minimun last compact from the block
my $min_compact = min(map { $_->{"last_compact"} } @module_groups);
# if the min has not been setted
if($min_compact == 0){
$min_compact = get_db_value(
$dbh,
'SELECT MIN(td.utimestamp)
FROM tagente_datos td, tagente_modulo tm
WHERE td.id_agente_modulo = tm.id_agente_modulo
AND tm.id_tipo_modulo not in (2, 6, 9, 18, 21, 31, 35, 100)
AND td.id_agente_modulo BETWEEN ? AND ?',
$module_groups[0]->{"id_agente_modulo"}, $module_groups[-1]->{"id_agente_modulo"}
);
}
# One week of data of data as max from the last min compact.
my $max_compact = $min_compact + (60 * 60 * 24 * 7);
# If the last compact is on the future set the current time as max.
$max_compact = time() if($max_compact > time());
log_message('COMPACT', "Compacting data of agents agents $module_groups[0]->{'id_agente_modulo'} to $module_groups[-1]->{'id_agente_modulo'}, data between " . strftime('%Y-%m-%d %H:%M:%S', localtime($min_compact)) . " and " . strftime('%Y-%m-%d %H:%M:%S', localtime($max_compact)));
# Obtain all the data from the interval to avoid multiple requests
# Avoid pull data from modules that should be skipped.
my @data = get_db_rows (
$dbh,
'SELECT td.id_agente_modulo, td.datos, td.utimestamp
FROM tagente_datos td, tagente_modulo tm
WHERE td.id_agente_modulo = tm.id_agente_modulo
AND tm.id_tipo_modulo not in (2, 6, 9, 18, 21, 31, 35, 100)
AND td.utimestamp < ? AND td.utimestamp >= ?
AND td.id_agente_modulo BETWEEN ? AND ?
',
$max_compact, $min_compact, $module_groups[0]->{"id_agente_modulo"}, $module_groups[-1]->{"id_agente_modulo"}
);
my $total_data = scalar(@data);
my $proceced_total_data = 0;
my $progress = 0;
my $compactations = 0;
my %count_hash;
my %id_agent_hash;
my %value_hash;
my %module_proc_hash;
return if ($conf->{'_days_compact'} == 0 || $conf->{'_step_compact'} < 1);
# Convert compact interval length from hours to seconds
my $step = $conf->{'_step_compact'} * 3600;
# The oldest timestamp will be the lower limit
my $limit_utime = get_db_value ($dbh, 'SELECT min(utimestamp) as min FROM tagente_datos');
return unless (defined ($limit_utime) && $limit_utime > 0);
# Max. 168 steps or 7 days in one hour steps.
# This avoids blocking of old modules without last compact
my $step_limit = 24 * 7;
# Calculate the start date
my $start_utime = time() - $conf->{'_days_compact'} * 24 * 60 * 60;
my $last_compact = $start_utime;
my $stop_utime;
# Compact the modules in this block
foreach my $module (@module_groups) {
$progress = $total_data == 0 ? 0 : ($proceced_total_data / $total_data) * 100;
printf(strftime("\r" . "%H:%M:%S", localtime()) . ' [COMPACT] ' . "Progress: %.2f%%", $progress);
my $id = $module->{"id_agente_modulo"};
my $module_type = $module->{"id_tipo_modulo"};
# Do not compact the same data twice!
if (defined ($conf->{'_last_compact'}) && $conf->{'_last_compact'} > $limit_utime) {
$limit_utime = $conf->{'_last_compact'};
}
if ($start_utime <= $limit_utime || ( defined ($conf->{'_last_compact'}) && (($conf->{'_last_compact'} + 24 * 60 * 60) > $start_utime))) {
log_message ('COMPACT', "Data already compacted.");
return;
}
log_message ('COMPACT', "Compacting data from " . strftime ("%Y-%m-%d %H:%M:%S", localtime($limit_utime)) . " to " . strftime ("%Y-%m-%d %H:%M:%S", localtime($start_utime)) . '.', '');
next unless defined ($module_type);
next if ($module_type == 2 || $module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 21 || $module_type == 31 || $module_type == 35 || $module_type == 100);
# Prepare the query to retrieve data from an interval
while (1) {
# Obtain the data just for this module
my @module_data = grep { $_->{"id_agente_modulo"} == $id } @data;
my $total_elements = scalar(@module_data);
# Calculate the stop date for the interval
$stop_utime = $start_utime - $step;
# No data for this module.
next if ($total_elements == 0);
# Out of limits
last if ($start_utime < $limit_utime);
# Obtain the last compact of this module to avoid compact something previously compacted
my $last_compact = $module ->{"last_compact"};
# Mark the progress
log_message ('', ".");
# In case that the last compact has not been defined take the minimun data as last compact
$last_compact = min(map { $_->{"utimestamp"} } @module_data)-1 if($last_compact == 0);
# Create an array to store INSERT commands
my @insert_commands;
my $insert_command = 'INSERT INTO tagente_datos (id_agente_modulo, datos, utimestamp) VALUES (?, ?, ?)';
my $step_number = 0;
my $first_compact = $last_compact;
# Compact using the steps
while($step_number < $step_limit){
my $next_compact = $last_compact + $step;
my @data = get_db_rows ($dbh, 'SELECT * FROM tagente_datos WHERE utimestamp < ? AND utimestamp >= ?', $start_utime, $stop_utime);
# No data, move to the next interval
if ($#data == 0) {
$start_utime = $stop_utime;
last if($next_compact > time());
# Obtain the data between the last compact and the next step.
my @data_in_range = grep { $_->{"utimestamp"} > $last_compact && $_->{"utimestamp"} <= $next_compact } @module_data;
my $total_range_elements = scalar(@data_in_range);
# Nothing to compress, skip this step.
if($total_range_elements == 0){
$last_compact = $next_compact;
next;
}
# Get interval data
foreach my $data (@data) {
my $id_module = $data->{'id_agente_modulo'};
if (! defined($module_proc_hash{$id_module})) {
my $module_type = get_db_value ($dbh, 'SELECT id_tipo_modulo FROM tagente_modulo WHERE id_agente_modulo = ?', $id_module);
next unless defined ($module_type);
my $total_data = sum(map { $_->{"datos"} } @data_in_range);
# Mark proc modules.
if ($module_type == 2 || $module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 21 || $module_type == 31 || $module_type == 35 || $module_type == 100) {
$module_proc_hash{$id_module} = 1;
}
else {
$module_proc_hash{$id_module} = 0;
}
}
my $avg = $total_data / $total_range_elements;
# Skip proc modules!
next if ($module_proc_hash{$id_module} == 1);
$proceced_total_data += $total_range_elements;
push @insert_commands, [$insert_command, $id, $avg, int($last_compact + ($step / 2))];
if (! defined($value_hash{$id_module})) {
$value_hash{$id_module} = 0;
$count_hash{$id_module} = 0;
$last_compact = $next_compact;
$step_number +=1;
# Small sleep to don't burn the DB
usleep (1000);
}
if (! defined($id_agent_hash{$id_module})) {
$id_agent_hash{$id_module} = $data->{'id_agente'};
}
}
$dbh->begin_work;
$value_hash{$id_module} += $data->{'datos'};
$count_hash{$id_module}++;
}
db_do ($dbh, 'DELETE FROM tagente_datos WHERE utimestamp > ? AND utimestamp <= ? AND id_agente_modulo = ?', $first_compact, $last_compact, $id);
# Delete interval from the database
db_do ($dbh, 'DELETE ad FROM tagente_datos ad
INNER JOIN tagente_modulo am ON ad.id_agente_modulo = am.id_agente_modulo AND am.id_tipo_modulo NOT IN (2,6,9,18,21,31,35,100)
WHERE ad.utimestamp < ? AND ad.utimestamp >= ?', $start_utime, $stop_utime);
# Execute the INSERT commands
foreach my $command (@insert_commands) {
my ($sql, @params) = @$command;
db_do($dbh, $sql, @params);
}
# Insert interval average value
foreach my $key (keys(%value_hash)) {
$value_hash{$key} /= $count_hash{$key};
db_do ($dbh, 'INSERT INTO tagente_datos (id_agente_modulo, datos, utimestamp) VALUES (?, ?, ?)', $key, $value_hash{$key}, $stop_utime);
delete($value_hash{$key});
delete($count_hash{$key});
}
usleep (1000); # Very small usleep, just to don't burn the DB
# Move to the next interval
$start_utime = $stop_utime;
$dbh->commit;
# Update the last compacted timestamp.
db_do($dbh, "UPDATE tagente_modulo SET last_compact = FROM_UNIXTIME(?) WHERE id_agente_modulo = ?", $last_compact, $module ->{"id_agente_modulo"});
$compactations += $step_number;
}
log_message ('', "\n");
# Mark the last compact date
if (defined ($conf->{'_last_compact'})) {
db_do ($dbh_conf, 'UPDATE tconfig SET value=? WHERE token=?', $last_compact, 'last_compact');
} else {
db_do ($dbh_conf, 'INSERT INTO tconfig (value, token) VALUES (?, ?)', $last_compact, 'last_compact');
}
printf(strftime("\r" . "%H:%M:%S", localtime()) . ' [COMPACT] ' . "Progress: %.2f%%", 100);
print("\n");
log_message('COMPACT', "A total of $proceced_total_data elements has been compacted into $compactations elements");
}
########################################################################
@ -1234,9 +1308,8 @@ sub pandoradb_main {
# Only active database should be compacted. Disabled for historical database.
# Compact on if enable and DaysCompact are below DaysPurge
if (($conf->{'_onlypurge'} == 0)
&& ($conf->{'_days_compact'} < $conf->{'_days_purge'})
) {
pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh, $dbh);
pandora_compactdb ($conf, $dbh, $dbh);
}
# Update tconfig with last time of database maintance time (now)

View File

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