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

Author: LaMi <[email protected]>
Date:   Sat Jan 16 17:25:39 2010 +0100

Fixed recognize_services handling when using mklivestatus backend

---

 share/server/core/classes/objects/NagiosHost.php |   45 +++++++++++++---------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/share/server/core/classes/objects/NagiosHost.php 
b/share/server/core/classes/objects/NagiosHost.php
index 05416ee..3d93caf 100644
--- a/share/server/core/classes/objects/NagiosHost.php
+++ b/share/server/core/classes/objects/NagiosHost.php
@@ -160,28 +160,37 @@ class NagiosHost extends NagVisStatefulObject {
                        // problems due to the old recursive mechanism. If it's 
not available fall back to
                        // old mechanism.
                        
if($this->BACKEND->checkBackendFeature($this->backend_id, 'getHostStateCounts', 
false)) {
-                               // Get state counts
-                               $this->aStateCounts = 
$this->BACKEND->BACKENDS[$this->backend_id]->getHostStateCounts($this->host_name,
 $this->only_hard_states);
+                               if($this->getRecognizeServices()) {
+                                       // Get state counts
+                                       $this->aStateCounts = 
$this->BACKEND->BACKENDS[$this->backend_id]->getHostStateCounts($this->host_name,
 $this->only_hard_states);
                                
-                               // Calculate summary state and output
-                               $this->fetchSummariesFromCounts();
+                                       // Calculate summary state and output
+                                       $this->fetchSummariesFromCounts();
                                
-                               // Get all service states
-                               // These information are only interesting when 
the hover_menu is shown
-                               /* FIXME: Get member summary state+substate, 
output for the objects to
-                                  be shown in hover menu. This could be 
improved by limiting the 
-                                  number of members the state will be fetched 
for.
-                                  For example: when the members will be sorted 
by name and limited to
-                                  10 it is only neccessary to fetch 10 members.
-                                  When member should be sorted by state the 
state counts could be
-                                  used to exclude objects with states which 
will not be displayed.
-                               */
-                               if($this->hover_menu == 1 && 
$this->hover_childs_show == 1 && $bFetchChilds && $this->getState() != 'ERROR' 
&& !$this->hasMembers()) {
-                                       $this->fetchServiceObjects();
+                                       // Get all service states
+                                       // These information are only 
interesting when the hover_menu is shown
+                                       /* FIXME: Get member summary 
state+substate, output for the objects to
+                                          be shown in hover menu. This could 
be improved by limiting the 
+                                          number of members the state will be 
fetched for.
+                                                For example: when the members 
will be sorted by name and limited to
+                                          10 it is only neccessary to fetch 10 
members.
+                                          When member should be sorted by 
state the state counts could be
+                                          used to exclude objects with states 
which will not be displayed.
+                                       */
+                                       if($this->hover_menu == 1 && 
$this->hover_childs_show == 1 && $bFetchChilds && $this->getState() != 'ERROR' 
&& !$this->hasMembers()) {
+                                               $this->fetchServiceObjects();
+                                       }
+                               } else {
+                                       // Even if no services were fetched 
fetch the summary state/output
+                                       // Also get summary state
+               $this->fetchSummaryState();
+
+                           // At least summary output
+                     $this->fetchSummaryOutput();
                                }
                        } else {
-                               // Get all service states
-                               if($this->getState() != 'ERROR' && 
!$this->hasMembers()) {
+                               // Only merge host state with service state 
when recognize_services is set 
+                               if($this->getState() != 'ERROR' && 
!$this->hasMembers() && $this->getRecognizeServices()) {
                                        $this->fetchServiceObjects();
                                }
                                


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to