From 10d2bd9b7c6fff251ce360569a3e76834d39f5d6 Mon Sep 17 00:00:00 2001 From: ramonn Date: Mon, 30 May 2011 16:53:42 +0000 Subject: [PATCH] 2011-05-30 Ramon Novoa * lib/PandoraFMS/Core.pm: Fixed the query to get the number of unknown agents. Thanks to Koichiro. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4392 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index b8afaadf89..b8435a307a 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-05-30 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Fixed the query to get the number of unknown + agents. Thanks to Koichiro. + 2011-05-30 Ramon Novoa * lib/PandoraFMS/Config.pm, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 7e389057b1..3036eacf60 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -2304,11 +2304,18 @@ sub pandora_self_monitoring ($$) { # Number of unknown agents my $agents_unknown = 0; if (defined ($my_data_server)) { - $agents_unknown = get_db_value ($dbh, "SELECT * FROM tagente_estado, tagente WHERE tagente.disabled =0 AND tagente.id_agente = tagente_estado.id_agente AND running_by = $my_data_server AND utimestamp < NOW() - (current_interval * 2) limit 10;"); + $agents_unknown = get_db_value ($dbh, "SELECT COUNT(DISTINCT tagente_estado.id_agente) + FROM tagente_estado, tagente, tagente_modulo + WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente + AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + AND tagente_modulo.disabled = 0 + AND running_by = $my_data_server + AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24,100) + AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)"); $agents_unknown = 0 if (!defined($agents_unknown)); } -my $queued_modules = get_db_value ($dbh, "SELECT SUM(queued_modules) FROM tserver WHERE name = '".$pa_config->{"servername"}."'"); + my $queued_modules = get_db_value ($dbh, "SELECT SUM(queued_modules) FROM tserver WHERE name = '".$pa_config->{"servername"}."'"); if (!defined($queued_modules)){ $queued_modules = 0;