2010-03-19 Eric Ross <eric.ross.c@gmail.com>

* util/pandora_db.pl: Added log4x tables to purge



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2518 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
eric_ross_c 2010-03-19 14:54:16 +00:00
parent 8275cb1980
commit 1ca75746c4
2 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2010-03-19 Eric Ross <eric.ross.c@gmail.com>
* util/pandora_db.pl: Added log4x tables to purge
2010-03-10 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/DataServer.pm: Fix for annoying notices from

View File

@ -103,6 +103,22 @@ sub pandora_purgedb ($$) {
}
print "\n";
#
# Now the log4x data
#
$first_mark = get_db_value ($dbh, 'SELECT utimestamp FROM tagente_datos_log4x ORDER BY utimestamp ASC LIMIT 1');
$total_time = $ulimit_timestamp - $first_mark;
$purge_steps = int($total_time / $BIG_OPERATION_STEP);
for (my $ax = 1; $ax <= $BIG_OPERATION_STEP; $ax++){
db_do ($dbh, "DELETE FROM tagente_datos_log4x WHERE utimestamp < ". ($first_mark + ($purge_steps * $ax)) . " AND utimestamp > ". $first_mark );
print "[PURGE] Log4x data deletion progress %$ax .. \r";
}
print "\n";
# String data deletion
print "[PURGE] Deleting old string data... \n";
if (!defined($conf->{'_string_purge'})){
@ -165,6 +181,7 @@ sub pandora_purgedb ($$) {
foreach my $module (@deleted_modules) {
print " Deleting data for module " . $module->{'id_agente_modulo'} . "\n";
db_do ($dbh, "DELETE FROM tagente_datos WHERE id_agente_modulo = ?", $module->{'id_agente_modulo'});
db_do ($dbh, "DELETE FROM tagente_datos_log4x WHERE id_agente_modulo = ?", $module->{'id_agente_modulo'});
db_do ($dbh, "DELETE FROM tagente_datos_string WHERE id_agente_modulo = ?", $module->{'id_agente_modulo'});
db_do ($dbh, "DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ?", $module->{'id_agente_modulo'});
db_do ($dbh, "DELETE FROM tagente_estado WHERE id_agente_modulo = ?", $module->{'id_agente_modulo'});