From b12b3c2a2c8b417a52337e7d5e2ebf3415c31897 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 6 Feb 2023 10:48:25 +0100 Subject: [PATCH] Limit the number of unknown modules processed per iteration. --- pandora_server/conf/pandora_server.conf.new | 5 ++- pandora_server/lib/PandoraFMS/Config.pm | 40 +++++++++++---------- pandora_server/lib/PandoraFMS/Core.pm | 2 +- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 93c6857382..d04de89830 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -598,6 +598,9 @@ unknown_events 1 # Time interval (as a multiple of the module interval) before a module becomes unknown. Twice the module's interval by default. #unknown_interval 2 +# Number of unknown modules that will be processed per iteration. +unknown_block_size 1000 + # Maximum executing time of an alert (in seconds) global_alert_timeout 15 @@ -732,4 +735,4 @@ tentacle_service_watchdog 1 # Enable (1) or disable (0) the parameter of mysql ssl certification (mysql_ssl_verify_server_cert) (enabled by default). -verify_mysql_ssl_cert 1 \ No newline at end of file +verify_mysql_ssl_cert 1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 0b93dfd8b1..5f85f686ad 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -527,33 +527,35 @@ sub pandora_load_config { $pa_config->{"unknown_updates"} = 0; # 7.0.718 - $pa_config->{"provisioningserver"} = 1; # 7.0 720 - $pa_config->{"provisioningserver_threads"} = 1; # 7.0 720 - $pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720 + $pa_config->{"provisioningserver"} = 1; # 7.0.720 + $pa_config->{"provisioningserver_threads"} = 1; # 7.0.720 + $pa_config->{"provisioning_cache_interval"} = 300; # 7.0.720 - $pa_config->{"autoconfigure_agents"} = 1; # 7.0 725 - $pa_config->{"autoconfigure_agents_threshold"} = 300; #7.0 764 + $pa_config->{"autoconfigure_agents"} = 1; # 7.0.725 + $pa_config->{"autoconfigure_agents_threshold"} = 300; #7.0.764 - $pa_config->{'snmp_extlog'} = ""; # 7.0 726 + $pa_config->{'snmp_extlog'} = ""; # 7.0.726 - $pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0 732 + $pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0.732 - $pa_config->{"event_inhibit_alerts"} = 0; # 7.0 737 + $pa_config->{"event_inhibit_alerts"} = 0; # 7.0.737 - $pa_config->{"alertserver"} = 0; # 7.0 756 - $pa_config->{"alertserver_threads"} = 1; # 7.0 756 - $pa_config->{"alertserver_warn"} = 180; # 7.0 756 - $pa_config->{"alertserver_queue"} = 0; # 7.0 764 + $pa_config->{"alertserver"} = 0; # 7.0.756 + $pa_config->{"alertserver_threads"} = 1; # 7.0.756 + $pa_config->{"alertserver_warn"} = 180; # 7.0.756 + $pa_config->{"alertserver_queue"} = 0; # 7.0.764 - $pa_config->{'ncmserver'} = 0; # 7.0 758 - $pa_config->{'ncmserver_threads'} = 1; # 7.0 758 - $pa_config->{'ncm_ssh_utility'} = '/usr/share/pandora_server/util/ncm_ssh_extension'; # 7.0 758 + $pa_config->{'ncmserver'} = 0; # 7.0.758 + $pa_config->{'ncmserver_threads'} = 1; # 7.0.758 + $pa_config->{'ncm_ssh_utility'} = '/usr/share/pandora_server/util/ncm_ssh_extension'; # 7.0.758 - $pa_config->{"pandora_service_cmd"} = 'service pandora_server'; # 7.0 761 - $pa_config->{"tentacle_service_cmd"} = 'service tentacle_serverd'; # 7.0 761 - $pa_config->{"tentacle_service_watchdog"} = 1; # 7.0 761 + $pa_config->{"pandora_service_cmd"} = 'service pandora_server'; # 7.0.761 + $pa_config->{"tentacle_service_cmd"} = 'service tentacle_serverd'; # 7.0.761 + $pa_config->{"tentacle_service_watchdog"} = 1; # 7.0.761 - $pa_config->{"dataserver_smart_queue"} = 0; # 765. + $pa_config->{"dataserver_smart_queue"} = 0; # 7.0.765 + + $pa_config->{"unknown_block_size"} = 1000; # 7.0.769 # Check for UID0 if ($pa_config->{"quiet"} != 0){ diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 57c3284b70..27f08b0bc7 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -6214,7 +6214,7 @@ sub pandora_module_unknown ($$) { ') ) AND tagente_estado.utimestamp != 0 - AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP()', $pa_config->{'unknown_interval'}); + AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP() LIMIT ?', $pa_config->{'unknown_interval'}, $pa_config->{'unknown_block_size'}); foreach my $module (@modules) {