mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Modified the function "pandora_checkdb_consistency" to force the server to update the values of the modules status of an agent after a module deletion
This commit is contained in:
parent
07876baae2
commit
54fe26fbf8
@ -677,10 +677,13 @@ sub pandora_checkdb_consistency {
|
|||||||
#---------------------------------------------------------------
|
#---------------------------------------------------------------
|
||||||
# Delete the module
|
# Delete the module
|
||||||
#---------------------------------------------------------------
|
#---------------------------------------------------------------
|
||||||
db_do ($dbh, 'UPDATE tagente
|
# Mark the agent for module and alert counters update
|
||||||
SET notinit_count = notinit_count - 1
|
db_do ($dbh,
|
||||||
|
'UPDATE tagente
|
||||||
|
SET update_module_count = 1, update_alert_count = 1
|
||||||
WHERE id_agente = ?', $id_agente);
|
WHERE id_agente = ?', $id_agente);
|
||||||
|
|
||||||
|
# Delete the module
|
||||||
db_do ($dbh,
|
db_do ($dbh,
|
||||||
'DELETE FROM tagente_modulo
|
'DELETE FROM tagente_modulo
|
||||||
WHERE id_agente_modulo = ?', $id_agente_modulo);
|
WHERE id_agente_modulo = ?', $id_agente_modulo);
|
||||||
@ -710,6 +713,7 @@ sub pandora_checkdb_consistency {
|
|||||||
86400 * $conf{'_days_delete_unknown'});
|
86400 * $conf{'_days_delete_unknown'});
|
||||||
|
|
||||||
foreach my $module (@modules) {
|
foreach my $module (@modules) {
|
||||||
|
my $id_agente = $module->{'id_agente'};
|
||||||
my $id_agente_modulo = $module->{'id_agente_modulo'};
|
my $id_agente_modulo = $module->{'id_agente_modulo'};
|
||||||
|
|
||||||
# Skip policy modules
|
# Skip policy modules
|
||||||
@ -717,12 +721,21 @@ sub pandora_checkdb_consistency {
|
|||||||
[$dbh, $id_agente_modulo]);
|
[$dbh, $id_agente_modulo]);
|
||||||
next if (defined($is_policy_module) && $is_policy_module);
|
next if (defined($is_policy_module) && $is_policy_module);
|
||||||
|
|
||||||
|
# Mark the agent for module and alert counters update
|
||||||
|
db_do ($dbh,
|
||||||
|
'UPDATE tagente
|
||||||
|
SET update_module_count = 1, update_alert_count = 1
|
||||||
|
WHERE id_agente = ?', $id_agente);
|
||||||
|
|
||||||
# Delete the module
|
# Delete the module
|
||||||
db_do ($dbh,
|
db_do ($dbh,
|
||||||
'DELETE FROM tagente_modulo
|
'DELETE FROM tagente_modulo
|
||||||
WHERE disabled = 0
|
WHERE disabled = 0
|
||||||
AND id_agente_modulo = ?', $id_agente_modulo);
|
AND id_agente_modulo = ?', $id_agente_modulo);
|
||||||
|
|
||||||
|
# Do a nanosleep here for 0,001 sec
|
||||||
|
usleep (100000);
|
||||||
|
|
||||||
# Delete any alerts associated to the module
|
# Delete any alerts associated to the module
|
||||||
db_do ($dbh, 'DELETE FROM talert_template_modules
|
db_do ($dbh, 'DELETE FROM talert_template_modules
|
||||||
WHERE id_agent_module = ?
|
WHERE id_agent_module = ?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user