2011-09-04 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/DB.pm, lib/PandoraFMS/Core.pm: Fixed policy queue (was not working properly). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4897 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b5c5074006
commit
53ce875a6b
|
@ -1,3 +1,8 @@
|
||||||
|
2011-09-04 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/DB.pm, lib/PandoraFMS/Core.pm: Fixed policy queue (was
|
||||||
|
not working properly).
|
||||||
|
|
||||||
2011-09-02 Vanessa Gil <vanessa.gil@artica.es>
|
2011-09-02 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* pandora_server/conf/pandora_server.conf: Added update parent line to the configuration file.
|
* pandora_server/conf/pandora_server.conf: Added update parent line to the configuration file.
|
||||||
|
|
|
@ -1137,28 +1137,25 @@ sub pandora_update_agent ($$$$$$$;$$$$$$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
=head2 C<< pandora_create_template_module(I<$pa_config>, I<$id_agent_module>, I<$id_alert_template>, I<$dbh>, I<$id_policy_alerts>, I<$disabled>, I<$standby>) >>
|
=head2 C<< pandora_create_template_module(I<$pa_config>, I<$dbh>, I<$id_agent_module>, I<$id_alert_template>, I<$id_policy_alerts>, I<$disabled>, I<$standby>) >>
|
||||||
|
|
||||||
Create a template module.
|
Create a template module.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_create_template_module ($$$$;$$$) {
|
sub pandora_create_template_module ($$$$;$$$) {
|
||||||
my ($pa_config, $id_agent_module, $id_alert_template, $dbh, $id_policy_alerts, $disabled, $standby) = @_;
|
my ($pa_config, $dbh, $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby) = @_;
|
||||||
|
|
||||||
$id_policy_alerts = 0 unless defined $id_policy_alerts;
|
$id_policy_alerts = 0 unless defined $id_policy_alerts;
|
||||||
$disabled = 0 unless defined $disabled;
|
$disabled = 0 unless defined $disabled;
|
||||||
$standby = 0 unless defined $standby;
|
$standby = 0 unless defined $standby;
|
||||||
|
|
||||||
my $module_name = get_module_name($dbh, $id_agent_module);
|
my $module_name = get_module_name($dbh, $id_agent_module);
|
||||||
logger($pa_config, "Creating alert of template '$id_alert_template' on agent module '$module_name'.", 10);
|
return db_insert ($dbh, 'id', "INSERT INTO talert_template_modules (`id_agent_module`, `id_alert_template`, `id_policy_alerts`, `disabled`, `standby`) VALUES (?, ?, ?, ?, ?)", $id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby);
|
||||||
|
|
||||||
$dbh->do("INSERT INTO talert_template_modules (`id_agent_module`, `id_alert_template`, `id_policy_alerts`, `disabled`, `standby`) VALUES ($id_agent_module, $id_alert_template, $id_policy_alerts, $disabled, $standby)");
|
|
||||||
return $dbh->{'mysql_insertid'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
=head2 C<< pandora_update_template_module(I<$pa_config>, I<$id_alert>, I<$dbh>, I<$id_policy_alerts>, I<$disabled>, I<$standby>) >>
|
=head2 C<< pandora_update_template_module(I<$pa_config>, I<$dbh>, I<$id_alert>, I<$id_policy_alerts>, I<$disabled>, I<$standby>) >>
|
||||||
|
|
||||||
Update a template module.
|
Update a template module.
|
||||||
|
|
||||||
|
@ -1166,17 +1163,13 @@ Update a template module.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
sub pandora_update_template_module ($$$;$$$) {
|
sub pandora_update_template_module ($$$;$$$) {
|
||||||
my ($pa_config, $id_alert, $dbh, $id_policy_alerts, $disabled, $standby) = @_;
|
my ($pa_config, $dbh, $id_alert, $id_policy_alerts, $disabled, $standby) = @_;
|
||||||
|
|
||||||
$id_policy_alerts = 0 unless defined $id_policy_alerts;
|
$id_policy_alerts = 0 unless defined $id_policy_alerts;
|
||||||
$disabled = 0 unless defined $disabled;
|
$disabled = 0 unless defined $disabled;
|
||||||
$standby = 0 unless defined $standby;
|
$standby = 0 unless defined $standby;
|
||||||
|
|
||||||
#my $module_name = get_module_name($dbh, $id_agent_module);
|
db_do ($dbh, "UPDATE talert_template_modules SET `id_policy_alerts` = ?, `disabled` = ?, `standby` = ? WHERE id = ?", $id_policy_alerts, $disabled, $standby, $id_alert);
|
||||||
#logger($pa_config, "Update alert of template '$id_alert_template' on agent module '$module_name'.", 10);
|
|
||||||
|
|
||||||
$dbh->do("UPDATE talert_template_modules SET `id_policy_alerts` = '$id_policy_alerts', `disabled` = '$disabled', `standby` = '$standby' WHERE id = $id_alert");
|
|
||||||
return $dbh->{'mysql_insertid'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -1364,10 +1357,7 @@ sub pandora_create_module_from_hash ($$$) {
|
||||||
sub pandora_update_module_from_hash ($$$$$) {
|
sub pandora_update_module_from_hash ($$$$$) {
|
||||||
my ($pa_config, $parameters, $where_column, $where_value, $dbh) = @_;
|
my ($pa_config, $parameters, $where_column, $where_value, $dbh) = @_;
|
||||||
|
|
||||||
logger($pa_config, "Updating module '$parameters->{'nombre'}' for agent ID $parameters->{'id_agente'}.", 10);
|
|
||||||
|
|
||||||
my $module_id = db_process_update($dbh, 'tagente_modulo', $parameters, $where_column, $where_value);
|
my $module_id = db_process_update($dbh, 'tagente_modulo', $parameters, $where_column, $where_value);
|
||||||
|
|
||||||
return $module_id;
|
return $module_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ sub get_module_name ($$) {
|
||||||
sub get_agent_module_id ($$$) {
|
sub get_agent_module_id ($$$) {
|
||||||
my ($dbh, $module_name, $agent_id) = @_;
|
my ($dbh, $module_name, $agent_id) = @_;
|
||||||
|
|
||||||
my $rc = get_db_value ($dbh, "SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 0 AND nombre = ? AND id_agente = ?", safe_input(safe_output($module_name)), $agent_id);
|
my $rc = get_db_value ($dbh, "SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 0 AND nombre = ? AND id_agente = ?", $module_name, $agent_id);
|
||||||
return defined ($rc) ? $rc : -1;
|
return defined ($rc) ? $rc : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue