Module: nagvis
Branch: nagvis-1.4
Commit: f65e5f9126c8f54d29bd09416c6c4ec387b05097
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=f65e5f9126c8f54d29bd09416c6c4ec387b05097

Author: LaMi <[email protected]>
Date:   Mon Nov 23 10:19:54 2009 +0100

Fixed downtime detail handling for service objects

---

 .../includes/classes/GlobalBackendmklivestatus.php |   44 +++++++++++++++-----
 1 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/nagvis/nagvis/includes/classes/GlobalBackendmklivestatus.php 
b/nagvis/nagvis/includes/classes/GlobalBackendmklivestatus.php
index b3e198e..5dfa894 100644
--- a/nagvis/nagvis/includes/classes/GlobalBackendmklivestatus.php
+++ b/nagvis/nagvis/includes/classes/GlobalBackendmklivestatus.php
@@ -598,12 +598,23 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                                                
                                                // This handles only the first 
downtime. But this is not backend
                                                // specific. The other backends 
do this as well.
-                                               $d = 
$this->queryLivestatusSingle(
-                                                 "GET downtimes\n".
-                                                 "Columns: author comment 
start_time end_time\n" .
-                                                 "Filter: host_name = 
".$e[0]."\n" .
-                                                 "Filter: service_description 
= ".$e[1]."\n");
-                                               
+
+                                               // Handle host/service downtime 
difference
+                                               if(isset($e[15]) && $e[15] > 0) 
{
+                                                       // Service downtime
+                                                       $d = 
$this->queryLivestatusSingle(
+                                                         "GET downtimes\n".
+                                                         "Columns: author 
comment start_time end_time\n" .
+                                                         "Filter: host_name = 
".$e[0]."\n" .
+                                                         "Filter: 
service_description = ".$e[1]."\n");
+                                               } else {
+                                                       // Host downtime
+                                                       $d = 
$this->queryLivestatusSingle(
+                                                         "GET downtimes\n".
+                                                         "Columns: author 
comment start_time end_time\n" .
+                                                         "Filter: host_name = 
".$e[0]."\n");
+                                               }
+                                                       
                                                
$arrTmpReturn['downtime_author'] = $d[0];
                                                $arrTmpReturn['downtime_data'] 
= $d[1];
                                                $arrTmpReturn['downtime_start'] 
= $d[2];
@@ -826,11 +837,22 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                                                
                                                // This handles only the first 
downtime. But this is not backend
                                                // specific. The other backends 
do this as well.
-                                               $d = 
$this->queryLivestatusSingle(
-                                                 "GET downtimes\n".
-                                                 "Columns: author comment 
start_time end_time\n" .
-                                                 "Filter: host_name = 
".$hostName."\n" .
-                                                 "Filter: service_description 
= ".$e[0]."\n");
+                                               
+                                               // Handle host/service downtime 
difference
+                                               if(isset($e[15]) && $e[15] > 0) 
{
+                                                       // Service downtime
+                                                       $d = 
$this->queryLivestatusSingle(
+                                                         "GET downtimes\n".
+                                                         "Columns: author 
comment start_time end_time\n" .
+                                                         "Filter: host_name = 
".$hostName."\n" .
+                                                         "Filter: 
service_description = ".$e[0]."\n");
+                                               } else {
+                                                       // Host downtime
+                                                       $d = 
$this->queryLivestatusSingle(
+                                                         "GET downtimes\n".
+                                                         "Columns: author 
comment start_time end_time\n" .
+                                                         "Filter: host_name = 
".$hostName."\n");
+                                               }
                                                
                                                
$arrTmpReturn['downtime_author'] = $d[0];
                                                $arrTmpReturn['downtime_data'] 
= $d[1];


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to