2011-06-20 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Config.pm,,
	  lib/PandoraFMS/NetworkServer.pm: Added a new ICMP server (enterprise).

	* lib/PandoraFMS/Core.pm: Reset action thresholds when an alert
	  recovers.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4473 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2011-06-20 16:32:29 +00:00
parent a78c83b485
commit a47675f219
4 changed files with 37 additions and 9 deletions

View File

@ -1,3 +1,11 @@
2011-06-20 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Config.pm,,
lib/PandoraFMS/NetworkServer.pm: Added a new ICMP server (enterprise).
* lib/PandoraFMS/Core.pm: Reset action thresholds when an alert
recovers.
2011-06-20 Sergio Martin <sergio.martin@artica.es> 2011-06-20 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/DB.pm: Added quotes to process * lib/PandoraFMS/DB.pm: Added quotes to process

View File

@ -236,6 +236,9 @@ sub pandora_load_config {
$pa_config->{'openstreetmaps_description'} = 0; $pa_config->{'openstreetmaps_description'} = 0;
$pa_config->{"eventserver"} = 1; # 4.0 $pa_config->{"eventserver"} = 1; # 4.0
$pa_config->{"event_window"} = 3600; # 4.0 $pa_config->{"event_window"} = 3600; # 4.0
$pa_config->{"icmpserver"} = 1; # 4.0
$pa_config->{"icmp_threads"} = 3; # 4.0
$pa_config->{"block_size"} = 50; # 4.0
$pa_config->{"max_queue_files"} = 500; $pa_config->{"max_queue_files"} = 500;
@ -437,6 +440,12 @@ sub pandora_load_config {
elsif ($parametro =~ m/^eventserver\s([0-9]*)/i) { elsif ($parametro =~ m/^eventserver\s([0-9]*)/i) {
$pa_config->{'eventserver'}= clean_blank($1); $pa_config->{'eventserver'}= clean_blank($1);
} }
elsif ($parametro =~ m/^icmpserver\s([0-9]*)/i) {
$pa_config->{'icmpserver'}= clean_blank($1);
}
elsif ($parametro =~ m/^icmp_threads\s([0-9]*)/i) {
$pa_config->{'icmp_threads'}= clean_blank($1);
}
elsif ($parametro =~ m/^servername\s(.*)/i) { elsif ($parametro =~ m/^servername\s(.*)/i) {
$pa_config->{'servername'}= clean_blank($1); $pa_config->{'servername'}= clean_blank($1);
} }
@ -588,6 +597,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^event_window\s([0-9]*)/i) { elsif ($parametro =~ m/^event_window\s([0-9]*)/i) {
$pa_config->{'event_window'}= clean_blank($1); $pa_config->{'event_window'}= clean_blank($1);
} }
elsif ($parametro =~ m/^block_size\s([0-9]*)/i) {
$pa_config->{'block_size'}= clean_blank($1);
}
} # end of loop for parameter # } # end of loop for parameter #
if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){ if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){

View File

@ -170,7 +170,7 @@ our @EXPORT = qw(
# Some global variables # Some global variables
our @DayNames = qw(sunday monday tuesday wednesday thursday friday saturday); our @DayNames = qw(sunday monday tuesday wednesday thursday friday saturday);
our @ServerTypes = qw (dataserver networkserver snmpconsole reconserver pluginserver predictionserver wmiserver exportserver inventoryserver webserver eventserver); our @ServerTypes = qw (dataserver networkserver snmpconsole reconserver pluginserver predictionserver wmiserver exportserver inventoryserver webserver eventserver icmpserver);
our @AlertStatus = ('Execute the alert', 'Do not execute the alert', 'Do not execute the alert, but increment its internal counter', 'Cease the alert', 'Recover the alert', 'Reset internal counter'); our @AlertStatus = ('Execute the alert', 'Do not execute the alert', 'Do not execute the alert, but increment its internal counter', 'Cease the alert', 'Recover the alert', 'Reset internal counter');
########################################################################## ##########################################################################
@ -410,6 +410,11 @@ sub pandora_process_alert ($$$$$$$$;$) {
db_do($dbh, 'UPDATE ' . $table . ' SET times_fired = 0, db_do($dbh, 'UPDATE ' . $table . ' SET times_fired = 0,
internal_counter = 0 WHERE id = ?', $id); internal_counter = 0 WHERE id = ?', $id);
# Reset action thresholds
if (defined ($alert->{'id_template_module'})) {
db_do($dbh, 'UPDATE talert_template_module_actions SET last_execution = 0 WHERE id_alert_template_module = ?', $id);
}
pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 0, $dbh, $timestamp, $extra_macros); pandora_execute_alert ($pa_config, $data, $agent, $module, $alert, 0, $dbh, $timestamp, $extra_macros);
return; return;
} }
@ -578,7 +583,8 @@ sub pandora_execute_alert ($$$$$$$$;$) {
# Simple alert # Simple alert
if (defined ($alert->{'id_template_module'})) { if (defined ($alert->{'id_template_module'})) {
@actions = get_db_rows ($dbh, 'SELECT * FROM talert_template_module_actions, talert_actions, talert_commands @actions = get_db_rows ($dbh, 'SELECT *, talert_template_module_actions.id AS id_alert_template_module_actions
FROM talert_template_module_actions, talert_actions, talert_commands
WHERE talert_template_module_actions.id_alert_action = talert_actions.id WHERE talert_template_module_actions.id_alert_action = talert_actions.id
AND talert_actions.id_alert_command = talert_commands.id AND talert_actions.id_alert_command = talert_commands.id
AND talert_template_module_actions.id_alert_template_module = ? AND talert_template_module_actions.id_alert_template_module = ?
@ -755,8 +761,8 @@ sub pandora_execute_action ($$$$$$$$$;$) {
} }
# Update action last execution date # Update action last execution date
if (defined ($action->{'last_execution'}) && defined ($action->{'id'})) { if (defined ($action->{'last_execution'}) && defined ($action->{'id_alert_template_module_actions'})) {
db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ? WHERE id = ?', time (), $action->{'id'}); db_do ($dbh, 'UPDATE talert_template_module_actions SET last_execution = ? WHERE id = ?', time (), $action->{'id_alert_template_module_actions'});
} }
} }

View File

@ -95,8 +95,9 @@ sub data_producer ($) {
AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_agente = tagente.id_agente
AND tagente.disabled = 0 AND tagente.disabled = 0
AND tagente_modulo.id_tipo_modulo > 4 AND tagente_modulo.id_tipo_modulo > 4
AND tagente_modulo.id_tipo_modulo < 19 AND tagente_modulo.id_tipo_modulo < 19'
AND tagente_modulo.disabled = 0 . enterprise_hook ('get_network_filter', []) .
'AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())) AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()))
ORDER BY tagente_modulo.flag DESC, time_left DESC, tagente_estado.last_execution_try ASC ', $pa_config->{'servername'}); ORDER BY tagente_modulo.flag DESC, time_left DESC, tagente_estado.last_execution_try ASC ', $pa_config->{'servername'});
@ -108,8 +109,9 @@ sub data_producer ($) {
AND tagente.disabled = 0 AND tagente.disabled = 0
AND tagente_modulo.disabled = 0 AND tagente_modulo.disabled = 0
AND tagente_modulo.id_tipo_modulo > 4 AND tagente_modulo.id_tipo_modulo > 4
AND tagente_modulo.id_tipo_modulo < 19 AND tagente_modulo.id_tipo_modulo < 19'
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo . enterprise_hook ('get_network_filter', []) .
'AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())) AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()))
ORDER BY tagente_modulo.flag DESC, time_left DESC, tagente_estado.last_execution_try ASC', $pa_config->{'servername'}); ORDER BY tagente_modulo.flag DESC, time_left DESC, tagente_estado.last_execution_try ASC', $pa_config->{'servername'});
} }