2012-05-29 Koichiro Kikuchi <koichiro@rworks.jp>
* util/pandora_db.pl: Don't delete non-initialized modules which belong to disabled agent. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6353 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e5ca336684
commit
f313e1a1e2
|
@ -1,3 +1,8 @@
|
|||
2012-05-29 Koichiro Kikuchi <koichiro@rworks.jp>
|
||||
|
||||
* util/pandora_db.pl: Don't delete non-initialized modules which
|
||||
belong to disabled agent.
|
||||
|
||||
2012-05-21 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Added new Internal Command for
|
||||
|
|
|
@ -457,7 +457,7 @@ sub pandora_checkdb_consistency {
|
|||
# 1. Check for modules that do not have tagente_estado but have tagente_module
|
||||
|
||||
print "[CHECKDB] Deleting non-init data... \n";
|
||||
my @modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_estado WHERE utimestamp = 0');
|
||||
my @modules = get_db_rows ($dbh, 'SELECT id_agente_modulo,id_agente FROM tagente_estado WHERE utimestamp = 0');
|
||||
foreach my $module (@modules) {
|
||||
my $id_agente_modulo = $module->{'id_agente_modulo'};
|
||||
|
||||
|
@ -465,11 +465,19 @@ sub pandora_checkdb_consistency {
|
|||
my $is_policy_module = enterprise_hook ('is_policy_module', [$dbh, $id_agente_modulo]);
|
||||
next if (defined($is_policy_module) && $is_policy_module);
|
||||
|
||||
# Skip if agent is disabled
|
||||
my $is_agent_disabled = get_db_value ($dbh, 'SELECT disabled FROM tagente WHERE id_agente = ?', $module->{'id_agente'});
|
||||
next if (defined($is_agent_disabled) && $is_agent_disabled);
|
||||
|
||||
# Skip if module is disabled
|
||||
my $is_module_disabled = get_db_value ($dbh, 'SELECT disabled FROM tagente_modulo WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
|
||||
next if (defined($is_module_disabled) && $is_module_disabled);
|
||||
|
||||
# Delete the module
|
||||
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE disabled = 0 AND id_agente_modulo = ?', $id_agente_modulo);;
|
||||
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agente_modulo);
|
||||
|
||||
# Delete any alerts associated to the module
|
||||
db_do ($dbh, 'DELETE FROM talert_template_modules WHERE id_agent_module = ? AND NOT EXISTS (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente_modulo = ?)', $id_agente_modulo, $id_agente_modulo);
|
||||
db_do ($dbh, 'DELETE FROM talert_template_modules WHERE id_agent_module = ?', $id_agente_modulo);
|
||||
}
|
||||
|
||||
print "[CHECKDB] Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days)... \n";
|
||||
|
|
Loading…
Reference in New Issue