From 00acc46ecaf8f3865e2e8ecea8f058cd8c7436e3 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 26 Apr 2021 19:49:43 +0200 Subject: [PATCH 1/5] Fix locating agent while correlating logs --- pandora_server/lib/PandoraFMS/Core.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 40cd75f4d9..18afba08cd 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -297,7 +297,10 @@ sub locate_agent { # Locate agent first in tmetaconsole_agent return undef if (! defined ($field) || $field eq ''); - my $rs = enterprise_hook('get_metaconsole_agent_from_alias', [$dbh, $field, $relative]); + my $rs = enterprise_hook('get_metaconsole_agent_from_id', [$dbh, $field]); + return $rs if defined($rs) && (ref($rs)); # defined and not a scalar + + $rs = enterprise_hook('get_metaconsole_agent_from_alias', [$dbh, $field, $relative]); return $rs if defined($rs) && (ref($rs)); # defined and not a scalar $rs = enterprise_hook('get_metaconsole_agent_from_addr', [$dbh, $field, $relative]); @@ -322,7 +325,10 @@ sub get_agent { return undef if (! defined ($field) || $field eq ''); - my $rs = get_agent_from_alias($dbh, $field, $relative); + my $rs = get_agent_from_id($dbh, $field); + return $rs if defined($rs) && (ref($rs)); # defined and not a scalar + + $rs = get_agent_from_alias($dbh, $field, $relative); return $rs if defined($rs) && (ref($rs)); # defined and not a scalar $rs = get_agent_from_addr($dbh, $field); @@ -378,6 +384,17 @@ sub get_agent_from_name ($$;$) { return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', safe_input($name)); } +########################################################################## +# Return the agent given the agent id. +########################################################################## +sub get_agent_from_id ($$) { + my ($dbh, $id) = @_; + + return undef if (! defined ($id) || $id eq ''); + + return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.id_agente = ?', $id); +} + ########################################################################## =head2 C<< pandora_generate_alerts (I<$pa_config> I<$data> I<$status> I<$agent> I<$module> I<$utimestamp> I<$dbh> I<$timestamp> I<$extra_macros> I<$last_data_value>) >> From 2ef9743d5bdca64074b2ca8589bfc65333557bb8 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 27 Apr 2021 14:59:59 +0200 Subject: [PATCH 2/5] Added elastic_query_size --- pandora_server/conf/pandora_server.conf.new | 3 +++ pandora_server/lib/PandoraFMS/Config.pm | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 53ae7a4604..2f91bccf68 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -473,6 +473,9 @@ log_window 3600 # Correlated 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) +#elastic_query_size 10 + # If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status. event_inhibit_alerts 0 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index e0057f9da5..fc83623dec 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -302,6 +302,7 @@ sub pandora_load_config { $pa_config->{"eventserver"} = 1; # 4.0 $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) $pa_config->{"event_server_cache_ttl"} = 10; # 7.754 $pa_config->{"preload_windows"} = 0; # 7.741 $pa_config->{"icmpserver"} = 0; # 4.0 @@ -999,6 +1000,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^log_window\s+([0-9]*)/i) { $pa_config->{'log_window'}= clean_blank($1); } + elsif ($parametro =~ m/^elastic_query_size\s+([0-9]*)/i) { + $pa_config->{'elastic_query_size'}= clean_blank($1); + } elsif ($parametro =~ m/^preload_windows\s+([0-9]*)/i) { $pa_config->{'preload_windows'}= clean_blank($1); } From 24976c486048601e4791211c37fc47e40ac99388 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 27 Apr 2021 17:58:20 +0200 Subject: [PATCH 3/5] Disable timezone offset while setting timestamp from server --- pandora_server/lib/PandoraFMS/DataServer.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 0006482ea1..9445b518ee 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -280,6 +280,11 @@ sub process_xml_data ($$$$$) { $timezone_offset = 0; } + # If set by server, do not use offset. + if ($pa_config->{'use_xml_timestamp'} eq '0') { + $timezone_offset = 0; + } + # Parent Agent Name my $parent_id = 0; # Default value for unknown parent my $parent_agent_name = $data->{'parent_agent_name'}; From 70e64eb85f4e53a31adce26c5c4a87a9280edb1c Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" Date: Thu, 29 Apr 2021 11:09:06 +0200 Subject: [PATCH 4/5] adding ipam dependencies, wmic new binary and lxc support --- extras/deploy-scripts/pandora_deploy_community.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index aa858eec3a..292f0f801e 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -117,7 +117,7 @@ check_pre_pandora check_repo_connection # Systemd -execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' +execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' # Check memomry greather or equal to 2G execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)' @@ -247,7 +247,15 @@ server_dependencies=" \ perl-Time-HiRes \ nfdump \ net-snmp-utils \ - http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm" + perl(NetAddr::IP) \ + perl(Sys::Syslog) \ + perl(DBI) \ + perl(XML::Simple) \ + perl(Geo::IP) \ + perl(IO::Socket::INET6) \ + perl(XML::Twig) \ + http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ + http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" # SDK VMware perl dependencies @@ -475,7 +483,7 @@ net.core.optmem_max = 81920 EO_KO -execute_cmd "sysctl --system" "Applying Kernel optimization" +[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization" # Fix pandora_server.{log,error} permissions to allow Console check them chown pandora:apache /var/log/pandora From c95b629776b2660e49780519e7906ec21eb13988 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 30 Apr 2021 01:00:41 +0200 Subject: [PATCH 5/5] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 5d3f7b7610..3c12722469 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.754-210429 +Version: 7.0NG.754-210430 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index b3a667efbb..22b84b4bd3 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.754-210429" +pandora_version="7.0NG.754-210430" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 590bb20c79..eca6cd6387 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.754'; -use constant AGENT_BUILD => '210429'; +use constant AGENT_BUILD => '210430'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index cec1503f46..c6a8318381 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.754 -%define release 210429 +%define release 210430 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 096a381658..506e75ef2f 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.754 -%define release 210429 +%define release 210430 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index e92d00fedd..ebb0cd59ce 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.754" -PI_BUILD="210429" +PI_BUILD="210430" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 54658484ab..4940acffc1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210429} +{210430} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ecc63c8fe6..9db2d86861 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.754(Build 210429)") +#define PANDORA_VERSION ("7.0NG.754(Build 210430)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 8ef58993d2..a60ee8dac5 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.754(Build 210429))" + VALUE "ProductVersion", "(7.0NG.754(Build 210430))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7d4f90a639..786f4ca089 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.754-210429 +Version: 7.0NG.754-210430 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 1647bf5e6e..f3b84cd68e 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.754-210429" +pandora_version="7.0NG.754-210430" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 68ee2534d8..98f7459a0d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210429'; +$build_version = 'PC210430'; $pandora_version = 'v7.0NG.754'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d508dda087..ff5f414224 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index a533327318..a1eaf25c2b 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.754 -%define release 210429 +%define release 210430 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 50124cef27..e0c80696cb 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.754 -%define release 210429 +%define release 210430 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 18f3c08594..53756f8805 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.754" -PI_BUILD="210429" +PI_BUILD="210430" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b3ab45cb6f..03b1f4c61f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.754 PS210429"; +my $version = "7.0NG.754 PS210430"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 501fc1bcff..e5230ca983 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.754 PS210429"; +my $version = "7.0NG.754 PS210430"; # save program name for logging my $progname = basename($0);