[icinga-checkins] icinga.org: icinga-web/master: * Fixed oracle timestamp issues (SLA)

git at icinga.org git at icinga.org
Thu Nov 17 16:47:31 CET 2011


Module: icinga-web
Branch: master
Commit: 551f916484f87d043cfce2d36f9c8cfc7af69645
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=551f916484f87d043cfce2d36f9c8cfc7af69645

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Nov 17 16:09:22 2011 +0100

* Fixed oracle timestamp issues (SLA)

---

 .../lib/database/models/IcingaSlahistoryTable.php  |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/app/modules/Api/lib/database/models/IcingaSlahistoryTable.php b/app/modules/Api/lib/database/models/IcingaSlahistoryTable.php
index ba0d206..0260e22 100644
--- a/app/modules/Api/lib/database/models/IcingaSlahistoryTable.php
+++ b/app/modules/Api/lib/database/models/IcingaSlahistoryTable.php
@@ -203,11 +203,11 @@ class IcingaSlahistoryTable extends Doctrine_Table {
                 obj.objecttype_id,
                 scheduled_downtime, 
                 SUM(
-                    COALESCE(
-                        acknowledgement_time-start_time,
-                        end_time-start_time,
-                        CURRENT_DATE-start_time
-                    )
+                        COALESCE(
+                            cast(acknowledgement_time as date)-cast(start_time as date),
+                            cast(end_time as date)-cast(start_time as date),
+                            CURRENT_DATE-cast(start_time as date)
+                        )
                  )*86400 AS duration FROM timeRange s INNER JOIN ".$prefix.
                 "objects obj ON obj.id = s.object_id ";
         
@@ -229,9 +229,9 @@ class IcingaSlahistoryTable extends Doctrine_Table {
                  SELECT object_id,
                     SUM(
                         COALESCE(
-                            acknowledgement_time-start_time,
-                            end_time-start_time,
-                            CURRENT_DATE-start_time
+                            cast(acknowledgement_time as date)-cast(start_time as date),
+                            cast(end_time as date)-cast(start_time as date),
+                            CURRENT_DATE-cast(start_time as date)
                         )
                     )*86400 AS complete 
                   FROM timeRange





More information about the icinga-checkins mailing list