From f3f381ace32b8f79dfe7261d2389a273e8375d3b Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 9 Mar 2015 19:43:20 +0100 Subject: [PATCH] Added an option to configure the interval before a module becomes unknown. --- pandora_server/FreeBSD/pandora_server.conf.new | 4 ++++ pandora_server/NetBSD/pandora_server.conf.new | 4 ++++ pandora_server/conf/pandora_server.conf.new | 3 +++ pandora_server/conf/pandora_server.conf.windows | 3 +++ pandora_server/lib/PandoraFMS/Config.pm | 6 ++++++ pandora_server/lib/PandoraFMS/Core.pm | 4 ++-- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new index 1eb334bff2..efcee170c8 100644 --- a/pandora_server/FreeBSD/pandora_server.conf.new +++ b/pandora_server/FreeBSD/pandora_server.conf.new @@ -476,3 +476,7 @@ claim_back_snmp_modules 1 # If set to 1 asynchronous modules that do not receive data for twice their # interval will become normal. Set to 0 to disable. async_recovery 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 + diff --git a/pandora_server/NetBSD/pandora_server.conf.new b/pandora_server/NetBSD/pandora_server.conf.new index 83488a0d33..7567503fa1 100644 --- a/pandora_server/NetBSD/pandora_server.conf.new +++ b/pandora_server/NetBSD/pandora_server.conf.new @@ -479,3 +479,7 @@ claim_back_snmp_modules 1 # If set to 1 asynchronous modules that do not receive data for twice their # interval will become normal. Set to 0 to disable. async_recovery 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 + diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 0f46aa9138..734a655ee3 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -477,3 +477,6 @@ claim_back_snmp_modules 1 # interval will become normal. Set to 0 to disable. async_recovery 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 + diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index 2c1023ab8c..d2a54386b4 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -289,3 +289,6 @@ restart_delay 60 # interval will become normal. Set to 0 to disable. async_recovery 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 + diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 7a04ee1b65..5bf509965c 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -343,6 +343,9 @@ sub pandora_load_config { # Auto-recovery of asynchronous modules. $pa_config->{"async_recovery"} = 1; # 5.1SP1 + # Unknown interval (as a multiple of the module's interval) + $pa_config->{"unknown_interval"} = 2; # > 5.1SP2 + # ------------------------------------------------------------------------- # This values are not stored in .conf files. # This values should be stored in database, not in .conf files! @@ -814,6 +817,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^async_recovery\s+([0-1])/i) { $pa_config->{'async_recovery'}= safe_input($1); } + elsif ($parametro =~ m/^unknown_interval\s([0-9]*)/i) { # > 5.1SP2 + $pa_config->{'unknown_interval'}= safe_input($1); + } } # end of loop for parameter # # Set to RDBMS' standard port diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 2622bea54b..d467287097 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -2880,7 +2880,7 @@ sub pandora_module_keep_alive_nd { AND tagente_modulo.disabled = 0 AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())) AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND ( tagente_estado.utimestamp + (tagente.intervalo * 2) < UNIX_TIMESTAMP())'); + AND ( tagente_estado.utimestamp + (tagente.intervalo * ?) < UNIX_TIMESTAMP())', $pa_config->{'unknown_interval'}); my %data = ('data' => 0); foreach my $module (@modules) { @@ -4168,7 +4168,7 @@ sub pandora_module_unknown ($$) { AND ((tagente_estado.estado <> 3 AND tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100)) OR (tagente_estado.estado <> 0 AND tagente_modulo.id_tipo_modulo IN (21, 22, 23))) AND tagente_estado.utimestamp != 0 - AND (tagente_estado.current_interval * 2) + tagente_estado.utimestamp < UNIX_TIMESTAMP()'); + AND (tagente_estado.current_interval * ?) + tagente_estado.utimestamp < UNIX_TIMESTAMP()', $pa_config->{'unknown_interval'}); foreach my $module (@modules) {