From d4f7e9c254398bfd6a6fa77e0a23b5121e59814e Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 8 Jan 2013 17:56:32 +0000 Subject: [PATCH] 2013-01-08 Miguel de Dios * util/pandora_db.pl: fixed the SQL query for the checking modules status count. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7378 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/util/pandora_db.pl | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index e6446e34f5..909577456f 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2013-01-08 Miguel de Dios + + * util/pandora_db.pl: fixed the SQL query for the checking modules + status count. + 2013-01-02 Juan Manuel Ramon * lib/PandoraFMS/Core.pm: Added macro _email_tag_ to replace with diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index a0f616807b..c16266f899 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -91,11 +91,11 @@ sub pandora_purgedb ($$) { # Numeric data deletion print "[PURGE] Deleting old data... \n"; - + # This could be very timing consuming, so make this operation in $BIG_OPERATION_STEP # steps (100 fixed by default) # Starting from the oldest record on the table - + $first_mark = get_db_value ($dbh, 'SELECT utimestamp FROM tagente_datos ORDER BY utimestamp ASC LIMIT 1'); if (defined ($first_mark)) { $total_time = $ulimit_timestamp - $first_mark; @@ -569,7 +569,7 @@ sub pandora_checkdb_consistency { my @agents = get_db_rows ($dbh, 'SELECT id_agente FROM tagente'); foreach my $agent (@agents) { my $id_agente = $agent->{'id_agente'}; - db_do ($dbh, 'UPDATE tagente SET normal_count=(SELECT COUNT(*) FROM tagente_estado WHERE id_agente=' . $id_agente . ' AND estado=0 disabled=0), + db_do ($dbh, 'UPDATE tagente SET normal_count=(SELECT COUNT(*) FROM tagente_estado WHERE id_agente=' . $id_agente . ' AND estado=0 AND disabled=0), critical_count=(SELECT COUNT(*) FROM tagente_estado WHERE id_agente=' . $id_agente . ' AND estado=1 AND disabled=0), warning_count=(SELECT COUNT(*) FROM tagente_estado WHERE id_agente=' . $id_agente . ' AND estado=2 AND disabled=0), unknown_count=(SELECT COUNT(*) FROM tagente_estado WHERE id_agente=' . $id_agente . ' AND estado=3 AND disabled=0),