2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* lib/PandoraFMS/Server.pm:: added the feature to set a agent in "Quiet" mode. * lib/PandoraFMS/Core.pm, bin/pandora_server: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6897 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6eeda98886
commit
59ddc74a16
|
@ -1,3 +1,11 @@
|
||||||
|
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Server.pm:: added the feature to set a agent in
|
||||||
|
"Quiet" mode.
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm, bin/pandora_server: cleaned source code
|
||||||
|
style.
|
||||||
|
|
||||||
2012-08-20 Sergio Martin <sergio.martin@artica.es>
|
2012-08-20 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* ChangeLog: Fixed bad description in last commit
|
* ChangeLog: Fixed bad description in last commit
|
||||||
|
|
|
@ -143,22 +143,22 @@ sub pandora_crash () {
|
||||||
# will be nice to replace this code, but at this time it's the only way I know
|
# will be nice to replace this code, but at this time it's the only way I know
|
||||||
|
|
||||||
foreach my $error_line (@_) {
|
foreach my $error_line (@_) {
|
||||||
|
# Trap the XML error and exit without nasty messages
|
||||||
# Trap the XML error and exit without nasty messages
|
if ($error_line =~ m/XML\/Parser/) {
|
||||||
if ($error_line =~ m/XML\/Parser/){
|
logger (\%Config, "Problem parsing XML file, XML file discarded: $error_line", 2);
|
||||||
logger (\%Config, "Problem parsing XML file, XML file discarded: $error_line", 2);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($error_line !~ m/Enterprise/i && $error_line !~ m/Format_XS/i && $error_line !~ m/ConfigLocal/i){
|
elsif ($error_line !~ m/Enterprise/i && $error_line !~ m/Format_XS/i && $error_line !~ m/ConfigLocal/i){
|
||||||
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if ($error_line !~ m/Can\'t\slocate/) {
|
if ($error_line !~ m/Can\'t\slocate/) {
|
||||||
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
# Known errors of loading Enterprise, Format_XS and ConfigLocal
|
# Known errors of loading Enterprise, Format_XS and ConfigLocal
|
||||||
# modules, non fatal.
|
# modules, non fatal.
|
||||||
return;
|
return;
|
||||||
|
@ -175,7 +175,6 @@ sub pandora_crash () {
|
||||||
print_message (\%Config, ' [E] Unhandled error in "' . $Config{'servername'} . "\". See more information in logfiles at '/var/log/pandora' \n", 0);
|
print_message (\%Config, ' [E] Unhandled error in "' . $Config{'servername'} . "\". See more information in logfiles at '/var/log/pandora' \n", 0);
|
||||||
print_message (\%Config, " Error description:\n", 0);
|
print_message (\%Config, " Error description:\n", 0);
|
||||||
print_message (\%Config, $full_error, 0);
|
print_message (\%Config, $full_error, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
|
@ -125,6 +125,8 @@ use PandoraFMS::Config;
|
||||||
use PandoraFMS::Tools;
|
use PandoraFMS::Tools;
|
||||||
use PandoraFMS::GIS qw(distance_moved);
|
use PandoraFMS::GIS qw(distance_moved);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
|
|
||||||
our @ISA = ("Exporter");
|
our @ISA = ("Exporter");
|
||||||
|
@ -220,6 +222,12 @@ Generate alerts for a given I<$module>.
|
||||||
sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
||||||
my ($pa_config, $data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value, $alert_type) = @_;
|
my ($pa_config, $data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value, $alert_type) = @_;
|
||||||
|
|
||||||
|
if ($agent->{'quiet'} == 1) {
|
||||||
|
logger($pa_config, "Generate Alert. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# Do not generate alerts for disabled groups
|
# Do not generate alerts for disabled groups
|
||||||
if (is_group_disabled ($dbh, $agent->{'id_grupo'})) {
|
if (is_group_disabled ($dbh, $agent->{'id_grupo'})) {
|
||||||
return;
|
return;
|
||||||
|
@ -227,23 +235,25 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
||||||
|
|
||||||
# Get enabled alerts associated with this module
|
# Get enabled alerts associated with this module
|
||||||
my $alert_type_filter = defined ($alert_type) ? " AND type = '$alert_type'" : '';
|
my $alert_type_filter = defined ($alert_type) ? " AND type = '$alert_type'" : '';
|
||||||
my @alerts = get_db_rows ($dbh, 'SELECT talert_template_modules.id as id_template_module,
|
my @alerts = get_db_rows ($dbh, '
|
||||||
talert_template_modules.*, talert_templates.*
|
SELECT talert_template_modules.id as id_template_module,
|
||||||
FROM talert_template_modules, talert_templates
|
talert_template_modules.*, talert_templates.*
|
||||||
WHERE talert_template_modules.id_alert_template = talert_templates.id
|
FROM talert_template_modules, talert_templates
|
||||||
AND id_agent_module = ? AND disabled = 0' . $alert_type_filter, $module->{'id_agente_modulo'});
|
WHERE talert_template_modules.id_alert_template = talert_templates.id
|
||||||
|
AND id_agent_module = ?
|
||||||
|
AND disabled = 0' . $alert_type_filter, $module->{'id_agente_modulo'});
|
||||||
|
|
||||||
foreach my $alert (@alerts) {
|
foreach my $alert (@alerts) {
|
||||||
my $rc = pandora_evaluate_alert($pa_config, $agent, $data, $status, $alert,
|
my $rc = pandora_evaluate_alert($pa_config, $agent, $data,
|
||||||
$utimestamp, $dbh, $last_data_value);
|
$status, $alert, $utimestamp, $dbh, $last_data_value);
|
||||||
|
|
||||||
pandora_process_alert ($pa_config, $data, $agent, $module,
|
pandora_process_alert ($pa_config, $data, $agent, $module,
|
||||||
$alert, $rc, $dbh, $timestamp, $extra_macros);
|
$alert, $rc, $dbh, $timestamp, $extra_macros);
|
||||||
|
|
||||||
# Evaluate compound alerts even if the alert status did not change in
|
# Evaluate compound alerts even if the alert status did not change in
|
||||||
# case the compound alert does not recover
|
# case the compound alert does not recover
|
||||||
pandora_generate_compound_alerts ($pa_config, $data, $status, $agent, $module,
|
pandora_generate_compound_alerts ($pa_config, $data, $status,
|
||||||
$alert, $utimestamp, $dbh, $timestamp)
|
$agent, $module, $alert, $utimestamp, $dbh, $timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +277,8 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
|
|
||||||
if (defined ($agent)) {
|
if (defined ($agent)) {
|
||||||
logger ($pa_config, "Evaluating alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output ($agent->{'nombre'}) . "'.", 10);
|
logger ($pa_config, "Evaluating alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output ($agent->{'nombre'}) . "'.", 10);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logger ($pa_config, "Evaluating alert '" . safe_output($alert->{'name'}) . "'.", 10);
|
logger ($pa_config, "Evaluating alert '" . safe_output($alert->{'name'}) . "'.", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,11 +298,13 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
if ($special_day ne '') {
|
if ($special_day ne '') {
|
||||||
logger ($pa_config, $date . " is a special day for " . $alert->{'name'} . ". (as a " . $special_day . ")", 10);
|
logger ($pa_config, $date . " is a special day for " . $alert->{'name'} . ". (as a " . $special_day . ")", 10);
|
||||||
return 1 if ($alert->{$special_day} != 1);
|
return 1 if ($alert->{$special_day} != 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logger ($pa_config, $date . " is *NOT* a special day for " . $alert->{'name'}, 10);
|
logger ($pa_config, $date . " is *NOT* a special day for " . $alert->{'name'}, 10);
|
||||||
return 1 if ($alert->{$DayNames[$wday]} != 1);
|
return 1 if ($alert->{$DayNames[$wday]} != 1);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return 1 if ($alert->{$DayNames[$wday]} != 1);
|
return 1 if ($alert->{$DayNames[$wday]} != 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +336,8 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
# Recover takes precedence over cease
|
# Recover takes precedence over cease
|
||||||
$status = 4 if ($alert->{'recovery_notify'} == 1);
|
$status = 4 if ($alert->{'recovery_notify'} == 1);
|
||||||
|
|
||||||
} elsif ($utimestamp > $limit_utimestamp && $alert->{'internal_counter'} > 0) {
|
}
|
||||||
|
elsif ($utimestamp > $limit_utimestamp && $alert->{'internal_counter'} > 0) {
|
||||||
$status = 5;
|
$status = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,24 +350,28 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
if ($alert->{'type'} eq "max_min") {
|
if ($alert->{'type'} eq "max_min") {
|
||||||
if ($alert->{'matches_value'} == 1) {
|
if ($alert->{'matches_value'} == 1) {
|
||||||
return $status if ($data <= $alert->{'min_value'} ||
|
return $status if ($data <= $alert->{'min_value'} ||
|
||||||
$data >= $alert->{'max_value'});
|
$data >= $alert->{'max_value'});
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $status if ($data >= $alert->{'min_value'} &&
|
return $status if ($data >= $alert->{'min_value'} &&
|
||||||
$data <= $alert->{'max_value'});
|
$data <= $alert->{'max_value'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($alert->{'type'} eq "onchange") {
|
if ($alert->{'type'} eq "onchange") {
|
||||||
if ($alert->{'matches_value'} == 1) {
|
if ($alert->{'matches_value'} == 1) {
|
||||||
if (is_numeric($last_data_value)){
|
if (is_numeric($last_data_value)) {
|
||||||
return $status if ($last_data_value == $data);
|
return $status if ($last_data_value == $data);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $status if ($last_data_value eq $data);
|
return $status if ($last_data_value eq $data);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (is_numeric($last_data_value)){
|
else {
|
||||||
|
if (is_numeric($last_data_value)) {
|
||||||
return $status if ($last_data_value != $data);
|
return $status if ($last_data_value != $data);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $status if ($last_data_value ne $data);
|
return $status if ($last_data_value ne $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,7 +393,8 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
|
|
||||||
if ($alert->{'matches_value'} == 1) {
|
if ($alert->{'matches_value'} == 1) {
|
||||||
return $status if ($data !~ m/$alert->{'value'}/i);
|
return $status if ($data !~ m/$alert->{'value'}/i);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $status if ($data =~ m/$alert->{'value'}/i);
|
return $status if ($data =~ m/$alert->{'value'}/i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,14 +407,15 @@ sub pandora_evaluate_alert ($$$$$$$;$$$) {
|
||||||
elsif (defined ($alert->{'id_agent'})) {
|
elsif (defined ($alert->{'id_agent'})) {
|
||||||
return $status if (pandora_evaluate_compound_alert($pa_config, $alert->{'id'}, $alert->{'name'}, $dbh) == 0);
|
return $status if (pandora_evaluate_compound_alert($pa_config, $alert->{'id'}, $alert->{'name'}, $dbh) == 0);
|
||||||
# Event alert
|
# Event alert
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
my $rc = enterprise_hook ('evaluate_event_alert', [$pa_config, $dbh, $alert, $events, $event]);
|
my $rc = enterprise_hook ('evaluate_event_alert', [$pa_config, $dbh, $alert, $events, $event]);
|
||||||
return $status unless (defined ($rc) && $rc == 1);
|
return $status unless (defined ($rc) && $rc == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check min and max alert limits
|
# Check min and max alert limits
|
||||||
return 2 if (($alert->{'internal_counter'} < $alert->{'min_alerts'}) ||
|
return 2 if (($alert->{'internal_counter'} < $alert->{'min_alerts'}) ||
|
||||||
($alert->{'times_fired'} >= $alert->{'max_alerts'}));
|
($alert->{'times_fired'} >= $alert->{'max_alerts'}));
|
||||||
|
|
||||||
return 0; #Launch the alert
|
return 0; #Launch the alert
|
||||||
}
|
}
|
||||||
|
@ -899,8 +919,8 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Process data
|
# Process data
|
||||||
my $processed_data = process_data ($pa_config, $data_object, $module, $module_type, $utimestamp, $dbh);
|
my $processed_data = process_data ($pa_config, $data_object, $module, $module_type, $utimestamp, $dbh);
|
||||||
if (! defined ($processed_data)) {
|
if (! defined ($processed_data)) {
|
||||||
logger($pa_config, "Received invalid data '" . $data_object->{'data'} . "' from agent '" . $agent->{'nombre'} . "' module '" . $module->{'nombre'} . "' agent " . (defined ($agent) ? "'" . $agent->{'nombre'} . "'" : 'ID ' . $module->{'id_agente'}) . ".", 3);
|
logger($pa_config, "Received invalid data '" . $data_object->{'data'} . "' from agent '" . $agent->{'nombre'} . "' module '" . $module->{'nombre'} . "' agent " . (defined ($agent) ? "'" . $agent->{'nombre'} . "'" : 'ID ' . $module->{'id_agente'}) . ".", 3);
|
||||||
pandora_update_module_on_error ($pa_config, $module, $dbh);
|
pandora_update_module_on_error ($pa_config, $module, $dbh);
|
||||||
return;
|
return;
|
||||||
|
@ -937,7 +957,8 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
||||||
$status_changes = $module->{'min_ff_event'} if ($status_changes > $module->{'min_ff_event'});
|
$status_changes = $module->{'min_ff_event'} if ($status_changes > $module->{'min_ff_event'});
|
||||||
|
|
||||||
$status_changes++;
|
$status_changes++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$status_changes = 0;
|
$status_changes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +978,8 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
||||||
# Generate alerts
|
# Generate alerts
|
||||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
||||||
pandora_generate_alerts ($pa_config, $processed_data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value);
|
pandora_generate_alerts ($pa_config, $processed_data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,8 +996,11 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
||||||
my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
|
my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
|
||||||
my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
|
my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
|
||||||
|
|
||||||
db_do ($dbh, 'UPDATE tagente_estado SET datos = ?, estado = ?, last_status = ?, status_changes = ?, utimestamp = ?, timestamp = ?,
|
db_do ($dbh, 'UPDATE tagente_estado
|
||||||
id_agente = ?, current_interval = ?, running_by = ?, last_execution_try = ?, last_try = ?
|
SET datos = ?, estado = ?, last_status = ?,
|
||||||
|
status_changes = ?, utimestamp = ?, timestamp = ?,
|
||||||
|
id_agente = ?, current_interval = ?, running_by = ?,
|
||||||
|
last_execution_try = ?, last_try = ?
|
||||||
WHERE id_agente_modulo = ?', $processed_data, $status, $last_status, $status_changes,
|
WHERE id_agente_modulo = ?', $processed_data, $status, $last_status, $status_changes,
|
||||||
$current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id,
|
$current_utimestamp, $timestamp, $module->{'id_agente'}, $current_interval, $server_id,
|
||||||
$utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $module->{'id_agente_modulo'});
|
$utimestamp, ($save == 1) ? $timestamp : $agent_status->{'last_try'}, $module->{'id_agente_modulo'});
|
||||||
|
@ -1580,18 +1605,28 @@ sub pandora_event ($$$$$$$$$$;$$$$$) {
|
||||||
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
|
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
|
||||||
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags) = @_;
|
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags) = @_;
|
||||||
|
|
||||||
|
my $agent = get_db_single_row ($dbh, 'SELECT *
|
||||||
|
FROM tagente WHERE id_agente = ?', $id_agente);
|
||||||
|
if ($agent->{'quiet'} == 1) {
|
||||||
|
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
|
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
|
||||||
|
|
||||||
# Get module tags
|
# Get module tags
|
||||||
my $module_tags = '';
|
my $module_tags = '';
|
||||||
if (defined ($tags) && ($tags ne '')) {
|
if (defined ($tags) && ($tags ne '')) {
|
||||||
$module_tags = $tags
|
$module_tags = $tags
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (defined ($id_agentmodule) && $id_agentmodule > 0) {
|
if (defined ($id_agentmodule) && $id_agentmodule > 0) {
|
||||||
$module_tags = pandora_get_module_tags ($pa_config, $dbh, $id_agentmodule);
|
$module_tags = pandora_get_module_tags ($pa_config, $dbh, $id_agentmodule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Set default values for optional parameters
|
# Set default values for optional parameters
|
||||||
$source = 'Pandora' unless defined ($source);
|
$source = 'Pandora' unless defined ($source);
|
||||||
$comment = '' unless defined ($comment);
|
$comment = '' unless defined ($comment);
|
||||||
|
@ -2743,15 +2778,17 @@ Set the status of unknown modules.
|
||||||
sub pandora_module_unknown ($$) {
|
sub pandora_module_unknown ($$) {
|
||||||
my ($pa_config, $dbh) = @_;
|
my ($pa_config, $dbh) = @_;
|
||||||
|
|
||||||
my @modules = get_db_rows ($dbh, 'SELECT tagente_modulo.*, tagente_estado.id_agente_estado
|
my @modules = get_db_rows ($dbh, 'SELECT tagente_modulo.*,
|
||||||
FROM tagente_modulo, tagente_estado, tagente
|
tagente_estado.id_agente_estado
|
||||||
WHERE tagente.id_agente = tagente_estado.id_agente
|
FROM tagente_modulo, tagente_estado, tagente
|
||||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
WHERE tagente.id_agente = tagente_estado.id_agente
|
||||||
AND tagente.disabled = 0
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0
|
AND tagente.disabled = 0
|
||||||
AND tagente_estado.estado <> 3
|
AND tagente_modulo.disabled = 0
|
||||||
AND tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100)
|
AND tagente_estado.estado <> 3
|
||||||
AND (tagente_estado.current_interval = 0 OR (tagente_estado.current_interval * 2) + tagente_estado.utimestamp < UNIX_TIMESTAMP())');
|
AND tagente_modulo.id_tipo_modulo NOT IN (21, 22, 23, 100)
|
||||||
|
AND (tagente_estado.current_interval = 0
|
||||||
|
OR (tagente_estado.current_interval * 2) + tagente_estado.utimestamp < UNIX_TIMESTAMP())');
|
||||||
|
|
||||||
foreach my $module (@modules) {
|
foreach my $module (@modules) {
|
||||||
|
|
||||||
|
@ -2769,7 +2806,8 @@ sub pandora_module_unknown ($$) {
|
||||||
# Generate alerts
|
# Generate alerts
|
||||||
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
if (pandora_inhibit_alerts ($pa_config, $agent, $dbh, 0) == 0) {
|
||||||
pandora_generate_alerts ($pa_config, 0, 3, $agent, $module, time (), $dbh, undef, undef, 0, 'unknown');
|
pandora_generate_alerts ($pa_config, 0, 3, $agent, $module, time (), $dbh, undef, undef, 0, 'unknown');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
logger($pa_config, "Alerts inhibited for agent '" . $agent->{'nombre'} . "'.", 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,17 @@ our @ServerSuffixes;
|
||||||
# Server class constructor.
|
# Server class constructor.
|
||||||
########################################################################################
|
########################################################################################
|
||||||
sub new ($$$;$) {
|
sub new ($$$;$) {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $self = {
|
my $self = {
|
||||||
_pa_config => shift,
|
_pa_config => shift,
|
||||||
_server_id => 0,
|
_server_id => 0,
|
||||||
_server_type => shift,
|
_server_type => shift,
|
||||||
_dbh => shift,
|
_dbh => shift,
|
||||||
_num_threads => 1,
|
_num_threads => 1,
|
||||||
_threads => [],
|
_threads => [],
|
||||||
_queue_size => 0,
|
_queue_size => 0,
|
||||||
_errstr => ''
|
_errstr => ''
|
||||||
};
|
};
|
||||||
|
|
||||||
# Share variables that may be set from different threads
|
# Share variables that may be set from different threads
|
||||||
share ($self->{'_queue_size'});
|
share ($self->{'_queue_size'});
|
||||||
|
@ -54,12 +54,12 @@ sub new ($$$;$) {
|
||||||
|
|
||||||
# Thread kill signal handler
|
# Thread kill signal handler
|
||||||
#$SIG{'KILL'} = sub {
|
#$SIG{'KILL'} = sub {
|
||||||
# threads->exit() if threads->can('exit');
|
# threads->exit() if threads->can('exit');
|
||||||
# exit();
|
# exit();
|
||||||
#};
|
#};
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
Loading…
Reference in New Issue