Merge remote-tracking branch 'origin/develop' into ent-8075-Informe-de-acciones-de-alerta

This commit is contained in:
Daniel Barbero Martin 2021-11-26 08:16:46 +01:00
commit 9b62aa11da
25 changed files with 108 additions and 61 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.758.1-211125 Version: 7.0NG.758.1-211126
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.758.1" PI_VERSION="7.0NG.758.1"
PI_BUILD="211125" PI_BUILD="211126"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{211125} {211126}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.758.1-211125 Version: 7.0NG.758.1-211126
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.758.1-211125 Version: 7.0NG.758.1-211126
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.758.1 Build 211125"; my $version = "7.0NG.758.1 Build 211126";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -343,6 +343,23 @@ sub update_conf_txt ($$$$) {
return $result; return $result;
} }
###############################################################################
###############################################################################
# PRINT HELP AND CHECK ERRORS FUNCTIONS
###############################################################################
###############################################################################
###############################################################################
# log wrapper
###############################################################################
sub print_log ($) {
my ($msg) = @_;
print $msg; # show message
$msg =~ s/\n+$//;
logger( $conf, "($progname) $msg", 10); # save to logging file
}
############################################################################### ###############################################################################
# Disable a entire group # Disable a entire group
@ -353,6 +370,11 @@ sub pandora_disable_group ($$$) {
my @agents_bd = []; my @agents_bd = [];
my $result = 0; my $result = 0;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To disable a group go to metaconsole. \n\n";
exit;
}
if ($group == 0){ if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0. # Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
@ -390,6 +412,11 @@ sub pandora_enable_group ($$$) {
my @agents_bd = []; my @agents_bd = [];
my $result = 0; my $result = 0;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To enable a group go to metaconsole. \n\n";
exit;
}
if ($group == 0){ if ($group == 0){
# Extract all the names of the pandora agents if it is for all = 0. # Extract all the names of the pandora agents if it is for all = 0.
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente'); @agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
@ -510,8 +537,12 @@ sub cli_create_snmp_trap ($$) {
sub pandora_create_user ($$$$$) { sub pandora_create_user ($$$$$) {
my ($dbh, $name, $password, $is_admin, $comments) = @_; my ($dbh, $name, $password, $is_admin, $comments) = @_;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To create a user go to metaconsole. \n\n";
exit;
}
return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, password, comments, is_admin) return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, password, comments, is_admin)
VALUES (?, ?, ?, ?, ?)', safe_input($name), safe_input($name), $password, safe_input($comments), $is_admin); VALUES (?, ?, ?, ?, ?)', safe_input($name), safe_input($name), $password, safe_input($comments), $is_admin);
} }
@ -521,18 +552,23 @@ return db_insert ($dbh, 'id_user', 'INSERT INTO tusuario (id_user, fullname, pas
sub pandora_delete_user ($$) { sub pandora_delete_user ($$) {
my ($dbh, $name) = @_; my ($dbh, $name) = @_;
# Delete user profiles if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario = ?', $name); print_log "[ERROR] This node is configured with centralized mode. To delete a user go to metaconsole. \n\n";
exit;
}
# Delete the user # Delete user profiles
my $return = db_do ($dbh, 'DELETE FROM tusuario WHERE id_user = ?', $name); db_do ($dbh, 'DELETE FROM tusuario_perfil WHERE id_usuario = ?', $name);
if($return eq '0E0') { # Delete the user
return -1; my $return = db_do ($dbh, 'DELETE FROM tusuario WHERE id_user = ?', $name);
}
else { if($return eq '0E0') {
return 0; return -1;
} }
else {
return 0;
}
} }
########################################################################## ##########################################################################
@ -749,7 +785,7 @@ sub pandora_validate_event_id ($$$) {
########################################################################## ##########################################################################
sub pandora_update_user_from_hash ($$$$) { sub pandora_update_user_from_hash ($$$$) {
my ($parameters, $where_column, $where_value, $dbh) = @_; my ($parameters, $where_column, $where_value, $dbh) = @_;
my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value}); my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value});
return $user_id; return $user_id;
} }
@ -976,7 +1012,7 @@ sub pandora_get_calendar_id ($$) {
sub pandora_get_same_day_id ($$) { sub pandora_get_same_day_id ($$) {
my ($dbh, $same_day) = @_; my ($dbh, $same_day) = @_;
my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8}; my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8 };
return defined ($weeks->{$same_day}) ? $weeks->{$same_day} : -1; return defined ($weeks->{$same_day}) ? $weeks->{$same_day} : -1;
} }
@ -998,25 +1034,6 @@ sub pandora_delete_special_day ($$) {
} }
} }
###############################################################################
###############################################################################
# PRINT HELP AND CHECK ERRORS FUNCTIONS
###############################################################################
###############################################################################
###############################################################################
# log wrapper
###############################################################################
sub print_log ($) {
my ($msg) = @_;
print $msg; # show message
$msg =~ s/\n+$//;
logger( $conf, "($progname) $msg", 10); # save to logging file
}
############################################################################### ###############################################################################
# Print a parameter error and exit the program. # Print a parameter error and exit the program.
############################################################################### ###############################################################################
@ -3037,10 +3054,15 @@ sub cli_create_user() {
sub cli_user_update() { sub cli_user_update() {
my ($user_id,$field,$new_value) = @ARGV[2..4]; my ($user_id,$field,$new_value) = @ARGV[2..4];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To update a user go to metaconsole. \n\n";
exit;
}
my $user_exists = get_user_exists ($dbh, $user_id); my $user_exists = get_user_exists ($dbh, $user_id);
exist_check($user_exists,'user',$user_id); exist_check($user_exists,'user',$user_id);
if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') { if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') {
# Fields admited, no changes # Fields admited, no changes
} }
@ -5523,7 +5545,7 @@ sub cli_get_agents() {
my $head_print = 0; my $head_print = 0;
use Data::Dumper; # use Data::Dumper;
foreach my $agent (@agents) { foreach my $agent (@agents) {
@ -5850,7 +5872,12 @@ sub cli_get_planned_downtimes_items() {
sub cli_create_group() { sub cli_create_group() {
my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5]; my ($group_name,$parent_group_name,$icon,$description) = @ARGV[2..5];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To create a group go to metaconsole. \n\n";
exit;
}
my $group_id = get_group_id($dbh,$group_name); my $group_id = get_group_id($dbh,$group_name);
non_exist_check($group_id, 'group name', $group_name); non_exist_check($group_id, 'group name', $group_name);
@ -5922,6 +5949,11 @@ sub cli_create_group() {
sub cli_delete_group() { sub cli_delete_group() {
my ($group_name) = @ARGV[2]; my ($group_name) = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To delete a group go to metaconsole. \n\n";
exit;
}
my $group_id = get_group_id($dbh,$group_name); my $group_id = get_group_id($dbh,$group_name);
exist_check($group_id, 'group name', $group_name); exist_check($group_id, 'group name', $group_name);
@ -5946,6 +5978,11 @@ sub cli_update_group() {
my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6]; my ($group_id,$group_name,$parent_group_name,$icon,$description) = @ARGV[2..6];
my $result; my $result;
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To update a group go to metaconsole. \n\n";
exit;
}
$result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id); $result = get_db_value ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo=?', $group_id);
if($result == "0E0"){ if($result == "0E0"){
@ -6144,6 +6181,11 @@ sub cli_disable_double_auth () {
sub cli_user_enable () { sub cli_user_enable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To enable a user go to metaconsole. \n\n";
exit;
}
my $user_disabled = get_user_disabled ($dbh, $user_id); my $user_disabled = get_user_disabled ($dbh, $user_id);
exist_check($user_disabled,'user',$user_id); exist_check($user_disabled,'user',$user_id);
@ -6169,6 +6211,11 @@ sub cli_user_enable () {
sub cli_user_disable () { sub cli_user_disable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
print_log "[ERROR] This node is configured with centralized mode. To disable a user go to metaconsole. \n\n";
exit;
}
my $user_disabled = get_user_disabled ($dbh, $user_id); my $user_disabled = get_user_disabled ($dbh, $user_id);
exist_check($user_disabled,'user',$user_id); exist_check($user_disabled,'user',$user_id);