Module: nagvis Branch: master Commit: 99ef69d39e1deb3e5592df3a47bd4d517db8cc6a URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=99ef69d39e1deb3e5592df3a47bd4d517db8cc6a
Author: Lars Michelsen <[email protected]> Date: Wed Jun 30 23:45:14 2010 +0200 #322 recognize_services=0 is handled by hostgroups again - affected all backends --- share/server/core/classes/CoreBackendMgmt.php | 13 ++++++++----- .../core/classes/GlobalBackendmklivestatus.php | 4 ++++ share/server/core/classes/GlobalBackendndomy.php | 4 ++++ .../core/classes/objects/NagiosHostgroup.php | 6 ++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/share/server/core/classes/CoreBackendMgmt.php b/share/server/core/classes/CoreBackendMgmt.php index 84c5220..bb30ad2 100644 --- a/share/server/core/classes/CoreBackendMgmt.php +++ b/share/server/core/classes/CoreBackendMgmt.php @@ -99,6 +99,8 @@ class CoreBackendMgmt { $options = 0; if($OBJ->getOnlyHardStates()) $options |= 1; + if(!$OBJ->getRecognizeServices()) + $options |= 2; /*FIXME: Implement as optional filter: "Filter: in_notification_period = 1\n" .*/ return $options; @@ -235,11 +237,12 @@ class CoreBackendMgmt { } // Now fetch the service state counts for all hostgroup members - try { - $filters = Array(Array('key' => 'host_groups', 'op' => '>=', 'val' => 'name')); - $aServiceStateCounts = $this->getBackend($backendId)->getHostStateCounts(Array($OBJ->getName() => Array($OBJ)), $options, $filters); - } catch(BackendException $e) { - $aServiceStateCounts = Array(); + $aServiceStateCounts = Array(); + if($OBJ->getRecognizeServices()) { + try { + $filters = Array(Array('key' => 'host_groups', 'op' => '>=', 'val' => 'name')); + $aServiceStateCounts = $this->getBackend($backendId)->getHostStateCounts(Array($OBJ->getName() => Array($OBJ)), $options, $filters); + } catch(BackendException $e) {} } $members = Array(); diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php b/share/server/core/classes/GlobalBackendmklivestatus.php index ff7ff11..b185d84 100644 --- a/share/server/core/classes/GlobalBackendmklivestatus.php +++ b/share/server/core/classes/GlobalBackendmklivestatus.php @@ -927,6 +927,10 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface { ); } } + + // If recognize_services are disabled don't fetch service information + if($options & 2) + return $arrReturn; if($options & 1) $stateAttr = 'last_hard_state'; diff --git a/share/server/core/classes/GlobalBackendndomy.php b/share/server/core/classes/GlobalBackendndomy.php index 6b3cdc3..7018ca9 100644 --- a/share/server/core/classes/GlobalBackendndomy.php +++ b/share/server/core/classes/GlobalBackendndomy.php @@ -899,6 +899,10 @@ class GlobalBackendndomy implements GlobalBackendInterface { ); } + // If recognize_services are disabled don't fetch service information + if($options & 2) + return $arrReturn; + $QUERYHANDLE = $this->mysqlQuery('SELECT o.name1, SUM(IF(ss.has_been_checked=0,1,0)) AS pending, diff --git a/share/server/core/classes/objects/NagiosHostgroup.php b/share/server/core/classes/objects/NagiosHostgroup.php index 5f62f6c..e0403d7 100644 --- a/share/server/core/classes/objects/NagiosHostgroup.php +++ b/share/server/core/classes/objects/NagiosHostgroup.php @@ -194,8 +194,10 @@ class NagiosHostgroup extends NagVisStatefulObject { } else { // FIXME: Recode mergeSummaryOutput method $this->mergeSummaryOutput($arrHostStates, $this->CORE->getLang()->getText('hosts')); - $this->summary_output .= "<br />"; - $this->mergeSummaryOutput($arrServiceStates, $this->CORE->getLang()->getText('services')); + if($this->recognize_services) { + $this->summary_output .= "<br />"; + $this->mergeSummaryOutput($arrServiceStates, $this->CORE->getLang()->getText('services')); + } } } ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
