Merge branch 'ent-11126-vulnerability-scanner-interface' into ent-12252-vista-tactica-de-seguridad-vulnerabilidades

This commit is contained in:
Daniel Cebrian 2023-10-31 10:43:02 +01:00
commit 31955b3743
50 changed files with 1289 additions and 741 deletions

View File

@ -54,7 +54,6 @@ if (!$@) {
use constant AGENT_VERSION => '4.0.1';
use constant AGENT_BUILD => '111213';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {
linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'',
@ -117,7 +116,6 @@ my $ConfDir = '';
# Pandora FMS agent configuration file
my $ConfFile = 'pandora_agent.conf';
# Broker agent configuration files
my @BrokerPid;
@ -264,7 +262,6 @@ sub valid_regexp ($) {
sub rmrf {
my $path = shift;
local *DIR;
if (-d $path) {
opendir (DIR, $path) || return;
while (defined (my $file_name = readdir(DIR))) {
@ -348,7 +345,6 @@ sub log_message ($$;$) {
}
}
}
################################################################################
# Add the given directory to the PATH.
################################################################################
@ -582,7 +578,6 @@ sub write_broker_conf($){
}
while (my $line = <CONF_FILE>){
# Skip broker definitions
if ($line =~ m/^\s*broker_agent/) {
next;
@ -1810,7 +1805,6 @@ sub exec_plugin ($) {
$Sem->down () if (defined ($Sem));
$Xml .= $output;
$Sem->up () if (defined ($Sem));
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
}
@ -2287,4 +2281,4 @@ This is released under the GNU Lesser General Public License.
Copyright (c) 2005-2023 Pandora FMS
=cut
=cut

View File

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

@ -316,3 +316,12 @@ module_plugin autodiscover --default
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca -t 150
#module_absoluteinterval 7d
#module_end
# Logs extraction
#module_begin
#module_name Syslog
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -39,6 +39,14 @@ BEGIN {
use File::Copy;
use Scalar::Util qw(looks_like_number);
use File::Basename;
BEGIN {
eval {
require MIME::Base64;
};
}
BEGIN { push @INC, '/usr/lib/perl5'; }
################################################################################
@ -1031,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3';
use constant AGENT_BUILD => '231026';
use constant AGENT_BUILD => '231031';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1562,6 +1570,9 @@ sub parse_conf_modules($) {
} elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) {
$module->{'func'} = \&module_occupiedpercentdisk;
$module->{'params'} = $1;
}elsif ($line =~ /^\s*module_regexp\s+(.*)$/) {
$module->{'func'} = \&module_logger;
$module->{'params'} = $1;
} elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) {
$module->{'max'} = $1;
} elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) {
@ -1817,7 +1828,11 @@ sub parse_conf_modules($) {
# Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2;
# Regexp
}
elsif ($line =~ /^\s*module_pattern(\S+)\s+(.*)\s*$/) {
$module->{'filter'} = $1;
}
}
return;
}
@ -3663,6 +3678,11 @@ sub write_module_xml ($@) {
return;
}
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
}
# Critical section
$Sem->down () if (defined ($Sem));
@ -3860,6 +3880,237 @@ sub module_plugin ($) {
return ($output);
}
################################################################################
# Read the logs
################################################################################
sub module_logger ($) {
my $module = shift;
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
);
return $status;
}
my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_base64 : sub {
my ($str, $endl) = @_;
my @ALPHABET = ('A'..'Z', 'a'..'z', 0..9, '+', '/');
my $str_len = length($str);
my $str_base64 = '';
for (my $i = 0; $i < $str_len; $i += 3) {
my $chunk = substr($str, $i, 3);
my $chunk_len = length($chunk);
my $num = 0;
$num |= ord(substr($chunk, 0, 1)) << 16 if ($chunk_len >= 1);
$num |= ord(substr($chunk, 1, 1)) << 8 if ($chunk_len >= 2);
$num |= ord(substr($chunk, 2, 1)) if ($chunk_len == 3);
my $enc_1 = ($num & 0xfc0000) >> 18;
my $enc_2 = ($num & 0x03f000) >> 12;
my $enc_3 = ($num & 0x000fc0) >> 6;
my $enc_4 = ($num & 0x00003f);
$str_base64 .= $ALPHABET[$enc_1];
$str_base64 .= $ALPHABET[$enc_2];
$str_base64 .= $chunk_len >= 2 ? $ALPHABET[$enc_3] : '=';
$str_base64 .= $chunk_len == 3 ? $ALPHABET[$enc_4] : '=';
}
return $str_base64;
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
if(!$str_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
}
my $idx_dir = '/tmp/';
my $idx_file = '';
my $idx_pos = 0;
my $idx_size = 0;
my $idx_ino = '';
my $module_name = $str_name;
my $log_file = $str_file;
my $reg_exp = $str_regex;
# Check that log file exists
if (! -e $log_file) {
log_message("module_logger", "File $log_file does not exist");
return;
}
# Create index file storage directory
if (! -d $idx_dir) {
if (!mkdir($idx_dir)){
log_message("module_logger", "Error creating directory $idx_dir: " . $!);
return;
}
}
# Create index file if it does not exist
$idx_file = $idx_dir.$module_name."_".basename($log_file).".idx";
if (! -e $idx_file) {
return if create_idx(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$idx_size) == 1;
return
} else{
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
my $output = create_log($module_name, @data);
return $output;
}
# Start the function definition
sub create_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $idx_size_ref) = @_;
my $first_line;
log_message("module_logger", "Creating index file $$idx_file_ref");
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: ".$!);
return 1;
}
# Go to EOF and save the position
seek(LOGFILE, 0, 2);
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the file inode number
$$idx_ino_ref = (stat($$log_file_ref))[1];
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return 0;
}
sub save_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
log_message("module_logger", "Saving index file $$idx_file_ref");
if (!open(IDXFILE, "> $$idx_file_ref")){
log_message("module_logger", "Error opening file $$idx_file_ref: ". $!);
return 1;
}
print (IDXFILE $$idx_pos_ref . " " . $$idx_ino_ref . " " . $$idx_size_ref);
close(IDXFILE);
return 0;
}
sub load_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
my $line;
my $current_ino;
my $current_size;
log_message("module_logger", "Loading index file $$idx_file_ref");
if (!open(IDXFILE, $$idx_file_ref)){
log_message("module_logger", "Error opening file $$idx_file_ref: " .$!);
return 1;
}
# Read position and date
$line = <IDXFILE>;
($$idx_pos_ref, $$idx_ino_ref, $$idx_size_ref) = split(' ', $line);
close(IDXFILE);
# Reset the file index if the file has changed
$current_ino = (stat($$idx_file_ref))[1];
$current_size = -s "$$idx_file_ref";
if ($current_ino != $$idx_ino_ref || $current_size < $$idx_size_ref) {
log_message("module_logger", "File changed, resetting index");
$$idx_pos_ref = 0;
$$idx_ino_ref = $current_ino;
}
$$idx_size_ref = $current_size;
return 0;
}
sub parse_log {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $module_name_ref, $reg_exp_ref, $idx_size_ref) = @_;
my $line;
log_message("module_logger", "Parsing log file $$log_file_ref");
# Open log file for reading
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: " . $!);
return 1;
}
# Go to starting position.
seek(LOGFILE, $$idx_pos_ref, 0);
# Parse log file
my @data;
while ($line = <LOGFILE>) {
if ($line =~ m/$$reg_exp_ref/i) {
push (@data, $line);
}
}
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the index file
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return @data;
}
sub create_log($$){
my ($module_name, @data) = @_;
# No data
if ($#data < 0) {
return;
}
# Log module
my $output = "<log_module>\n";
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
$output .= "<encoding>base64</encoding>\n";
$output .= "<data><![CDATA[";
$output .= &$encode_sub(join('', @data), '');
$output .= "]]></data>\n";
$output .= "</log_module>\n";
return $output;
}
}
################################################################################
# TERM Handler
################################################################################
@ -4030,6 +4281,7 @@ sub init_module ($) {
$module->{'module_ff_interval'} = undef;
$module->{'macros'} = {};
$module->{'alert_template'} = undef;
$module->{'filter'} = undef;
}
################################################################################

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 231026
%define release 231031
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 231026
%define release 231031
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 231026
%define release 231031
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -530,3 +530,11 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
#module_absoluteinterval 7d
#module_end
# Logs extraction
#module_begin
#module_name X_Server_log
#module_description Logs extraction module
#module_type log
#module_regexp C:\server\logs\xserver.log
#module_pattern .*
#module_end

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231026}
{231031}
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 231026")
#define PANDORA_VERSION ("7.0NG.773.3 Build 231031")
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 231026))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 231031))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-231026
Version: 7.0NG.773.3-231031
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-231026"
pandora_version="7.0NG.773.3-231031"
package_pear=0
package_pandora=1

View File

@ -160,6 +160,9 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE tagente_modulo ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE tpolicy_modules ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE talert_templates
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
@ -164214,10 +164217,87 @@ UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_aler
ALTER TABLE `tnetwork_explorer_filter`
MODIFY COLUMN `id` INT NOT NULL AUTO_INCREMENT;
-- Add messaging alerts
SET @command_name = 'Pandora&#x20;Google&#x20;chat';
SET @action_name = 'Pandora&#x20;Google&#x20;chat';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-gchat-cli&#x20;-u&#x20;&quot;_field1_&quot;&#x20;-d&#x20;&quot;_field2_&quot;&#x20;-t&#x20;&quot;_field3_&quot;&#x20;-D&#x20;&quot;_field4_&quot;', 'Send&#x20;messages&#x20;using&#x20;Google&#x20;chat&#x20;API', 0, '["Google&#x20;chat&#x20;webhook&#x20;URL","Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Title","Description"]', '["","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Slack';
SET @action_name = 'Pandora&#x20;Slack';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-slack-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-d&#x20;&quot;_field1_&quot;&#x20;-c&#x20;&quot;_field2_&quot;&#x20;-e&#x20;&quot;_field3_&quot;&#x20;-T&#x20;&quot;_field4_&quot;&#x20;-D&#x20;&quot;_field5_&quot;', 'Send&#x20;messages&#x20;using&#x20;Slack&#x20;API', 0, '["Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Slack&#x20;channel&#x20;id/name","Title&#x20;emoji","Title","Description"]', '["","",":red_circle:,Red&#x20;circle;:green_circle:,Green&#x20;circle","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Telegram';
SET @action_name = 'Pandora&#x20;Telegram';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-telegram-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-c&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;messages&#x20;using&#x20;Telegram&#x20;API', 0, '["Chat&#x20;ID","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;ilert';
SET @action_name = 'Pandora&#x20;ilert';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_ilert&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-t&#x20;&quot;_field1_&quot;&#x20;-k&#x20;&quot;_field2_&quot;&#x20;-T&#x20;&quot;_field3_&quot;&#x20;-d&#x20;&quot;_field4_&quot;&#x20;-A&#x20;&quot;_agentname_&quot;&#x20;-m&#x20;&quot;_module_&quot;&#x20;-p&#x20;&quot;_alert_text_severity_&quot;&#x20;-D&#x20;&quot;_data_&quot;&#x20;-C&#x20;&quot;_timestamp_&quot;', 'Send&#x20;SMS&#x20;using&#x20;ilert&#x20;API:&#x20;https://docs.ilert.com/integrations/pandorafms/', 0, '["Event&#x20;type","Event&#x20;title","Title","Description"]', '["alert,Alert;resolved,Resolved","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Vonage';
SET @action_name = 'Pandora&#x20;Vonage';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_vonage&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-s&#x20;&quot;SECRET&quot;&#x20;-f&#x20;&quot;FROM_ALIAS&quot;&#x20;-n&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;SMS&#x20;using&#x20;Vonage&#x20;API:&#x20;https://www.vonage.com/communications-apis/sms/', 0, '["Phone&#x20;number","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
-- Insert new Pandora vulscan APP
SET @short_name = 'pandorafms.vulnscan';
SET @name = 'Vulnerability&#x20;Scanner';
SET @section = 'cloud';
SET @section = 'app';
SET @description = 'Pandora&#x20;FMS&#x20;Vulnerability&#x20;Scanner.&#x20;Scans&#x20;the&#x20;network&#x20;looking&#x20;for&#x20;known&#x20;software&#x20;vulnerabilities.';
SET @version = '1.0';
@ -164225,7 +164305,7 @@ INSERT IGNORE INTO tdiscovery_apps (id_app, short_name, name, section, descripti
SELECT @id_app := id_app FROM tdiscovery_apps WHERE short_name = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO tdiscovery_apps_scripts (id_app, macro, value) VALUES (@id_app, '_exec1_', 'pandora_vulnscan.py');
INSERT IGNORE INTO tdiscovery_apps_scripts (id_app, macro, value) VALUES (@id_app, '_exec1_', 'bin/pandora_vulnscan');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO tdiscovery_apps_executions (id_app, execution) VALUES (@id_app, '&#039;_exec1_&#039;&#x20;&#039;__pandoraServerConf__&#039;&#x20;&#039;_agentGroups_&#039;&#x20;-t&#x20;_numThreads_');

View File

@ -1339,6 +1339,12 @@ if ($update_module === true || $create_module === true) {
*/
$post_process = (string) get_parameter('post_process', 0.0);
if (modules_made_compatible($id_module_type) === true) {
$made_enabled = (bool) get_parameter_checkbox('made_enabled', 0);
} else {
$made_enabled = false;
}
$prediction_module = (int) get_parameter('prediction_module');
$max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries');
@ -1733,6 +1739,7 @@ if ($update_module) {
'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin,
'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout,
'max_retries' => $max_retries,
@ -1931,6 +1938,7 @@ if ($create_module) {
'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin,
'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout,
'max_retries' => $max_retries,

View File

@ -294,6 +294,7 @@ if ($id_agent_module) {
$plugin_parameter = $module['plugin_parameter'];
$id_plugin = $module['id_plugin'];
$post_process = $module['post_process'];
$made_enabled = $module['made_enabled'];
$prediction_module = $module['prediction_module'];
$custom_integer_1 = $module['custom_integer_1'];
$custom_integer_2 = $module['custom_integer_2'];
@ -408,6 +409,7 @@ if ($id_agent_module) {
$id_module_group = 1;
$id_module_type = 1;
$post_process = '';
$made_enabled = false;
$max_timeout = 0;
$max_retries = 0;
$min = '';

View File

@ -916,7 +916,24 @@ $table->data[17][0] = html_print_label_input_block(
)
);
$table->data[17][1] = html_print_label_input_block(
$table->data['made_enabled'][1] = html_print_label_input_block(
__('MADE enabled').ui_print_help_tip(
__('By activating this option, the module data will be processed by the MADE engine (if active), and events will be generated automatically by the IA engine'),
true
),
html_print_checkbox_switch(
'made_enabled',
1,
false,
true,
false,
'',
false,
'wp100 static'
)
);
$table->data[17][2] = html_print_label_input_block(
__('SNMP community'),
html_print_input_text(
'snmp_community',
@ -1653,7 +1670,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide();
var params = {
@ -1728,7 +1746,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").show ();
switch($('#module_type').val()) {
@ -1838,7 +1857,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide ();
$('input[type=checkbox]').attr('checked', false);
$('input[type=checkbox]').attr('disabled', true);
@ -1877,7 +1897,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").show();
}
else {
@ -1908,7 +1929,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide();
}
}
@ -1932,6 +1954,9 @@ $(document).ready (function () {
else if (this.id == "checkbox-dynamic_two_tailed") {
return; //Do none
}
else if (this.id == "checkbox-made_enabled") {
return; //Do none
}
else {
if (this.id == "checkbox-force_group") {
$("#checkbox-recursion").prop("checked", false);
@ -1964,7 +1989,7 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-40").show ();
}
else {
@ -1995,7 +2020,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide();
}
}
@ -2085,7 +2111,8 @@ $(document).ready (function () {
"tr#delete_table-36, " +
"tr#delete_table-37, " +
"tr#delete_table-38, " +
"tr#delete_table-39, " +
"tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide();
jQuery.post ("ajax.php",
@ -2315,6 +2342,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
'module_interval',
'disabled',
'post_process',
'made_enabled',
'unit_select',
'snmp_community',
'snmp_oid',
@ -2626,6 +2654,10 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$values['macros'] = json_encode($module_macros);
}
if (modules_made_compatible($module['id_tipo_modulo']) === false) {
$values['made_enabled'] = 0;
}
$result = modules_update_agent_module(
$module['id_agente_modulo'],
$values,

View File

@ -1932,33 +1932,8 @@ if (is_metaconsole() === true) {
<td class="bolder"><?php echo __('Source'); ?></td>
<td >
<?php
$agents = agents_get_group_agents($group);
if ((empty($agents)) || $agents == -1) {
$agents = [];
}
$sql_log = 'SELECT source AS k, source AS v
FROM tagente,tagent_module_log
WHERE tagente.id_agente = tagent_module_log.id_agent
AND tagente.disabled = 0';
if (!empty($agents)) {
$index = 0;
foreach ($agents as $key => $a) {
if ($index == 0) {
$sql_log .= ' AND (id_agente = '.$key;
} else {
$sql_log .= ' OR id_agente = '.$key;
}
$index++;
}
$sql_log .= ')';
}
html_print_select_from_sql(
$sql_log,
html_print_select(
[],
'source',
$source,
'onselect=source_change_agents();',
@ -1966,7 +1941,7 @@ if (is_metaconsole() === true) {
'',
false,
false,
false
false,
);
?>
</td>
@ -6702,68 +6677,41 @@ function loadGeneralAgents(agent_group) {
function loadLogAgents() {
var params = [];
params.push("get_log_agents=1");
params.push("source=<?php echo $source; ?>");
params.push('id_agents=<?php echo json_encode($id_agents); ?>');
params.push("page=include/ajax/reporting.ajax");
let source = '<?php echo $source; ?>';
let agent = '<?php echo json_encode($id_agents); ?>';
agent = JSON.parse(agent);
$('#id_agents3')
.find('option')
.remove();
var params = {};
params["get_agent_source"] = 1;
params["log_alert"] = 1;
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
$('#id_agents3')
.append('<option>Loading agents...</option>');
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
timeout: 300000,
dataType: 'json',
success: function (data) {
if (data['correct']) {
$('#id_agents3')
.find('option')
.remove();
var selectElements = [];
var selectedStr = 'selected="selected"';
if (data['select_agents'] === null) {
return;
}
if (Array.isArray(data['select_agents'])) {
data['select_agents'].forEach(function(agentAlias, agentID) {
var optionAttr = '';
if (typeof data['agents_selected'][agentID] !== 'undefined') {
optionAttr = ' selected="selected"';
}
$('#id_agents3')
.append('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
});
jQuery.ajax({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
async: true,
success: function(data) {
$('#id_agents3')
.find('option')
.remove();
$.each(data['source'],function(key,value) {
if (value === source) {
$('#source').append( `<option selected='selected' value='${key}'>${value}</option>`);
} else {
for (const [agentID, agentAlias] of Object.entries(data['select_agents'])) {
var optionAttr = '';
if (typeof data['agents_selected'][agentID] !== 'undefined') {
optionAttr = ' selected="selected"';
}
$('#id_agents3')
.append('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
}
$('#source').append( `<option value='${key}'>${value}</option>`);
}
}
});
$.each(data['agent'],function(key,value) {
const result = agent.includes(key);
if (result === true) {
$('#id_agents3').append( `<option selected='selected' value='${key}'>${value}</option>`);
} else {
$('#id_agents3').append( `<option value='${key}'>${value}</option>`);
}
});
}
});
}
@ -7948,23 +7896,46 @@ function set_last_value_period() {
}
function source_change_agents() {
$("#id_agents3").empty();
$("#spinner_hack").show();
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_source_json" : 1,
"source" : $("#source").val()
},
function (data, status) {
for (var clave in data) {
$("#id_agents3").append(
'<option value="'+clave+'">'+data[clave]+'</option>'
);
const source = $("#source").val();
if (source === '') {
$("#id_agents3 option[value!=0]").attr("style","display:");
} else {
$("#spinner_hack").show();
$("#id_agents3 option").attr("style","display:none");
var params = {};
params["get_agent_source"] = 1;
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
jQuery.ajax({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
async: true,
success: function(data) {
let source_array = [];
$.each(data['source'],function(key,value) {
if (value === source) {
const split = key.split('-');
source_array.push(split[1]);
}
});
$.each(data['agent'],function(key,value) {
const result = source_array.includes(key);
if (result === true) {
$(`#id_agents3 option[value*='${key}']`).attr("style","display:");
}
});
$("#spinner_hack").hide();
},
error: function(error){
$("#spinner_hack").hide();
}
$("#spinner_hack").hide();
},
"json"
);
});
}
}
function dialog_message(message_id) {

View File

@ -151,6 +151,10 @@ if (isset($_GET['server']) === true) {
$title .= __('Netflow server').' ID: '.$id_server;
break;
case SERVER_TYPE_MADE:
$title .= __('MADE server').' ID: '.$id_server;
break;
default:
$title = __('Update server').' ID: '.$id_server;
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Anomaly detection@svg</title>
<g id="Anomaly-detection" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Dark-/-20-/-details">
<g id="Group">
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
<line x1="14" y1="14" x2="18" y2="18" id="Path-9" stroke="#3F3F3F" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></line>
<circle id="Oval" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" cx="8" cy="8" r="7"></circle>
</g>
<path d="M2,11 C2,11 3.33333333,11 6,11 C7.33333333,7 8,5 8,5 C8,5 8.66666667,7 10,11 L14,11" id="Path" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1013 B

View File

@ -483,6 +483,13 @@ if (check_login()) {
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
$made_enabled = db_get_value_filter(
'made_enabled',
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
$unit = db_get_value_filter(
'unit',
'tagente_modulo',

View File

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

View File

@ -442,6 +442,7 @@ define('SERVER_TYPE_CORRELATION', 22);
define('SERVER_TYPE_NCM', 23);
define('SERVER_TYPE_NETFLOW', 24);
define('SERVER_TYPE_LOG', 25);
define('SERVER_TYPE_MADE', 26);
// REPORTS.
define('REPORT_TOP_N_MAX', 1);

View File

@ -4762,3 +4762,31 @@ function export_agents_module_csv($filters)
return $result;
}
/**
* Check if modules are compatible with MADE server.
*
* @param integer $id_tipo_modulo
* @retur boolean True if compatible, false otherwise.
*/
function modules_made_compatible($id_tipo_modulo)
{
$compatible_types = [
1,
4,
5,
8,
15,
16,
22,
30,
34,
];
if (array_search($id_tipo_modulo, $compatible_types) === false) {
return false;
} else {
return true;
}
}

View File

@ -992,6 +992,19 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
$id_modulo = 0;
break;
case SERVER_TYPE_MADE:
$server['img'] = html_print_image(
'images/Anomaly-detection@svg.svg',
true,
[
'title' => __('MADE server'),
'class' => 'main_menu_icon invert_filter',
]
);
$server['type'] = 'made';
$id_modulo = 0;
break;
default:
$server['img'] = '';
$server['type'] = 'unknown';

View File

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

View File

@ -321,6 +321,15 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
}
}
});
<?php if ($force_instant_logout === true) { ?>
// No click enabled when user not logged.
$( "a" ).on( "click", function( event ) {
event.preventDefault();
$('#visual-console-container').removeClass('is-updating');
$('.div-visual-console-spinner').remove();
});
<?php } ?>
</script>
<?php
if ($force_instant_logout === true) {

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 231026
%define release 231031
# 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 231026
%define release 231031
# 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 231026
%define release 231031
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -278,6 +278,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`quiet_by_downtime` TINYINT NOT NULL DEFAULT 0,
`disabled_by_downtime` TINYINT NOT NULL DEFAULT 0,
`last_compact` TIMESTAMP NOT NULL DEFAULT 0,
`made_enabled` TINYINT UNSIGNED DEFAULT 0,
PRIMARY KEY (`id_agente_modulo`),
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
KEY `tam_agente` (`id_agente`),
@ -2543,6 +2544,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
`percentage_warning` TINYINT UNSIGNED DEFAULT 0,
`percentage_critical` TINYINT UNSIGNED DEFAULT 0,
`warning_time` INT UNSIGNED DEFAULT 0,
`made_enabled` TINYINT UNSIGNED DEFAULT 0,
PRIMARY KEY (`id`),
KEY `main_idx` (`id_policy`),
UNIQUE (`id_policy`, `name`)

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773.3-231026
Version: 7.0NG.773.3-231031
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-231026"
pandora_version="7.0NG.773.3-231031"
package_cpan=0
package_pandora=1

View File

@ -783,3 +783,33 @@ netflowserver_threads 1
# Enable (1) or disable (0) the verification of SSL certificates (set to 0 when using self-signed certificates).
ssl_verify 0
# Enable (1) or disable (0) the Monitoring Anomaly Detection Engine (PANDORA FMS ENTERPRISE ONLY).
madeserver 0
# Directory where models will be stored (PANDORA FMS ENTERPRISE ONLY).
madeserver_path /var/spool/pandora/data_in/models
# Number of server threads for MADE (PANDORA FMS ENTERPRISE ONLY).
madeserver_threads 2
# Model backend: 'prophet' or 'iforest' (PANDORA FMS ENTERPRISE ONLY).
# 'prophet' is better suited for temporal series and supports forecasting.
# 'iforest' is faster and more efficient (cpu, memory...).
madeserver_backend prophet
# MADE will query the Pandora FMS database every madeserver_interval seconds
# to look for new data (PANDORA FMS ENTERPRISE ONLY).
madeserver_interval 60
# Minimum number of data required to train a model (e.g., '7d' for seven days) (PANDORA FMS ENTERPRISE ONLY).
madeserver_min_train 7d
# Maximum number of data kept to train models (e.g., '90d' for 90 days) (PANDORA FMS ENTERPRISE ONLY).
madeserver_max_history 90d
# Model automatic retraining period (e.g., '7d' for seven days) (PANDORA FMS ENTERPRISE ONLY).
madeserver_autofit 7d
# Model sensitivity. A lower value triggers less anomalies (PANDORA FMS ENTERPRISE ONLY).
madeserver_sensitivity 0.1

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 = "231026";
my $pandora_build = "231031";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -586,6 +586,8 @@ sub pandora_load_config {
$pa_config->{"ssl_verify"} = 0; # 7.0 774
$pa_config->{"madeserver"} = 0; # 774.
# Check for UID0
if ($pa_config->{"quiet"} != 0){
if ($> == 0){
@ -1403,6 +1405,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^ssl_verify\s+([0-1])/i) {
$pa_config->{'ssl_verify'} = clean_blank($1);
}
elsif ($parametro =~ m/^madeserver\s+([0-1])/i){
$pa_config->{'madeserver'}= clean_blank($1);
}
} # end of loop for parameter #
# The DB host was overridden by pandora_ha.

View File

@ -325,6 +325,7 @@ our @ServerTypes = qw (
ncmserver
netflowserver
logserver
madeserver
);
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');
@ -6739,24 +6740,23 @@ sub pandora_installation_monitoring($$) {
my $data_size = get_db_value($dbh, 'SELECT SUM(data_length)/(1024*1024) FROM information_schema.TABLES');
my $index_size = get_db_value($dbh, 'SELECT SUM(index_length)/(1024*1024) FROM information_schema.TABLES');
my $writes = $insert->{'Value'} + $update->{'Value'} + $replace->{'Value'} + $delete->{'Value'} ;
my $reads = $select->{'Value'};
# Mysql Questions - Reads
$module->{'name'} = "mysql_questions_reads";
$module->{'description'} = 'MySQL: Questions - Reads (#): Number of read questions';
$module->{'data'} = $select->{'Value'};
$module->{'unit'} = 'qu';
$module->{'data'} = $reads;
$module->{'unit'} = 'qu/s';
$module->{'type'} = 'generic_data_inc';
push(@modules, $module);
undef $module;
# Mysql Questions - Writes
my $question_writes = 0;
if(($writes + $select) > 0) {
$question_writes = (($writes * 10000) / ($select + $writes)) / 100;
}
$module->{'name'} = "mysql_questions_writes";
$module->{'description'} = 'MySQL: Questions - Writes (#): Number of writed questions';
$module->{'data'} = $question_writes;
$module->{'unit'} = 'qu';
$module->{'data'} = $writes;
$module->{'unit'} = 'qu/s';
$module->{'type'} = 'generic_data_inc';
push(@modules, $module);
undef $module;
@ -6896,7 +6896,7 @@ sub pandora_installation_monitoring($$) {
$dbh,
'SELECT COUNT(id_evento)
FROM tevento
WHERE timestamp >=UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY)'
WHERE utimestamp >=UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY)'
);
$module->{'name'} = "last_events_24h";
$module->{'description'} = 'Last 24h events';

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 = "231026";
my $pandora_build = "231031";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -79,6 +79,7 @@ our @EXPORT = qw(
NCMSERVER
NETFLOWSERVER
LOGSERVER
MADESERVER
METACONSOLE_LICENSE
OFFLINE_LICENSE
DISCOVERY_HOSTDEVICES
@ -209,6 +210,7 @@ use constant CORRELATIONSERVER => 22; # Deprecated.
use constant NCMSERVER => 23;
use constant NETFLOWSERVER => 24;
use constant LOGSERVER => 25;
use constant MADESERVER => 26;
# Module status
use constant MODULE_NORMAL => 0;
@ -2976,6 +2978,7 @@ sub get_server_name {
return "NCMSERVER" if ($server_type eq NCMSERVER);
return "NETFLOWSERVER" if ($server_type eq NETFLOWSERVER);
return "LOGSERVER" if ($server_type eq LOGSERVER);
return "MADESERVER" if ($server_type eq MADESERVER);
return "UNKNOWN";
}

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 231026
%define release 231031
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 231026
%define release 231031
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 231026";
my $version = "7.0NG.773.3 Build 231031";
# Pandora server configuration
my %conf;

View File

@ -168,6 +168,7 @@ sub ha_load_pandora_conf($) {
$conf->{'pandora_service_cmd'} = 'service pandora_server' unless defined($conf->{'pandora_service_cmd'});
$conf->{'tentacle_service_cmd'} = 'service tentacle_serverd' unless defined ($conf->{'tentacle_service_cmd'});
$conf->{'tentacle_service_watchdog'} = 1 unless defined ($conf->{'tentacle_service_watchdog'});
$conf->{'made_service_cmd'} = 'service pandora_made' unless defined($conf->{'made_service_cmd'});
}
##############################################################################
@ -257,6 +258,31 @@ sub ha_keep_pandora_running($$) {
}
}
##############################################################################
# Keep MADE running
##############################################################################
sub ha_keep_made_running($$) {
my ($conf, $dbh) = @_;
# Is MADE enabled?
return unless (defined($conf->{'madeserver'}) && $conf->{'madeserver'} == 1);
# Is MADE installed?
`$conf->{'made_service_cmd'} status 2>/dev/null`;
if (($? >> 8) == 4) {
log_message($conf, 'LOG', "Pandora FMS MADE is not installed.");
return;
}
# Try to get the PID of the service.
my $pid = `systemctl show --property MainPID pandora_made | cut -d= -f2`;
chomp($pid);
if ($pid eq "0") {
log_message($conf, 'LOG', 'MADE service not running.');
`$conf->{'made_service_cmd'} start 2>/dev/null`;
}
}
##############################################################################
# Keep the Tentacle server running
##############################################################################
@ -535,6 +561,9 @@ sub ha_main_pacemaker($) {
# Keep Tentacle running
ha_keep_tentacle_running($conf, $dbh);
# Keep MADE running
ha_keep_made_running($conf, $dbh);
# Are we the master?
pandora_set_master($conf, $dbh);
if (!pandora_is_master($conf)) {
@ -627,6 +656,9 @@ sub ha_main_pandora($) {
# Keep Tentacle running
ha_keep_tentacle_running($conf, $dbh);
# Keep MADE running
ha_keep_made_running($conf, $dbh);
# Are we the master?
pandora_set_master($conf, $dbh);
if (!pandora_is_master($conf)) {

View File

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