2008-08-21 Sancho Lerena <slerena@gmail.com>

* lib/PandoraFMS/DB.pm, bin/pandora_server: Enabled again 
        downtime scheduler. Now works fine, tested.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1018 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-08-21 19:03:19 +00:00
parent 84a0a1f22f
commit 4081e8301b
3 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-08-21 Sancho Lerena <slerena@gmail.com>
* lib/PandoraFMS/DB.pm, bin/pandora_server: Enabled again
downtime scheduler. Now works fine, tested.
2008-08-07 Sancho Lerena <slerena@gmail.com>
* bin/pandora_server: Disabled downtime server code until

View File

@ -94,7 +94,7 @@ my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost:3306",
while (1) {
pandora_serverkeepaliver (\%pa_config, 0, $dbh);
# Disabled until we can finish code from editor and update server code
# pandora_planned_downtime (\%pa_config, $dbh);
pandora_planned_downtime (\%pa_config, $dbh);
keep_alive_check (\%pa_config, $dbh);
threads->yield;
sleep ($pa_config{"server_threshold"});

View File

@ -1329,13 +1329,14 @@ sub pandora_planned_downtime (%$) {
my $query_handle;
my $query_handle2;
my $query_sql;
my $datestamp = &UnixDate("today","%Y-%m-%d");
my $timestamp = &UnixDate("today","%H:%M:%S");
my $timestamp = &UnixDate("today","%Y-%m-%d %H:%M:%S");
my $utimestamp; # integer version of timestamp
$utimestamp = &UnixDate($timestamp,"%s"); # convert from
# Activate a planned downtime: Set agents as disabled for Planned Downtime
$query_sql = "SELECT * FROM tplanned_downtime WHERE executed = 0 AND start <= '$datestamp' AND start_time <= '$timestamp' AND stop >= '$datestamp' AND stop_time >'$timestamp' ";
$query_sql = "SELECT * FROM tplanned_downtime WHERE executed = 0 AND date_from <= $utimestamp AND date_to >= $utimestamp";
$query_handle = $dbh->prepare($query_sql);
$query_handle ->execute;
@ -1359,7 +1360,7 @@ sub pandora_planned_downtime (%$) {
# Deactivate a planned downtime: Set agents as disabled for Planned Downtime
$query_sql = "SELECT * FROM tplanned_downtime WHERE executed = 1 AND stop <= '$datestamp' AND stop_time <= '$timestamp'";
$query_sql = "SELECT * FROM tplanned_downtime WHERE executed = 1 AND date_to <= $utimestamp";
$query_handle = $dbh->prepare($query_sql);
$query_handle ->execute;
if ($query_handle->rows != 0) {