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

Author: Lars Michelsen <[email protected]>
Date:   Sun Apr 18 17:47:31 2010 +0200

Added dummy function calls to make NagVis load properly; But it only works with 
MKLivestatus backend at the moment

---

 .../server/core/classes/GlobalBackendmerlinmy.php  |   15 ++++++++-
 .../core/classes/GlobalBackendmklivestatus.php     |   31 ++++----------------
 share/server/core/classes/GlobalBackendndomy.php   |   26 +++++++++++++----
 3 files changed, 39 insertions(+), 33 deletions(-)

diff --git a/share/server/core/classes/GlobalBackendmerlinmy.php 
b/share/server/core/classes/GlobalBackendmerlinmy.php
index e6196b2..7584a10 100644
--- a/share/server/core/classes/GlobalBackendmerlinmy.php
+++ b/share/server/core/classes/GlobalBackendmerlinmy.php
@@ -290,6 +290,9 @@ class GlobalBackendmerlinmy implements 
GlobalBackendInterface {
                
                return $return;
        }
+
+       public function getHostState($query, $filters) {
+       }
        
        /**
         * PUBLIC getHostState()
@@ -303,7 +306,7 @@ class GlobalBackendmerlinmy implements 
GlobalBackendInterface {
         * @author      Lars Michelsen <[email protected]>
         * @author      Roman Kyrylych <[email protected]>
         */
-       public function getHostState($hostName, $onlyHardstates = null, $filter 
= null) {
+       public function getHostStateOld($hostName, $onlyHardstates = null, 
$filter = null) {
                if(isset($this->hostCache[$hostName.'-'.$onlyHardstates])) {
                        return $this->hostCache[$hostName.'-'.$onlyHardstates];
                } else {
@@ -415,6 +418,9 @@ class GlobalBackendmerlinmy implements 
GlobalBackendInterface {
                }
        }
        
+       public function getServiceState($query, $filters) {
+       }
+       
        /**
         * PUBLIC getServiceState()
         *
@@ -427,7 +433,7 @@ class GlobalBackendmerlinmy implements 
GlobalBackendInterface {
         * @author      Lars Michelsen <[email protected]>
         * @author      Roman Kyrylych <[email protected]>
         */
-       public function getServiceState($hostName, $serviceName = null, 
$onlyHardstates = null) {
+       public function getServiceStateOld($hostName, $serviceName = null, 
$onlyHardstates = null) {
                
if(isset($this->serviceCache[$hostName.'-'.$serviceName.'-'.$onlyHardstates])) {
                        return 
$this->serviceCache[$hostName.'-'.$serviceName.'-'.$onlyHardstates];
                } else {
@@ -560,6 +566,11 @@ class GlobalBackendmerlinmy implements 
GlobalBackendInterface {
                        return $arrReturn;
                }
        }
+
+       public function getHostStateCounts($query, $filters) {}
+       public function getHostgroupStateCounts($query, $filters) {}
+       public function getServicegroupStateCounts($query, $filters) {}
+       public function getDirectParentNamesByHostName($hostName) {}
        
        /**
         * PUBLIC getHostgroupState()
diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php 
b/share/server/core/classes/GlobalBackendmklivestatus.php
index 3d6d87c..2247df4 100644
--- a/share/server/core/classes/GlobalBackendmklivestatus.php
+++ b/share/server/core/classes/GlobalBackendmklivestatus.php
@@ -288,25 +288,6 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
        }
        
        /**
-        * PRIVATE queryLivestatusSingle()
-        *
-        * Queries the livestatus socket for a single field
-        *
-        * @param   String   Query to send to the socket
-        * @return  Array    Results of the query
-   * @author  Mathias Kettner <[email protected]>
-        * @author  Lars Michelsen <[email protected]>
-        */
-       private function queryLivestatusSingle($query) {
-               $l = $this->queryLivestatus($query);
-               if(isset($l[0][0])) {
-                       return $l[0][0];
-               } else {
-                       return Array();
-               }
-       }
-       
-       /**
         * PRIVATE queryLivestatusSingleRow()
         *
         * Queries the livestatus socket for a single row
@@ -326,7 +307,7 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
        }
        
        /**
-        * PRIVATE queryLivestatusSinglecolumn()
+        * PRIVATE queryLivestatusSingleColumn()
         *
         * Queries the livestatus socket for a single column in several rows
         *
@@ -335,7 +316,7 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
    * @author  Mathias Kettner <[email protected]>
         * @author  Lars Michelsen <[email protected]>
         */
-       private function queryLivestatusSinglecolumn($query) {
+       private function queryLivestatusSingleColumn($query) {
                $l = $this->queryLivestatus($query);
                
                $result = Array();
@@ -588,7 +569,7 @@ 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(
+                                       $d = $this->queryLivestatusSingleRow(
                                                "GET downtimes\n".
                                                "Columns: author comment 
start_time end_time\n" .
                                                "Filter: host_name = 
".$e[19]."\n");
@@ -705,14 +686,14 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                                                // Handle host/service downtime 
difference
                                                if(isset($e[15]) && $e[15] > 0) 
{
                                                        // Service downtime
-                                                       $d = 
$this->queryLivestatusSingle(
+                                                       $d = 
$this->queryLivestatusSingleRow(
                                                          "GET downtimes\n".
                                                          "Columns: author 
comment start_time end_time\n" .
                                                          "Filter: host_name = 
".$e[21]."\n" .
                                                          "Filter: 
service_description = ".$e[0]."\n");
                                                } else {
                                                        // Host downtime
-                                                       $d = 
$this->queryLivestatusSingle(
+                                                       $d = 
$this->queryLivestatusSingleRow(
                                                          "GET downtimes\n".
                                                          "Columns: author 
comment start_time end_time\n" .
                                                          "Filter: host_name = 
".$e[21]."\n");
@@ -1243,7 +1224,7 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
         * @author  Lars Michelsen <[email protected]>
         */
        public function getHostNamesWithNoParent() {
-               return $this->queryLivestatusSinglecolumn("GET hosts\nColumns: 
name\nFilter: parents =\n");
+               return $this->queryLivestatusSingleColumn("GET hosts\nColumns: 
name\nFilter: parents =\n");
        }
        
        /**
diff --git a/share/server/core/classes/GlobalBackendndomy.php 
b/share/server/core/classes/GlobalBackendndomy.php
index 4c8c7fe..6c74f5a 100644
--- a/share/server/core/classes/GlobalBackendndomy.php
+++ b/share/server/core/classes/GlobalBackendndomy.php
@@ -440,9 +440,14 @@ class GlobalBackendndomy implements GlobalBackendInterface 
{
                
                return $return;
        }
+
+       function getHostState($query, $filters) {
+               // FIXME: Extract hostName and onlyHardState option and then
+               // call getHostStateOld() for each object
+       }
        
        /**
-        * PUBLIC getHostState()
+        * PUBLIC getHostStateOld()
         *
         * Returns the Nagios state and additional information for the 
requested host
         *
@@ -452,7 +457,7 @@ class GlobalBackendndomy implements GlobalBackendInterface {
         * @return      array           $state
         * @author      Lars Michelsen <[email protected]>
         */
-       public function getHostState($hostName, $onlyHardstates = null, $filter 
= null) {
+       public function getHostStateOld($hostName, $onlyHardstates = null) {
                if(isset($this->hostCache[$hostName.'-'.$onlyHardstates])) {
                        return $this->hostCache[$hostName.'-'.$onlyHardstates];
                } else {
@@ -581,8 +586,13 @@ class GlobalBackendndomy implements GlobalBackendInterface 
{
                }
        }
        
+       function getServiceState($query, $filters) {
+               // FIXME: Extract names and onlyHardState option and then
+               // call getServiceStateOld() for each object
+       }
+       
        /**
-        * PUBLIC getServiceState()
+        * PUBLIC getServiceStateOld()
         *
         * Returns the state and additional information of the requested service
         *
@@ -592,7 +602,7 @@ class GlobalBackendndomy implements GlobalBackendInterface {
         * @return      Array           $state
         * @author      Lars Michelsen <[email protected]>
         */
-       public function getServiceState($hostName, $serviceName = null, 
$onlyHardstates = null) {
+       public function getServiceStateOld($hostName, $serviceName = null, 
$onlyHardstates = null) {
                
if(isset($this->serviceCache[$hostName.'-'.$serviceName.'-'.$onlyHardstates])) {
                        return 
$this->serviceCache[$hostName.'-'.$serviceName.'-'.$onlyHardstates];
                } else {
@@ -772,6 +782,10 @@ class GlobalBackendndomy implements GlobalBackendInterface 
{
                        return $arrReturn;
                }
        }
+
+       public function getHostStateCounts($query, $filters) {}
+       public function getHostgroupStateCounts($query, $filters) {}
+       public function getServicegroupStateCounts($query, $filters) {}
        
        /**
         * PUBLIC getHostgroupState()
@@ -784,7 +798,7 @@ class GlobalBackendndomy implements GlobalBackendInterface {
         * @return      array           $state
         * @author      Roman Kyrylych <[email protected]>
         */
-       public function getHostgroupState($hostgroupName, $onlyHardstates, 
$filter = null)
+       public function getHostgroupState($hostgroupName, $onlyHardstates)
        {
                $arrReturn = Array();
                
@@ -802,7 +816,7 @@ class GlobalBackendndomy implements GlobalBackendInterface {
         * @return      array           $state
         * @author      Roman Kyrylych <[email protected]>
         */
-       public function getServicegroupState($servicegroupName, 
$onlyHardstates, $filter = null)
+       public function getServicegroupState($servicegroupName, $onlyHardstates)
        {
                $arrReturn = Array();
                


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to