From 356e1f9f2b1d15df448cce5c806e5eafb41d595f Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Oct 2021 13:24:23 +0200 Subject: [PATCH 1/3] Fix SQL errors in action queries. --- pandora_server/lib/PandoraFMS/Core.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index ca6be12607..4eaa0c66a7 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -881,7 +881,8 @@ sub pandora_execute_alert ($$$$$$$$$;$$) { # Get default action if ($#actions < 0) { - @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, * FROM talert_actions, talert_commands + @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, talert_actions.*, talert_commands.* + FROM talert_actions, talert_commands WHERE talert_actions.id = ? AND talert_actions.id_alert_command = talert_commands.id', $alert->{'id_alert_action'}); @@ -890,7 +891,8 @@ sub pandora_execute_alert ($$$$$$$$$;$$) { # Event alert else { if ($alert_mode == RECOVERED_ALERT) { - @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, * FROM tevent_alert_action, talert_actions, talert_commands + @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, tevent_alert_action.*, talert_actions.*, talert_commands.* + FROM tevent_alert_action, talert_actions, talert_commands WHERE tevent_alert_action.id_alert_action = talert_actions.id AND talert_actions.id_alert_command = talert_commands.id AND tevent_alert_action.id_event_alert = ? @@ -898,7 +900,8 @@ sub pandora_execute_alert ($$$$$$$$$;$$) { OR ? >= fires_min)', $alert->{'id'}, $alert->{'times_fired'}); } else { - @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, * FROM tevent_alert_action, talert_actions, talert_commands + @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, tevent_alert_action.*, talert_actions.*, talert_commands.* + FROM tevent_alert_action, talert_actions, talert_commands WHERE tevent_alert_action.id_alert_action = talert_actions.id AND talert_actions.id_alert_command = talert_commands.id AND tevent_alert_action.id_event_alert = ? @@ -910,7 +913,8 @@ sub pandora_execute_alert ($$$$$$$$$;$$) { # Get default action if ($#actions < 0) { - @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, * FROM talert_actions, talert_commands + @actions = get_db_rows ($dbh, 'SELECT talert_actions.name as action_name, talert_actions.*, talert_commands.* + FROM talert_actions, talert_commands WHERE talert_actions.id = ? AND talert_actions.id_alert_command = talert_commands.id', $alert->{'id_alert_action'}); @@ -4218,7 +4222,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { } # Execute alert - my $action = get_db_single_row ($dbh, 'SELECT talert_actions.name as action_name, * + my $action = get_db_single_row ($dbh, 'SELECT talert_actions.name as action_name, talert_actions.*, talert_commands.* FROM talert_actions, talert_commands WHERE talert_actions.id_alert_command = talert_commands.id AND talert_actions.id = ?', $alert->{'id_alert'}); @@ -4252,7 +4256,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { $alert->{'id_as'}); foreach my $other_alert (@more_actions_snmp) { - my $other_action = get_db_single_row ($dbh, 'SELECT talert_actions.name as action_name, * + my $other_action = get_db_single_row ($dbh, 'SELECT talert_actions.name as action_name, talert_actions.*, talert_commands.* FROM talert_actions, talert_commands WHERE talert_actions.id_alert_command = talert_commands.id AND talert_actions.id = ?', $other_alert->{'alert_type'}); From cd3e20fefe43e100c27b6767da3f59fd074e95d4 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 26 Oct 2021 17:40:03 +0200 Subject: [PATCH 2/3] Fix action information for SNMP alert events. --- pandora_server/lib/PandoraFMS/Core.pm | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4eaa0c66a7..aec6dd169e 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -4239,8 +4239,26 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { # Generate an event, ONLY if our alert action is different from generate an event. if ($action->{'id_alert_command'} != 3 && $alert->{'disable_event'} == 0){ - pandora_event ($pa_config, "SNMP alert fired (" . safe_output($alert->{'description'}) . ")", - 0, 0, $alert->{'priority'}, 0, 0, 'alert_fired', 0, $dbh); + pandora_event ( + $pa_config, + "SNMP alert fired (" . safe_output($alert->{'description'}) . ")", + 0, + 0, + $alert->{'priority'}, + 0, + 0, + 'alert_fired', + 0, + $dbh, + undef, + undef, + undef, + undef, + undef, + undef, + undef, + undef, + p_encode_json($pa_config, $custom_data)); } # Update alert status @@ -4296,6 +4314,11 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { 'disable_event' => $alert->{'disable_event'} ); + # Additional execution information for the console. + my $custom_data = { + 'actions' => [], + }; + pandora_execute_action ($pa_config, $trap_rcv_full, \%agent, \%alert_action, 1, $other_action, undef, $dbh, $timestamp, \%macros) if (defined ($other_action)); push(@{$custom_data->{'actions'}}, safe_output($other_action->{'action_name'})); @@ -4318,7 +4341,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { undef, undef, undef, - undef,, + undef, undef, p_encode_json($pa_config, $custom_data)); } From 945392b6155927b212055390a6ff2015289b0871 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 27 Oct 2021 01:00:56 +0200 Subject: [PATCH 3/3] 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 fe05031b2a..fc0667271d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.758-211026 +Version: 7.0NG.758-211027 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 f697253fe2..d4fef64a94 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.758-211026" +pandora_version="7.0NG.758-211027" 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 01940c43af..04a955cfad 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.758'; -use constant AGENT_BUILD => '211026'; +use constant AGENT_BUILD => '211027'; # 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 342db19571..a7077a8fe9 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.758 -%define release 211026 +%define release 211027 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 1876dc256c..253eda69b1 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.758 -%define release 211026 +%define release 211027 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 39d6fa85d9..6330116f06 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.758" -PI_BUILD="211026" +PI_BUILD="211027" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index db4fdeb47d..d82c46f48f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{211026} +{211027} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 188f8356b6..c90c7dedfa 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.758 Build 211026") +#define PANDORA_VERSION ("7.0NG.758 Build 211027") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 0d60e41719..e5f34def7b 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.758(Build 211026))" + VALUE "ProductVersion", "(7.0NG.758(Build 211027))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 00b2539ea6..9a3d403f82 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.758-211026 +Version: 7.0NG.758-211027 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 2b6e76ee9d..7de1b7d4dc 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.758-211026" +pandora_version="7.0NG.758-211027" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 140fc889b2..3cdd384418 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 = 'PC211026'; +$build_version = 'PC211027'; $pandora_version = 'v7.0NG.758'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index f00d7a5bd7..3f8c40ed31 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 720d258eed..278f5ef6a8 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.758 -%define release 211026 +%define release 211027 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index ff80aee272..1b53ec4e59 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.758 -%define release 211026 +%define release 211027 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 23db586b52..33c33e82be 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.758" -PI_BUILD="211026" +PI_BUILD="211027" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b2bb75ea50..40b4a666aa 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.758 Build 211026"; +my $version = "7.0NG.758 Build 211027"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ac9b1d507e..017fe17dce 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.758 Build 211026"; +my $version = "7.0NG.758 Build 211027"; # save program name for logging my $progname = basename($0);