Author:   Lars Michelsen <[email protected]>
Date:     Tue May 21 14:45:51 2013 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Tue May 21 14:45:51 2013 +0200

Livestatus: Fixed handling of hosts/services without custom variables

---

 ChangeLog                                          |    2 ++
 .../core/classes/GlobalBackendmklivestatus.php     |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9b90758..0cd80f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
 1.7.9
+Core:
+  * Livestatus: Fixed handling of hosts/services without custom variables
 
 1.7.8
 Automap:
diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php 
b/share/server/core/classes/GlobalBackendmklivestatus.php
index eb257d2..145a875 100644
--- a/share/server/core/classes/GlobalBackendmklivestatus.php
+++ b/share/server/core/classes/GlobalBackendmklivestatus.php
@@ -627,7 +627,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                   'perfdata'               => $e[14],
                   'check_command'          => $e[19],
                 );
-                if(isset($e[20][0]) && isset($e[21][0]))
+
+                if($e[20] && $e[21])
                     $arrTmpReturn['custom_variables'] = array_combine($e[20], 
$e[21]);
 
                 /**
@@ -1359,7 +1360,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
         $r = $this->queryLivestatus($query);
         $hosts = array();
         foreach($r AS $row) {
-               $custom_variables = array_combine($row[1], $row[2]);
+            if($row[1] && $row[2]) {
+               $custom_variables = array_combine($row[1], $row[2]);
                 if(isset($custom_variables['LAT']) && 
isset($custom_variables['LONG'])) {
                     $hosts[] = array(
                         'name'  => $row[0],
@@ -1368,6 +1370,7 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                         'alias' => $row[3],
                     );
                 }
+            }
         }
         return $hosts;
     }


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to