Author:   Lars Michelsen <[email protected]>
Date:     Wed Mar  7 20:38:56 2012 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Mar  7 20:38:56 2012 +0100

Bugfix: Fixed exclude_member_states for map objects

---

 ChangeLog                                          |    1 +
 share/server/core/classes/objects/NagVisMapObj.php |   27 ++++++++++++-------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bc53ded..47af80b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Core
   * Bugfix: Fixed bug in 1.6.1 auth db update scripts
   * Bugfix: Added missing permission for the Url module which is used when
             having URLs in rotations
+  * Bugfix: Fixed exclude_member_states for map objects
 
 Frontend
   * Bugfix: Fixed cloning shape objects (view_type error message)
diff --git a/share/server/core/classes/objects/NagVisMapObj.php 
b/share/server/core/classes/objects/NagVisMapObj.php
index 15cde1d..b54e935 100644
--- a/share/server/core/classes/objects/NagVisMapObj.php
+++ b/share/server/core/classes/objects/NagVisMapObj.php
@@ -119,7 +119,7 @@ class NagVisMapObj extends NagVisStatefulObject {
      * @return  Array Array with map objects
      * @author  Lars Michelsen <[email protected]>
      */
-    public function getStateRelevantMembers() {
+    public function getStateRelevantMembers($excludeMemberStates = false) {
         $a = Array();
 
         // Loop all members
@@ -138,12 +138,19 @@ class NagVisMapObj extends NagVisStatefulObject {
                 continue;
 
             /**
-                * All maps which produce a loop by linking back to earlier maps
-                * need to be skipped here.
-                */
+             * All maps which produce a loop by linking back to earlier maps
+             * need to be skipped here.
+             */
             if($sType == 'map' && $OBJ->isLoopingBacklink)
                 continue;
 
+            /**
+             * Exclude map objects based on "exclude_member_states" option
+             */
+            if($excludeMemberStates && $this->hasExcludeFilters(COUNT_QUERY)
+               && $this->excludeMapObject($OBJ, COUNT_QUERY))
+                continue;
+
             // Add relevant objects to array
             $a[] = $OBJ;
         }
@@ -333,9 +340,9 @@ class NagVisMapObj extends NagVisStatefulObject {
      * Cares about excluding members of map objects. The other objects excludes
      * are handled by the backends, not in the NagVis code.
      */
-    private function excludeMapObject($OBJ) {
+    private function excludeMapObject($OBJ, $isCount) {
         // at the moment only handle the complete exclusion
-        $filter  = $this->getExcludeFilter(!COUNT_QUERY);
+        $filter  = $this->getExcludeFilter($isCount);
         $objType = $OBJ->getType();
         $parts   = explode('~~', $filter);
 
@@ -471,8 +478,8 @@ class NagVisMapObj extends NagVisStatefulObject {
             // Apply default configuration to object
             $OBJ->setConfiguration($objConf);
 
-            // Skip object by exclude filter?
-            if($this->hasExcludeFilters(!COUNT_QUERY) && 
$this->excludeMapObject($OBJ))
+            // Skip object by exclude filter? => Totally exclude 
(exclude_members)
+            if($this->hasExcludeFilters(!COUNT_QUERY) && 
$this->excludeMapObject($OBJ, !COUNT_QUERY))
                 continue;
 
             // Write member to object array
@@ -522,7 +529,7 @@ class NagVisMapObj extends NagVisStatefulObject {
                                'OK'          => 0, 'ERROR'    => 0, 'ACK'  => 
0,
                                'PENDING'     => 0);
 
-            foreach($this->getStateRelevantMembers() AS $OBJ)
+            foreach($this->getStateRelevantMembers(true) AS $OBJ)
                 if(isset($arrStates[$OBJ->summary_state]))
                     $arrStates[$OBJ->summary_state]++;
 
@@ -563,7 +570,7 @@ class NagVisMapObj extends NagVisStatefulObject {
     private function fetchSummaryState() {
         // Get summary state of this object from single objects
         if($this->hasObjects() && $this->hasStatefulObjects())
-            $this->wrapChildState($this->getStateRelevantMembers());
+            $this->wrapChildState($this->getStateRelevantMembers(true));
         else
             $this->summary_state = 'UNKNOWN';
     }


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to