From 7e5a082e226f2e6840df8fdb866a301bbf3c87ae Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 14 Jun 2021 19:29:24 +0200 Subject: [PATCH] pandora_ha enterprise components fixed --- pandora_server/lib/PandoraFMS/Tools.pm | 5 +++-- pandora_server/util/pandora_ha.pl | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 8f994092aa..d4109d7d54 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -915,8 +915,9 @@ sub float_equal { # Tries to load the PandoraEnterprise module. Must be called once before # enterprise_hook (). ################################################################################ -sub enterprise_load ($) { +sub enterprise_load ($;$) { my $pa_config = shift; + my $muted = shift; # Check dependencies @@ -944,7 +945,7 @@ sub enterprise_load ($) { } # Initialize the enterprise module. - PandoraFMS::Enterprise::init($pa_config); + PandoraFMS::Enterprise::init($pa_config, $muted); return 1; } diff --git a/pandora_server/util/pandora_ha.pl b/pandora_server/util/pandora_ha.pl index aa093ce8cc..ffe4dea01f 100755 --- a/pandora_server/util/pandora_ha.pl +++ b/pandora_server/util/pandora_ha.pl @@ -296,6 +296,21 @@ sub ha_main($) { while ($Running) { eval { + eval { + local $SIG{__DIE__}; + # Load enterprise components. + enterprise_load($conf, 1); + + # Register Enterprise logger + enterprise_hook('pandoraha_logger', [\&log_message]); + log_message($conf, 'LOG', 'Enterprise capabilities loaded'); + + }; + if ($@) { + # No enterprise capabilities. + log_message($conf, 'LOG', 'No enterprise capabilities'); + } + # Start the Pandora FMS server if needed. log_message($conf, 'LOG', 'Checking the pandora_server service.');