diff --git a/behat.yml b/behat.yml index 70cd23304c9..39f68ba9397 100644 --- a/behat.yml +++ b/behat.yml @@ -101,6 +101,10 @@ default: paths: [ %paths.base%/features/DowntimeStartAndStop.feature ] contexts: [ DowntimeStartAndStopContext ] + downtime_dst: + paths: [ %paths.base%/features/DowntimeDST.feature ] + contexts: [ DowntimeDSTContext ] + command_arguments: paths: [ %paths.base%/features/CommandArguments.feature ] contexts: [ CommandArgumentsContext ] diff --git a/features/DowntimeDST.feature b/features/DowntimeDST.feature new file mode 100644 index 00000000000..560ff1bb0f4 --- /dev/null +++ b/features/DowntimeDST.feature @@ -0,0 +1,132 @@ +Feature: Downtime DST + As a Centreon user + I want to be certain that the downtimes work correctly with DST + To release quality products + + Background: + Given I am logged in a Centreon server located at "Europe/Paris" + And a passive service is monitored + + +# summer changing time + + @critical + Scenario: realtime downtime starting on summer changing time + Given a downtime starting on summer changing time + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime starting on summer changing time + Given a downtime starting on summer changing time + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime ending on summer changing time + Given a downtime ending on summer changing time + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime ending on summer changing time + Given a downtime ending on summer changing time + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime starting and ending on summer changing time + Given a downtime starting and ending on summer changing time + When recurrent downtime is applied + Then the downtime is not scheduled + + @critical + Scenario: realtime downtime starting and ending on summer changing time + Given a downtime starting and ending on summer changing time + When realtime downtime is applied + Then the downtime is not scheduled + + @critical + Scenario: recurrent downtime during all day on summer changing date + Given a downtime during all day on summer changing date + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime during all day on summer changing date + Given a downtime during all day on summer changing date + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime of next day of summer changing date + Given a downtime during all day on summer changing date is scheduled + And a downtime of next day of summer changing date + When recurrent downtime is applied + Then the downtime is properly scheduled + + + +# winter changing time + + @critical + Scenario: recurrent downtime starting on winter changing time + Given a downtime starting on winter changing time + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime starting on winter changing time + Given a downtime starting on winter changing time + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime ending on winter changing time + Given a downtime ending on winter changing time + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime ending on winter changing time + Given a downtime ending on winter changing time + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime starting and ending on winter changing time + Given a downtime starting and ending on winter changing time + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime starting and ending on winter changing time + Given a downtime starting and ending on winter changing time + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime during all day on winter changing date + Given a downtime during all day on winter changing date + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime during all day on winter changing date + Given a downtime during all day on winter changing date + When realtime downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: recurrent downtime of next day of winter changing date + Given a downtime during all day on winter changing date is scheduled + And a downtime of next day of winter changing date + When recurrent downtime is applied + Then the downtime is properly scheduled + + @critical + Scenario: realtime downtime of next day of winter changing date + Given a downtime during all day on winter changing date is scheduled + And a downtime of next day of winter changing date + When realtime downtime is applied + Then the downtime is properly scheduled \ No newline at end of file diff --git a/features/bootstrap/DowntimeDSTContext.php b/features/bootstrap/DowntimeDSTContext.php new file mode 100644 index 00000000000..ff92f155301 --- /dev/null +++ b/features/bootstrap/DowntimeDSTContext.php @@ -0,0 +1,392 @@ +page = new RecurrentDowntimeConfigurationPage($this); + + $this->page->setProperties(array( + 'name' => 'test', + 'alias' => $this->service, + 'days' => array(7, 1, 2, 3, 4, 5, 6), + 'start' => $this->downtimeProperties['start_time'], + 'end' => $this->downtimeProperties['end_time'], + 'svc_relation' => $this->host . ' - ' . $this->service + )); + + $this->page->save(); + } + + private function setRealtimeDowntime() + { + $this->page = new DowntimeConfigurationPage($this); + + $this->page->setProperties(array( + 'type' => DowntimeConfigurationPage::TYPE_SERVICE, + 'service' => $this->host . ' - ' . $this->service, + 'comment' => 'Acceptance test', + 'start_day' => $this->downtimeProperties['start_day'], + 'start_time' => $this->downtimeProperties['start_time'], + 'end_day' => $this->downtimeProperties['end_day'], + 'end_time' => $this->downtimeProperties['end_time'], + )); + + $this->page->save(); + } + + /** + * @Given a passive service is monitored + */ + public function aPassiveServiceIsMonitored() + { + $page = new ServiceConfigurationPage($this); + $page->setProperties(array( + 'hosts' => $this->host, + 'description' => $this->service, + 'templates' => 'generic-service', + 'check_command' => 'check_centreon_dummy', + 'check_period' => '24x7', + 'max_check_attempts' => 1, + 'normal_check_interval' => 1, + 'retry_check_interval' => 1, + 'active_checks_enabled' => 0, + 'passive_checks_enabled' => 1, + 'notifications_enabled' => 1, + 'notify_on_recovery' => 1, + 'notify_on_critical' => 1, + 'recovery_notification_delay' => 1, + 'cs' => 'admin_admin' + )); + $page->save(); + + $this->reloadAllPollers(); + $this->submitServiceResult($this->host, $this->service, 0, __FUNCTION__); + $this->waitServiceInMonitoring(); + } + + private function waitServiceInMonitoring() + { + $this->spin( + function ($context) { + $monitored = false; + $storageDb = $context->getStorageDatabase(); + $res = $storageDb->query( + 'SELECT s.service_id ' . + 'FROM hosts h, services s ' . + 'WHERE s.host_id = h.host_id ' . + 'AND h.name = "' . $context->host . '" ' . + 'AND s.description = "' . $context->service . '" ' + ); + if ($res->fetch()) { + $monitored = true; + } + return $monitored; + }, + 'Service ' . $this->host . ' / ' . $this->service . ' is not monitored.', + 30 + ); + } + + /** + * @Given a downtime starting on summer changing time + */ + public function aDowntimeStartingOnSummerChangingTime() + { + // on Europe/Paris at 2AM, we jump to 3AM + $this->downtimeProperties = array( + 'start_day' => '03/28/2021', + 'start_time' => '02:30', + 'end_day' => '03/28/2021', + 'end_time' => '03:30', + 'expected_start' => '2021-03-28 03:00', + 'expected_end' => '2021-03-28 03:30', + 'expected_duration' => '1800', // 30m + 'faketime' => '2021-03-28 01:56:00' + ); + } + + /** + * @Given a downtime ending on summer changing time + */ + public function aDowntimeEndingOnSummerChangingTime() + { + // on Europe/Paris at 2AM, we jump to 3AM + $this->downtimeProperties = array( + 'start_day' => '03/28/2021', + 'start_time' => '01:30', + 'end_day' => '03/28/2021', + 'end_time' => '02:30', + 'expected_start' => '2021-03-28 01:30', + 'expected_end' => '2021-03-28 03:00', + 'expected_duration' => '1800', // 30m + 'faketime' => '2021-03-28 01:26:00' + ); + } + + /** + * @Given a downtime starting and ending on summer changing time + */ + public function aDowntimeStartingAndEndingOnSummerChangingTime() + { + // on Europe/Paris at 2AM, we jump to 3AM + $this->downtimeProperties = array( + 'start_day' => '03/28/2021', + 'start_time' => '02:03', + 'end_day' => '03/28/2021', + 'end_time' => '02:33', + 'expected_start' => '', + 'expected_end' => '', + 'expected_duration' => '0', + 'faketime' => '2021-03-28 01:58:00' + ); + } + + /** + * @Given a downtime during all day on summer changing date + */ + public function aDowntimeDuringAllDayOnSummerChangingDate() + { + // on Europe/Paris at 2AM, we jump to 3AM + $this->downtimeProperties = array( + 'start_day' => '03/28/2021', + 'start_time' => '00:00', + 'end_day' => '03/28/2021', + 'end_time' => '24:00', + 'expected_start' => '2021-03-28 00:00', + 'expected_end' => '2021-03-29 00:00', + 'expected_duration' => '82800', // 23h + 'faketime' => '2021-03-27 23:56:00' + ); + } + + /** + * @Given a downtime during all day on summer changing date is scheduled + */ + public function aDowntimeDuringAllDayOnSummerChangingDateIsScheduled() + { + $this->aDowntimeDuringAllDayOnSummerChangingDate(); + $this->downtimeIsApplied('recurrent'); + $this->theDowntimeIsProperlyScheduled(); + } + + /** + * @Given a downtime of next day of summer changing date + */ + public function aDowntimeOfNextDayOfSummerChangingDate() + { + $this->downtimeProperties = array( + 'start_day' => '03/29/2021', + 'start_time' => '00:00', + 'end_day' => '03/29/2021', + 'end_time' => '24:00', + 'expected_start' => '2021-03-29 00:00', + 'expected_end' => '2021-03-30 00:00', + 'expected_duration' => '86400', // 24h + 'faketime' => '2021-03-28 23:58:00' + ); + } + + /** + * @Given a downtime starting on winter changing time + */ + public function aDowntimeStartingOnWinterChangingDate() + { + // on Europe/Paris at 3AM, backward to 2AM + $this->downtimeProperties = array( + 'start_day' => '10/31/2021', + 'start_time' => '02:03', + 'end_day' => '10/31/2021', + 'end_time' => '03:33', + 'expected_start' => '2021-10-31 02:03', + 'expected_end' => '2021-10-31 03:33', + 'expected_duration' => '9000', // 2h30 + 'faketime' => '2021-10-31 01:58:00' + ); + } + + /** + * @Given a downtime ending on winter changing time + */ + public function aDowntimeEndingOnWinterChangingDate() + { + // on Europe/Paris at 3AM, backward to 2AM + $this->downtimeProperties = array( + 'start_day' => '10/31/2021', + 'start_time' => '01:00', + 'end_day' => '10/31/2021', + 'end_time' => '02:30', + 'expected_start' => '2021-10-31 01:00', + 'expected_end' => '2021-10-31 02:30', + 'expected_duration' => '9000', // 2h30 + 'faketime' => '2021-10-31 00:58:00' + ); + } + + /** + * @Given a downtime starting and ending on winter changing time + */ + public function aDowntimeStartingAndEndingOnWinterChangingDate() + { + // on Europe/Paris at 3AM, backward to 2AM + $this->downtimeProperties = array( + 'start_day' => '10/31/2021', + 'start_time' => '02:03', + 'end_day' => '10/31/2021', + 'end_time' => '02:33', + 'expected_start' => '2021-10-31 02:03', + 'expected_end' => '2021-10-31 02:33', + 'expected_duration' => '5400', // 1h30 + 'faketime' => '2021-10-31 01:58:00' + ); + } + + /** + * @Given a downtime during all day on winter changing date + */ + public function aDowntimeDuringAllDayOnWinterChangingDate() + { + // on Europe/Paris at 3AM, backward to 2AM + $this->downtimeProperties = array( + 'start_day' => '10/31/2021', + 'start_time' => '00:00', + 'end_day' => '10/31/2021', + 'end_time' => '24:00', + 'expected_start' => '2021-10-31 00:00', + 'expected_end' => '2021-11-01 00:00', + 'expected_duration' => '90000', // 25h + 'faketime' => '2021-10-30 23:58:00' + ); + } + + /** + * @Given a downtime during all day on winter changing date is scheduled + */ + public function aDowntimeDuringAllDayOnWinterChangingDateIsScheduled() + { + $this->aDowntimeDuringAllDayOnWinterChangingDate(); + $this->downtimeIsApplied('recurrent'); + $this->theDowntimeIsProperlyScheduled(); + } + + /** + * @Given a downtime of next day of winter changing date + */ + public function aDowntimeOfNextDayOfWinterChangingDate() + { + $this->downtimeProperties = array( + 'start_day' => '11/01/2021', + 'start_time' => '00:00', + 'end_day' => '11/01/2021', + 'end_time' => '24:00', + 'expected_start' => '2021-11-01 00:00', + 'expected_end' => '2021-11-02 00:00', + 'expected_duration' => '86400', // 24h + 'faketime' => '2021-10-31 23:58:00' + ); + } + + /** + * @When :downtimeType downtime is applied + */ + public function downtimeIsApplied($downtimeType) + { + if ($downtimeType == 'realtime') { + $this->setRealtimeDowntime(); + } else { + $this->setRecurrentDowntime(); + $this->container->execute( + "faketime '" . $this->downtimeProperties['faketime'] . "'" . + " php /usr/share/centreon/cron/downtimeManager.php", + 'web' + ); + } + } + + /** + * @Then the downtime is properly scheduled + */ + public function theDowntimeIsProperlyScheduled() + { + $this->spin( + function ($context) { + $scheduled = false; + $return = $context->container->execute( + "cat /var/log/centreon-engine/centengine.log", + 'web' + ); + $output = $return['output']; + if (preg_match_all( + '/SCHEDULE_SVC_DOWNTIME;' . $context->host . ';' . $context->service . ';(\d+);(\d+);.+/', + $output, + $matches + )) { + $startTimestamp = end($matches[1]); + $endTimestamp = end($matches[2]); + $dateStart = new DateTime('now', new \DateTimeZone('Europe/Paris')); + $dateStart->setTimestamp($startTimestamp); + $dateEnd = new DateTime('now', new \DateTimeZone('Europe/Paris')); + $dateEnd->setTimestamp($endTimestamp); + if ($dateStart->format('Y-m-d H:i') == $context->downtimeProperties['expected_start'] && + $dateEnd->format('Y-m-d H:i') == $context->downtimeProperties['expected_end'] && + ($endTimestamp - $startTimestamp) == $context->downtimeProperties['expected_duration']) { + $scheduled = true; + } + $storageDb = $context->getStorageDatabase(); + $res = $storageDb->query( + "SELECT downtime_id FROM downtimes " . + "WHERE start_time = " . $startTimestamp . " " . + "AND end_time = " . $endTimestamp + ); + if (!$res->fetch()) { + $scheduled = false; + } + } + + return $scheduled; + }, + 'Downtime is not scheduled', + 10 + ); + } + + /** + * @Then the downtime is not scheduled + */ + public function theDowntimeIsNotScheduled() + { + $this->spin( + function ($context) { + $scheduled = true; + $return = $context->container->execute( + "cat /var/log/centreon-engine/centengine.log", + 'web' + ); + $output = $return['output']; + if (preg_match( + '/SCHEDULE_SVC_DOWNTIME;' . $this->host . ';' . $this->service . ';(\d+);(\d+);.+/', + $output + )) { + $scheduled = false; + } + + return $scheduled; + }, + 'Downtime is scheduled', + 10 + ); + } +} diff --git a/www/class/centreonDowntime.Broker.class.php b/www/class/centreonDowntime.Broker.class.php index c45c36690b7..c21598987e8 100644 --- a/www/class/centreonDowntime.Broker.class.php +++ b/www/class/centreonDowntime.Broker.class.php @@ -292,6 +292,20 @@ private function manageWinterToSummerTimestamp($time, $timestamp, $timezone) return $timestamp; } + private function manageSummerToWinterTimestamp($timestamp, $timezone) + { + $dstDate = new DateTime('now', $timezone); + $dstDate->setTimestamp($timestamp); + $dateTime2 = clone $dstDate; + $dateTime2->setTimestamp($timestamp - 3600); + + if ($dateTime2->getTimestamp() == $dstDate->getTimestamp()) { + $timestamp = $timestamp - 3600; + } + + return $timestamp; + } + public function getApproachingDowntimes($delay) { $approachingDowntimes = array(); @@ -323,11 +337,6 @@ public function getApproachingDowntimes($delay) $endTime = $this->setTime($downtime['dtp_end_time'], $timezone, $tomorrow); $endTimestamp = $endTime->getTimestamp(); - # Check if HH:mm time is approaching - if (!$this->isApproachingTime($startTimestamp, $startDelay->getTimestamp(), $endDelay->getTimestamp())) { - continue; - } - # Check if we jump an hour $startTimestamp = $this->manageWinterToSummerTimestamp($startTime, $startTimestamp, $timezone); $endTimestamp = $this->manageWinterToSummerTimestamp($endTime, $endTimestamp, $timezone); @@ -335,6 +344,14 @@ public function getApproachingDowntimes($delay) continue; } + # Check if HH:mm time is approaching + if (!$this->isApproachingTime($startTimestamp, $startDelay->getTimestamp(), $endDelay->getTimestamp())) { + continue; + } + + # check backward of one hour + $startTimestamp = $this->manageSummerToWinterTimestamp($startTimestamp, $timezone); + $approaching = false; if (preg_match('/^\d(,\d)*$/', $downtime['dtp_day_of_week']) && preg_match('/^(none)|(all)$/', $downtime['dtp_month_cycle'])) { $approaching = $this->isWeeklyApproachingDowntime( diff --git a/www/class/centreonExternalCommand.class.php b/www/class/centreonExternalCommand.class.php index 377131592ef..59207b2dfdb 100644 --- a/www/class/centreonExternalCommand.class.php +++ b/www/class/centreonExternalCommand.class.php @@ -400,6 +400,43 @@ public function acknowledgeService( * Downtime ***********/ + private function getDowntimeTimestampFromDate($date = 'now', $timezone = '', $start = true) + { + $dateTime = new \DateTime($date, new \DateTimeZone($timezone)); + + // Winter to summer dst + $dateTime2 = clone $dateTime; + $dateTime2->setTimestamp($dateTime2->getTimestamp()); + if ($dateTime2->format("H") != $dateTime->format("H")) { + $hour = $dateTime->format('H'); + $dateTime->setTime($hour, '00'); + return $dateTime->getTimestamp(); + } + + // Summer to winter dst + $dateTime3 = clone $dateTime; + $dateTime3 = $dateTime3->setTimestamp($dateTime3->getTimestamp() - 3600); + if ($dateTime3->getTimestamp() == $dateTime->getTimestamp()) { + if ($start) { + return $dateTime3->getTimestamp() - 3600; + } else { + return $dateTime3->getTimestamp(); + } + } + + $dateTime4 = clone $dateTime; + $dateTime4 = $dateTime3->setTimestamp($dateTime4->getTimestamp() + 3600); + if ($dateTime4->getTimestamp() == $dateTime->getTimestamp()) { + if ($start) { + return $dateTime->getTimestamp(); + } else { + return $dateTime4->getTimestamp() + 3600; + } + } + + return $dateTime->getTimestamp(); + } + /** * * Delete downtimes. @@ -447,17 +484,16 @@ public function addHostDowntime( } if ($hostOrCentreonTime == "0") { - $start_time = $this->GMT->getUTCDateFromString( - $start, - $this->GMT->getMyGTMFromUser($this->userId) - ); - $end_time = $this->GMT->getUTCDateFromString( - $end, - $this->GMT->getMyGTMFromUser($this->userId) - ); + $timezoneId = $this->GMT->getMyGTMFromUser($this->userId); } else { - $start_time = $this->GMT->getUTCDateFromString($start, $this->GMT->getUTCLocationHost($host)); - $end_time = $this->GMT->getUTCDateFromString($end, $this->GMT->getUTCLocationHost($host)); + $timezoneId = $this->GMT->getUTCLocationHost($host); + } + $timezone = $this->GMT->getActiveTimezone($timezoneId); + $start_time = $this->getDowntimeTimestampFromDate($start, $timezone, true); + $end_time = $this->getDowntimeTimestampFromDate($end, $timezone, false); + + if ($end_time == $start_time) { + return; } /* @@ -469,7 +505,7 @@ public function addHostDowntime( * Send command */ if (!isset($duration)) { - $duration = $start_time - $end_time; + $duration = $end_time - $start_time; } $finalHostName = ''; if (!is_numeric($host)) { @@ -524,17 +560,17 @@ public function addSvcDowntime( } if ($hostOrCentreonTime == "0") { - $start_time = $this->GMT->getUTCDateFromString( - $start, - $this->GMT->getMyGTMFromUser($centreon->userId) - ); - $end_time = $this->GMT->getUTCDateFromString( - $end, - $this->GMT->getMyGTMFromUser($centreon->userId) - ); + $timezoneId = $this->GMT->getMyGTMFromUser($this->userId); } else { - $start_time = $this->GMT->getUTCDateFromString($start, $this->GMT->getUTCLocationHost($host)); - $end_time = $this->GMT->getUTCDateFromString($end, $this->GMT->getUTCLocationHost($host)); + $timezoneId = $this->GMT->getUTCLocationHost($host); + } + + $timezone = $this->GMT->getActiveTimezone($timezoneId); + $start_time = $this->getDowntimeTimestampFromDate($start, $timezone, true); + $end_time = $this->getDowntimeTimestampFromDate($end, $timezone, false); + + if ($end_time == $start_time) { + return; } /* @@ -546,7 +582,7 @@ public function addSvcDowntime( * Send command */ if (!isset($duration)) { - $duration = $start_time - $end_time; + $duration = $end_time - $start_time; } $finalHostName = ''; if (!is_numeric($host)) { diff --git a/www/class/centreonGMT.class.php b/www/class/centreonGMT.class.php index 03de8afffc7..1085fa508f6 100644 --- a/www/class/centreonGMT.class.php +++ b/www/class/centreonGMT.class.php @@ -71,6 +71,12 @@ class CentreonGMT */ protected $hostLocations = array(); + /** + * + * @param array $pollerLocations + */ + protected $pollerLocations = array(); + /** * Default timezone setted in adminstration/options * @var string $sDefaultTimezone @@ -495,17 +501,46 @@ public function getHostLocations() return $this->hostLocations; } + $this->getPollerLocations(); + $this->hostLocations = array(); - $query = 'SELECT host_id, timezone FROM hosts WHERE enabled = 1 '; + $query = 'SELECT host_id, instance_id, timezone FROM hosts WHERE enabled = 1 '; $res = $this->dbc->query($query); if (!PEAR::isError($res)) { while ($row = $res->fetchRow()) { - $this->hostLocations[$row['host_id']] = str_replace(':', '', $row['timezone']); + if ($row['timezone'] == "" && isset($this->pollerLocations[$row['instance_id']])) { + $this->hostLocations[$row['host_id']] = $this->pollerLocations[$row['instance_id']]; + } else { + $this->hostLocations[$row['host_id']] = str_replace(':', '', $row['timezone']); + } } } return $this->hostLocations; } + + /** + * Get list of timezone of pollers + * @return array + */ + public function getPollerLocations() + { + if (count($this->pollerLocations)) { + return $this->pollerLocations; + } + + $query = 'SELECT ns.id, t.timezone_name ' . + 'FROM cfg_nagios cfgn, nagios_server ns, timezone t ' . + 'WHERE cfgn.nagios_activate = "1" ' . + 'AND cfgn.nagios_server_id = ns.id ' . + 'AND cfgn.use_timezone = t.timezone_id '; + $res = $this->db->query($query); + while ($row = $res->fetchRow()) { + $this->pollerLocations[$row['id']] = $row['timezone_name']; + } + + return $this->pollerLocations; + } /** * Get default timezone setted in admintration/options @@ -535,7 +570,7 @@ public function getCentreonTimezone() * @param string $gmt * @return string timezone */ - private function getActiveTimezone($gmt) + public function getActiveTimezone($gmt) { $sTimezone = ""; if (count($this->timezones) == 0) { diff --git a/www/include/monitoring/downtime/AddDowntime.php b/www/include/monitoring/downtime/AddDowntime.php index 959e861d4b2..6ab5ba36026 100644 --- a/www/include/monitoring/downtime/AddDowntime.php +++ b/www/include/monitoring/downtime/AddDowntime.php @@ -249,8 +249,8 @@ $form->addRule('comment', _("Required Field"), 'required'); $data = array(); - $data["start"] = $centreonGMT->getDate("Y/m/d", time()); - $data["end"] = $centreonGMT->getDate("Y/m/d", time() + 7200); + $data["start"] = $centreonGMT->getDate("m/d/Y", time()); + $data["end"] = $centreonGMT->getDate("m/d/Y", time() + 7200); $data["start_time"] = $centreonGMT->getDate("G:i", time()); $data["end_time"] = $centreonGMT->getDate("G:i", time() + 7200); $data["host_or_hg"] = 1;