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

Author: LaMi <[email protected]>
Date:   Tue Nov 17 12:15:25 2009 +0100

Fixed pending detection when using new more performant state fetching mechanism

---

 .../core/classes/GlobalBackendmklivestatus.php     |   10 +++++++++-
 share/server/core/classes/GlobalMainCfg.php        |   12 ++++++++++++
 .../core/classes/objects/NagVisStatefulObject.php  |   11 +++++++----
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php 
b/share/server/core/classes/GlobalBackendmklivestatus.php
index 7ed523a..7d42ef6 100644
--- a/share/server/core/classes/GlobalBackendmklivestatus.php
+++ b/share/server/core/classes/GlobalBackendmklivestatus.php
@@ -687,7 +687,7 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                 * acknowledged => check for acknowledged host
                 */
                // $e[15]: acknowledged
-               if($state != 'OK' && $e[15] == 1) {
+               if($state != 'UP' && $e[15] == 1) {
                        $arrReturn['problem_has_been_acknowledged'] = 1;
                } else {
                        $arrReturn['problem_has_been_acknowledged'] = 0;
@@ -987,6 +987,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                   "Stats: has_been_checked = 0\n" .
                   // Count OK
                   "Stats: ".$stateAttr." = 0\n" .
+                  "Stats: has_been_checked != 0\n" .
+                  "StatsAnd: 2\n" .
                   // Count WARNING
                   "Stats: ".$stateAttr." = 1\n" .
                   "Stats: acknowledged = 0\n" .
@@ -1091,6 +1093,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                         "Stats: has_been_checked = 0\n" .
                         // Count OK
                         "Stats: ".$stateAttr." = 0\n" .
+                        "Stats: has_been_checked != 0\n" .
+                        "StatsAnd: 2\n" .
                         // Count WARNING
                         "Stats: ".$stateAttr." = 1\n" .
                         "Stats: acknowledged = 0\n" .
@@ -1201,6 +1205,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                   "Stats: has_been_checked = 0\n" .
                   // Count UP
                   "Stats: ".$stateAttr." = 0\n" .
+                  "Stats: has_been_checked != 0\n" .
+                  "StatsAnd: 2\n" .
                   // Count DOWN
                   "Stats: ".$stateAttr." = 1\n" .
                   "Stats: acknowledged = 0\n" .
@@ -1354,6 +1360,8 @@ class GlobalBackendmklivestatus implements 
GlobalBackendInterface {
                   "Stats: has_been_checked = 0\n" .
                   // Count OK
                   "Stats: ".$stateAttr." = 0\n" .
+                  "Stats: has_been_checked != 0\n" .
+                  "StatsAnd: 2\n" .
                   // Count WARNING
                   "Stats: ".$stateAttr." = 1\n" .
                   "Stats: acknowledged = 0\n" .
diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index 57a1684..13c030a 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -655,6 +655,10 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '1',
                                        'match' => MATCH_INTEGER),
+                               'up_downtime' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '1',
+                                       'match' => MATCH_INTEGER),
                                'up_bgcolor' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '#00FF00',
@@ -671,6 +675,10 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '1',
                                        'match' => MATCH_INTEGER),
+                               'ok_downtime' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '1',
+                                       'match' => MATCH_INTEGER),
                                'ok_bgcolor' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '#00FF00',
@@ -687,6 +695,10 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '0',
                                        'match' => MATCH_INTEGER),
+                               'pending_downtime' => Array('must' => 1,
+                                       'editable' => 1,
+                                       'default' => '0',
+                                       'match' => MATCH_INTEGER),
                                'pending_bgcolor' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '#C0C0C0',
diff --git a/share/server/core/classes/objects/NagVisStatefulObject.php 
b/share/server/core/classes/objects/NagVisStatefulObject.php
index 4f3aa4c..9fd5a94 100644
--- a/share/server/core/classes/objects/NagVisStatefulObject.php
+++ b/share/server/core/classes/objects/NagVisStatefulObject.php
@@ -604,7 +604,7 @@ class NagVisStatefulObject extends NagVisObject {
                
                // Fetch the current state to start with
                if($this->summary_state == '') {
-                       $currWeight = 0;
+                       $currWeight = null;
                } else {
                        if(isset($stateWeight[$this->summary_state])) {
                                $sCurrSubState = 'normal';
@@ -617,7 +617,8 @@ class NagVisStatefulObject extends NagVisObject {
                                
                                $currWeight = 
$stateWeight[$this->summary_state][$sCurrSubState];
                        } else {
-                               //FIXME: Error handling: Invalid state
+                               // Error handling: Invalid state
+                               new GlobalMessage('ERROR', 
GlobalCore::getInstance()->getLang()->getText('Invalid state+substate ([STATE], 
[SUBSTATE]) found on state comparision.', Array('STATE' => $sSummaryState, 
'SUBSTATE' => $sCurrSubState)));
                        }
                }
                
@@ -635,8 +636,9 @@ class NagVisStatefulObject extends NagVisObject {
                                        if(isset($stateWeight[$sState]) && 
isset($stateWeight[$sState][$sSubState])) {
                                                $weight = 
$stateWeight[$sState][$sSubState];
                                                
+                                               // No "current state" yet
                                                // The new state is worse than 
the current state
-                                               if($currWeight < $weight) {
+                                               if($currWeight === null || 
$currWeight < $weight) {
                                                        // Set the new weight 
for next compare
                                                        $currWeight = $weight;
                                                        
@@ -657,7 +659,8 @@ class NagVisStatefulObject extends NagVisObject {
                                                        }
                                                }
                                        } else {
-                                               //FIXME: Error handling: 
Invalid state+substate
+                                               //Error handling: Invalid 
state+substate
+                                               new GlobalMessage('ERROR', 
GlobalCore::getInstance()->getLang()->getText('Invalid state+substate ([STATE], 
[SUBSTATE]) found on state comparision.', Array('STATE' => $sState, 'SUBSTATE' 
=> $sSubState)));
                                        }
                                }
                        }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to