mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
2009-12-23 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/Core.pm: Fixed some typos in planned downtime subroutine. * bin/pandora_server: Some operations like planned downtime check and server down detection are put in a low-priority check, more efficient and less time-consuming. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2235 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
569d49bd22
commit
c8273efad4
@ -1,3 +1,11 @@
|
||||
2009-12-23 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Fixed some typos in planned downtime subroutine.
|
||||
|
||||
* bin/pandora_server: Some operations like planned downtime check and
|
||||
server down detection are put in a low-priority check, more efficient and
|
||||
less time-consuming.
|
||||
|
||||
2009-12-21 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Fixed agent check in logger call.
|
||||
|
@ -164,7 +164,7 @@ foreach my $server (@Servers) {
|
||||
|
||||
# Main loop
|
||||
my $time_ref = time ();
|
||||
my $mcast_timer = 0;
|
||||
my $task_timer = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
@ -179,16 +179,24 @@ while (1) {
|
||||
# Update fallen servers
|
||||
db_do ($DBH, "UPDATE tserver SET status = 0 WHERE keepalive < ?", strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - $Config{'keepalive'})));
|
||||
|
||||
pandora_planned_downtime (\%Config, $DBH);
|
||||
pandora_exec_forced_alerts (\%Config, $DBH);
|
||||
|
||||
pandora_module_keep_alive_nd (\%Config, $DBH);
|
||||
|
||||
# Multicast status report each 30 x Server Threshold secs
|
||||
if ($mcast_timer > 30){
|
||||
# Tasks executed only each Server Threshold x 30 secs, for low-priority tasks
|
||||
|
||||
if ($task_timer > 30){
|
||||
# Multicast status report each 30 x Server Threshold secs
|
||||
enterprise_hook('mcast_status_report', [\%Config, $DBH]);
|
||||
$mcast_timer = 0;
|
||||
$task_timer = 0;
|
||||
|
||||
# Downtimes are executed only 30 x Server Threshold secs
|
||||
pandora_planned_downtime (\%Config, $DBH);
|
||||
|
||||
# Update fallen servers
|
||||
db_do ($DBH, "UPDATE tserver SET status = 0 WHERE keepalive < ?", strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - $Config{'keepalive'})));
|
||||
}
|
||||
$mcast_timer++;
|
||||
$task_timer++;
|
||||
};
|
||||
|
||||
# Restart on error or auto restart
|
||||
|
@ -626,15 +626,15 @@ sub pandora_planned_downtime ($$) {
|
||||
|
||||
foreach my $downtime (@downtimes) {
|
||||
|
||||
logger($pa_config, "Starting planned downtime '" . $downtime->{'nombre'} . "'.", 10);
|
||||
logger($pa_config, "Starting planned downtime '" . $downtime->{'name'} . "'.", 10);
|
||||
|
||||
db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'});
|
||||
pandora_event ($pa_config, "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', $dbh);
|
||||
|
||||
my @downtime_agents = db_do($dbh, 'SELECT * FROM tplanned_downtime_agents WHERE id_downtime = ' . $downtime->{'id'});
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT * FROM tplanned_downtime_agents WHERE id_downtime = ' . $downtime->{'id'});
|
||||
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled = 1 WHERE id_grupo = ?', $downtime_agent->{'id_group'});
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled = 1 WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,15 +642,16 @@ sub pandora_planned_downtime ($$) {
|
||||
@downtimes = get_db_rows($dbh, 'SELECT * FROM tplanned_downtime WHERE executed = 1 AND date_to <= ?', $utimestamp);
|
||||
foreach my $downtime (@downtimes) {
|
||||
|
||||
logger($pa_config, "Ending planned downtime '" . $downtime->{'nombre'} . "'.", 10);
|
||||
logger($pa_config, "Ending planned downtime '" . $downtime->{'name'} . "'.", 10);
|
||||
|
||||
db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'});
|
||||
|
||||
pandora_event ($pa_config, 'Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'description'}, 0, 0, 1, 0, 0, 'system', $dbh);
|
||||
|
||||
my @downtime_agents = get_db_rows($dbh, 'SELECT * FROM tplanned_downtime_agents WHERE id_downtime = ' . $downtime->{'id'});
|
||||
|
||||
foreach my $downtime_agent (@downtime_agents) {
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled = 0 WHERE id_agrupo = ?', $downtime_agent->{'id_group'});
|
||||
db_do ($dbh, 'UPDATE tagente SET disabled = 0 WHERE id_agente = ?', $downtime_agent->{'id_agent'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user