2009-05-04 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Reset server status at start-up in case the
	  server did not cleanly shut down the last time.

	* bin/pandora_server: Fixed min_ff_event calculation.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1676 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2009-05-04 19:03:15 +00:00
parent d88f81a51c
commit 5f91d81532
3 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,13 @@
2009-05-04 Ramon Novoa <rnovoa@artica.es> 2009-05-04 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Reset server status at start-up in case the
server did not cleanly shut down the last time.
* bin/pandora_server: Fixed min_ff_event calculation.
2009-05-04 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/DB.pm: Enabled mysql_auto_reconnect. * lib/PandoraFMS/DB.pm: Enabled mysql_auto_reconnect.
* lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm, * lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/PluginServer.pm,

View File

@ -83,6 +83,7 @@ pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System
pandora_start_log (\%Config); pandora_start_log (\%Config);
# Load servers # Load servers
pandora_reset_server (\%Config, $DBH);
push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::ReconServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::ReconServer (\%Config, $DBH));

View File

@ -57,6 +57,7 @@ our @EXPORT = qw(
pandora_planned_downtime pandora_planned_downtime
pandora_process_alert pandora_process_alert
pandora_process_module pandora_process_module
pandora_reset_server
pandora_server_keep_alive pandora_server_keep_alive
pandora_update_agent pandora_update_agent
pandora_update_module_on_error pandora_update_module_on_error
@ -528,11 +529,11 @@ sub pandora_process_module ($$$$$$$$$) {
($agent_status->{'status_changes'} + 1, $agent_status->{'last_status'}); ($agent_status->{'status_changes'} + 1, $agent_status->{'last_status'});
# Generate events # Generate events
if ($status_changes == $module->{'min_ff_event'}) { if ($status_changes == $module->{'min_ff_event'} + 1) {
generate_status_event ($pa_config, $data, $agent, $module, $status, $last_status, $dbh); generate_status_event ($pa_config, $data, $agent, $module, $status, $last_status, $dbh);
} }
# tagente_estado.last_try dafaults to NULL, should default to '0000-00-00 00:00:00' # tagente_estado.last_try defaults to NULL, should default to '0000-00-00 00:00:00'
$agent_status->{'last_try'} = '0000-00-00 00:00:00' unless defined ($agent_status->{'last_try'}); $agent_status->{'last_try'} = '0000-00-00 00:00:00' unless defined ($agent_status->{'last_try'});
# Do we have to save module data? # Do we have to save module data?
@ -590,6 +591,15 @@ sub pandora_planned_downtime ($$) {
} }
} }
##########################################################################
# Reset the status of all server types for the current server.
##########################################################################
sub pandora_reset_server ($$) {
my ($pa_config, $dbh) = @_;
db_do ($dbh, 'UPDATE tserver SET status = 0, threads = 0, queued_modules = 0 WHERE name = ?', $pa_config->{'servername'});
}
########################################################################## ##########################################################################
# Update server status: 0 dataserver, 1 network server, 2 snmp console, # Update server status: 0 dataserver, 1 network server, 2 snmp console,
# 3 recon, 4 plugin, 5 prediction, 6 wmi. # 3 recon, 4 plugin, 5 prediction, 6 wmi.