Merge branch 'ent-4064-7999-pandora-ha-eventserver-alertas-duplicadas' into 'develop'

HA related fixes to the Recon Server.

See merge request artica/pandorafms!2529
This commit is contained in:
Daniel Rodriguez 2019-06-25 10:36:16 +02:00
commit ea7e4892c3
1 changed files with 15 additions and 6 deletions

View File

@ -141,12 +141,21 @@ sub data_producer ($) {
# Manual tasks are "forced" like the other, setting the utimestamp to 1 # Manual tasks are "forced" like the other, setting the utimestamp to 1
# By default, after create a tasks it takes the utimestamp to 0 # By default, after create a tasks it takes the utimestamp to 0
# Status -1 means "done". # Status -1 means "done".
my @rows;
if (pandora_is_master($pa_config) == 0) {
@rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
WHERE id_recon_server = ?
AND disabled = 0
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
} else {
@rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
WHERE (id_recon_server = ? OR id_recon_server = ANY(SELECT id_server FROM tserver WHERE status = 0 AND server_type = ?))
AND disabled = 0
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id, DISCOVERYSERVER);
}
my @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
WHERE id_recon_server = ?
AND disabled = 0
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
foreach my $row (@rows) { foreach my $row (@rows) {
# Update task status # Update task status