From af23275f5d3f5fc6a2df61952a4a5ad73567c2a7 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 26 Feb 2024 14:41:09 +0100 Subject: [PATCH 1/5] fix api call --- pandora_console/include/functions_api.php | 48 +++++++++++++++++++---- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 29feaa253f..b70827b856 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -13270,7 +13270,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) } else if ($other['type'] == 'array') { $comment = $other['data'][0]; - $node_int = 0; + $node_int = 0; if (is_metaconsole() === true) { if (isset($other['data'][1]) === true && empty($other['data'][1]) === false @@ -17806,8 +17806,8 @@ function api_token_check(string $token) * @param mixed $custom_field Custom field to set. * @return void */ -function api_set_event_custom_id($id, $value) -{ +function api_set_event_custom_id($id, $value, $other) +{ // Get the event $event = events_get_event($id, false, is_metaconsole()); // If event not exists, end the execution. @@ -17824,10 +17824,44 @@ function api_set_event_custom_id($id, $value) $result = false; } - $result = events_event_custom_id( - $id, - $value - ); + $node_id = 0; + + if (is_metaconsole() === true) { + if (isset($other['data'][0]) === true + && empty($other['data'][0]) === false + ) { + $node_id = $other['data'][0]; + } + } + + try { + if (is_metaconsole() === true + && (int) $node_id > 0 + ) { + $node = new Node($node_id); + $node->connect(); + } + + $result = events_event_custom_id( + $id, + $value + ); + } catch (\Exception $e) { + // Unexistent agent. + if (is_metaconsole() === true + && $node_id > 0 + ) { + $node->disconnect(); + } + + $status = false; + } finally { + if (is_metaconsole() === true + && $node_id > 0 + ) { + $node->disconnect(); + } + } // If update results failed if (empty($result) === true || $result === false) { From e84b522dff099ae2d59f1b1f79e1709beb57a137 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 26 Feb 2024 14:42:42 +0100 Subject: [PATCH 2/5] fix api call --- pandora_console/include/functions_api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index b70827b856..37568798ed 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -13270,7 +13270,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3) } else if ($other['type'] == 'array') { $comment = $other['data'][0]; - $node_int = 0; + $node_int = 0; if (is_metaconsole() === true) { if (isset($other['data'][1]) === true && empty($other['data'][1]) === false @@ -17807,7 +17807,7 @@ function api_token_check(string $token) * @return void */ function api_set_event_custom_id($id, $value, $other) -{ +{ // Get the event $event = events_get_event($id, false, is_metaconsole()); // If event not exists, end the execution. From b21ac07c42632c64a7751288f67def5c78bc0255 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 26 Feb 2024 14:45:48 +0100 Subject: [PATCH 3/5] disable eventlog modules by default --- pandora_agents/win32/bin/pandora_agent.conf | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index d832ba792a..2113ff9673 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -180,20 +180,20 @@ module_group Networking module_end # Get logs from System source. -module_begin -module_name Eventlog_System -module_type log -module_logevent -module_source System -module_end +# module_begin +# module_name Eventlog_System +# module_type log +# module_logevent +# module_source System +# module_end # Get logs from Security source. -module_begin -module_name Eventlog_Security -module_type log -module_logevent -module_source Security -module_end +# module_begin +# module_name Eventlog_Security +# module_type log +# module_logevent +# module_source Security +# module_end # Example plugin to retrieve drive usage module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs" From 4fbcb2318c91c77080d5977b17f9ae8d53f2e54f Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 26 Feb 2024 15:48:47 +0100 Subject: [PATCH 4/5] fix error when there are no servers --- pandora_console/general/header.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 5eee6a6669..5502fec94f 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -54,7 +54,14 @@ echo sprintf('
', $menuTypeClass); // ======= Servers List =============================================== if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { $servers = []; - $servers['all'] = (int) count((servers_get_info() ?? [])); + $servers_info = servers_get_info(); + + $servers['all'] = 0; + + if ($servers_info !== null && $servers_info !== false) { + $servers['all'] = (int) count($servers_info); + } + if ($servers['all'] != 0) { $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); From 481ba2794edb6c5a98518a8b3c945c4c205b7b65 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 28 Feb 2024 01:00:06 +0100 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.redhat_bin.el8.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.el9.spec | 2 +- pandora_agents/unix/pandora_agent.redhat_bin.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 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 366e1ec0cb..5cdc47e6aa 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.775-240227 +Version: 7.0NG.775-240228 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 a0e23e10ee..5ed76f51f7 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.775-240227" +pandora_version="7.0NG.775-240228" 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 bfea44a925..6e07f37f49 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.775'; -use constant AGENT_BUILD => '240227'; +use constant AGENT_BUILD => '240228'; # 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 cbd83fc2f1..e56060f1f6 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240227 +%define release 240228 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 04b3a359b6..6387a6913a 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240227 +%define release 240228 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 35f3b996c3..1c28ac3edf 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240227 +%define release 240228 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index ed5d2bae39..2ab81cb321 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240227 +%define release 240228 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7773cebed3..fec245d2dd 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240227 +%define release 240228 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 f0feb34207..546543ae78 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.775" -PI_BUILD="240227" +PI_BUILD="240228" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 22dece60e2..d87b490361 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240227} +{240228} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ed9c1be337..69bbb31a3f 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.775 Build 240227") +#define PANDORA_VERSION ("7.0NG.775 Build 240228") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 65ca2d63d6..c1c50f71f7 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.775(Build 240227))" + VALUE "ProductVersion", "(7.0NG.775(Build 240228))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a7a4d0ecb3..5f30bde03d 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.775-240227 +Version: 7.0NG.775-240228 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 e163d0f901..b3d2fa130a 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.775-240227" +pandora_version="7.0NG.775-240228" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 8af1e98f3f..dd0333598c 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 = 'PC240227'; +$build_version = 'PC240228'; $pandora_version = 'v7.0NG.775'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index a3bfe55962..940f3a557f 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 99b49a7b32..f0475afac7 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -7,7 +7,7 @@ %define debug_package %{nil} %define name pandorafms_server %define version 7.0NG.775 -%define release 240227 +%define release 240228 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 173fa201c2..9c460a01c1 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.775 -%define release 240227 +%define release 240228 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 31b4517e22..0e2970f762 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.775" -PI_BUILD="240227" +PI_BUILD="240228" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b1e26bd473..522761067f 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -38,7 +38,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.775 Build 240227"; +my $version = "7.0NG.775 Build 240228"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3200b71f46..c3ef0b6161 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.775 Build 240227"; +my $version = "7.0NG.775 Build 240228"; # save program name for logging my $progname = basename($0);