Merge remote-tracking branch 'origin/develop' into ent-9086-eliminacion-de-la-replicacion-de-eventos-duplicado

This commit is contained in:
Daniel Barbero Martin 2022-06-22 08:48:38 +02:00
commit 9505206328
34 changed files with 101 additions and 53 deletions

View File

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

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
PI_BUILD="220621"
PI_BUILD="220622"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

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

View File

@ -337,7 +337,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Name');
$data[1] = '<input type="text" name="form_name" size=100 value="'.$form_name.'">';
$data[1] = '<input type="text" class="text_input" name="form_name" size=100 value="'.$form_name.'">';
$table->colspan['plugin_name'][1] = 3;
$table->data['plugin_name'] = $data;
@ -399,7 +399,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf" size=100 value="'.$form_execute.'" '.$disabled.'>';
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
@ -411,7 +411,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>';
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
@ -484,13 +484,13 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro'", true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro'", true);
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}

View File

@ -114,11 +114,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
echo "'>";
echo '<tr>
<td class="datos">'.__('Link name').'</td>
<td class="datos"><input type="text" name="name" size="35" value="'.$nombre.'"></td>';
<td class="datos"><input type="text" class="text_input" name="name" size="50" value="'.$nombre.'"></td>';
echo '</tr><tr>
<td class="datos2">'.__('Link').'</td>
<td class="datos2">
<input type="text" name="link" size="50" value="'.$link.'"></td>';
<input type="text" class="text_input" name="link" size="50" value="'.$link.'"></td>';
echo '</tr>';
echo '</table>';
echo "<table width='100%'>";

View File

@ -181,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = [];
$data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
$data[0] .= '<input type="text" class="text_input" name="subject" size="35" value="'.$subject.'" >';
$data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">';

View File

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

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -2364,10 +2364,10 @@ function events_print_event_table(
// Get class name, for the link color, etc.
$data[$i] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
// For System or SNMP generated alerts.
} else if ($event['event_type'] == 'system') {
} else if ($event['event_type'] === 'system') {
$data[$i] = __('System');
} else {
$data[$i] = __('Alert').'SNMP';
$data[$i] = '';
}
$i++;

View File

@ -2690,7 +2690,9 @@ function html_print_input_password(
}
if ($class) {
$attr['class'] = $class;
$attr['class'] = $class.' '.'password_input';
} else {
$attr['class'] = 'password_input';
}
if ($disabled === false) {
@ -2761,7 +2763,9 @@ function html_print_input_text(
}
if ($class != '') {
$attr['class'] = $class;
$attr['class'] = $class.' '.'text_input';
} else {
$attr['class'] = 'text_input';
}
if ($onChange != '') {
@ -4554,7 +4558,7 @@ function html_print_autocomplete_modules(
100,
false,
'',
['style' => 'background: url('.$module_icon.') no-repeat right; '.$text_color.'']
['style' => 'border: none; padding: 2px 5px; margin-bottom: 4px; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$module_icon.') no-repeat right; '.$text_color.'']
);
html_print_input_hidden($name.'_hidden', $id_agent_module);

View File

@ -5900,7 +5900,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
$attrs['style'] = 'padding-right: 20px; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
$attrs['style'] = 'padding-right: 20px; padding: 2px 5px; margin-bottom: 4px; border: none; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -9054,3 +9054,21 @@ div#err_msg_centralised {
padding-top: 15px;
}
}
.text_input {
background-color: transparent !important;
border: none;
border-radius: 0;
border-bottom: 1px solid #ccc;
margin-bottom: 4px;
padding: 2px 5px;
}
.password_input {
background-color: transparent !important;
border: none !important;
border-radius: 0 !important;
border-bottom: 1px solid #ccc !important;
margin-bottom: 4px !important;
padding: 2px 5px !important;
}

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.762
%define release 220621
%define release 220622
# 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.762
%define release 220621
%define release 220622
# 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.762
%define release 220621
%define release 220622
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.762-220621
Version: 7.0NG.762-220622
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.762-220621"
pandora_version="7.0NG.762-220622"
package_cpan=0
package_pandora=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.762";
my $pandora_build = "220621";
my $pandora_build = "220622";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

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

View File

@ -40,6 +40,7 @@ use PandoraFMS::ProducerConsumerServer;
# Inherits from PandoraFMS::ProducerConsumerServer
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
our @EXPORT = qw(start_snmptrapd);
# Global variables
my @TaskQueue :shared;
@ -442,26 +443,29 @@ sub start_snmptrapd ($) {
# Manual start of snmptrapd
if ($config->{'snmp_trapd'} eq 'manual') {
logger ($config, "No SNMP trap daemon configured. Start snmptrapd manually.", 1);
print_message ($config, " [*] No SNMP trap daemon configured. Start snmptrapd manually.", 1);
my $noSNMPTrap = "No SNMP trap daemon configured. Start snmptrapd manually.";
logger ($config, $noSNMPTrap, 1);
print_message ($config, " [*] $noSNMPTrap", 1);
if (! -f $config->{'snmp_logfile'}) {
logger ($config, "SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
print_message ($config, " [E] SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
my $noLogFile = "SNMP log file " . $config->{'snmp_logfile'} . " not found.";
logger ($config, $noLogFile, 1);
print_message ($config, " [E] $noLogFile", 1);
return 1;
}
return 0;
}
if ( -e $pid_file && open (PIDFILE, $pid_file)) {
my $pid = <PIDFILE> + 0;
close PIDFILE;
close PIDFILE;
# Check if snmptrapd is running
if ($snmptrapd_running = kill (0, $pid)) {
logger ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
print_message ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
my $alreadyRunning = "snmptrapd (pid $pid) is already running, attempting to kill it...";
logger ($config, $alreadyRunning, 1);
print_message ($config, " [*] $alreadyRunning ", 1);
kill (9, $pid);
}
}
@ -471,17 +475,20 @@ sub start_snmptrapd ($) {
# Select agent-addr field of the PDU or PDU source address for V1 traps
my $address_format = ($config->{'snmp_pdu_address'} eq '0' ? '%a' : '%b');
my $snmptrapd_args = ' -t -On -n' . $snmp_ignore_authfailure . ' -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file;
$snmptrapd_args .= ' --format1=SNMPv1[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]' . $address_format . '[**]%N[**]%w[**]%W[**]%q[**]%v\\\n';
$snmptrapd_args .= ' --format2=SNMPv2[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%b[**]%v\\\n';
if (system ($config->{'snmp_trapd'} . $snmptrapd_args . " >$DEVNULL 2>&1") != 0) {
logger ($config, " [E] Could not start snmptrapd.", 1);
print_message ($config, " [E] Could not start snmptrapd.", 1);
my $showError = "Could not start snmptrapd.";
logger ($config, $showError, 1);
print_message ($config, " [E] $showError ", 1);
return 1;
}
print_message ($config, " [*] snmptrapd started and running.", 1);
return 0;
}

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.762 Build 220621";
my $version = "7.0NG.762 Build 220622";
# Pandora server configuration
my %conf;

View File

@ -49,11 +49,15 @@
}
/var/log/pandora/pandora_snmptrap.log {
su pandora apache
weekly
missingok
size 500000
rotate 1
maxage 30
notifempty
postrotate
pandora_manage /etc/pandora/pandora_server.conf --start_snmptrapd > /dev/null 2>/dev/null || true
endscript
copytruncate
}

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.762 Build 220621";
my $version = "7.0NG.762 Build 220622";
# save program name for logging
my $progname = basename($0);
@ -231,6 +231,7 @@ sub help_screen{
print "\nTOOLS:\n\n" unless $param ne '';
help_screen_line('--exec_from_file', '<file_path> <option_to_execute> <option_params>', "Execute any CLI option \n\t with macros from CSV file");
help_screen_line('--create_snmp_trap', '<name> <oid> <description> <severity>', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)");
help_screen_line('--start_snmptrapd', '[no parameters needed]', "Start the snmptrap process or restart if it is running");
print "\nSETUP:\n\n" unless $param ne '';
help_screen_line('--set_event_storm_protection', '<value>', "Enable (1) or disable (0) event \n\t storm protection");
@ -279,7 +280,7 @@ sub api_call($$$;$$$$) {
my $ua = new LWP::UserAgent;
my $url = $pa_config->{"console_api_url"};
my $response = $ua->post($url, $params);
if ($response->is_success) {
$content = $response->decoded_content();
}
@ -1188,6 +1189,16 @@ sub cli_enable_group() {
pandora_enable_group ($conf, $dbh, $id_group);
}
##############################################################################
# Start snmptrap process.
# Related option: --start_snmptrapd
##############################################################################
sub cli_start_snmptrapd() {
use PandoraFMS::SNMPServer;
print_log "[INFO] Starting snmptrap process. \n";
PandoraFMS::SNMPServer::start_snmptrapd(\%conf);
}
##############################################################################
# Create an agent.
# Related option: --created_agent
@ -7526,6 +7537,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 1);
cli_enable_group();
}
elsif ($param eq '--start_snmptrapd') {
#param_check($ltotal, 0);
cli_start_snmptrapd();
}
elsif ($param eq '--create_agent') {
param_check($ltotal, 8, 4);
cli_create_agent();