1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
|
package uk.org.iscream.cms.server.client; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.org.iscream.cms.server.util.*; |
25 |
> |
import uk.org.iscream.cms.util.*; |
26 |
|
import uk.org.iscream.cms.server.componentmanager.*; |
27 |
|
|
28 |
|
/** |
91 |
|
|
92 |
|
//---PUBLIC METHODS--- |
93 |
|
|
94 |
+ |
/** |
95 |
+ |
* Advances the alert level to the next one up. |
96 |
+ |
* |
97 |
+ |
* This keeps track of the number of the number |
98 |
+ |
* of times the highest NON-FINAL alert level |
99 |
+ |
* has been reached. Note this isn't a specific |
100 |
+ |
* level, just the highest, so you could configure |
101 |
+ |
* more levels and not affect this. |
102 |
+ |
* |
103 |
+ |
* If the count exceeds the number of times |
104 |
+ |
* set in the configuration, it escalates to |
105 |
+ |
* a FINAL alert if we're using FINAL's. |
106 |
+ |
* |
107 |
+ |
* It determines if to use FINAL's from the config |
108 |
+ |
* entry reachFINALcount, when the count exceeds |
109 |
+ |
* this value, it escalates to a FINAL. If that attribute |
110 |
+ |
* is mis-read or is not configured. It will NEVER reach |
111 |
+ |
* a FINAL. |
112 |
+ |
*/ |
113 |
+ |
public void escalateAlert() { |
114 |
+ |
// don't escalate if we're already on the last alert |
115 |
+ |
if(getLastAlertLevel() != Alert.alertLevels.length -1) { |
116 |
+ |
setLastAlertLevel(getNextAlertLevel()); |
117 |
+ |
} |
118 |
+ |
try { |
119 |
+ |
// note if we fail to get this value, we won't process the res of this |
120 |
+ |
int reachFINALcount = Integer.parseInt(_cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".reachFINALcount")); |
121 |
+ |
if (getLastAlertLevel() == Alert.alertLevels.length - 2) { |
122 |
+ |
_maxLevelCount++; |
123 |
+ |
if(_maxLevelCount > reachFINALcount) { |
124 |
+ |
setLastAlertLevel(Alert.alertFINAL); |
125 |
+ |
} |
126 |
+ |
} |
127 |
+ |
} catch (PropertyNotFoundException e) { |
128 |
+ |
// we NEVER reach FINAL in this case |
129 |
+ |
} catch (NumberFormatException e) { |
130 |
+ |
// we NEVER reach FINAL in this case |
131 |
+ |
} |
132 |
+ |
} |
133 |
+ |
|
134 |
|
//---PRIVATE METHODS--- |
135 |
|
|
136 |
|
/** |
347 |
|
*/ |
348 |
|
public long getInitialAlertTime() { |
349 |
|
return _initialAlertTime; |
290 |
– |
} |
291 |
– |
|
292 |
– |
/** |
293 |
– |
* Advances the alert level to the next one up. |
294 |
– |
* |
295 |
– |
* This keeps track of the number of the number |
296 |
– |
* of times the highest NON-FINAL alert level |
297 |
– |
* has been reached. Note this isn't a specific |
298 |
– |
* level, just the highest, so you could configure |
299 |
– |
* more levels and not affect this. |
300 |
– |
* |
301 |
– |
* If the count exceeds the number of times |
302 |
– |
* set in the configuration, it escalates to |
303 |
– |
* a FINAL alert if we're using FINAL's. |
304 |
– |
* |
305 |
– |
* It determines if to use FINAL's from the config |
306 |
– |
* entry reachFINALcount, when the count exceeds |
307 |
– |
* this value, it escalates to a FINAL. If that attribute |
308 |
– |
* is mis-read or is not configured. It will NEVER reach |
309 |
– |
* a FINAL. |
310 |
– |
* |
311 |
– |
*/ |
312 |
– |
public void escalateAlert() { |
313 |
– |
// don't escalate if we're already on the last alert |
314 |
– |
if(getLastAlertLevel() != Alert.alertLevels.length -1) { |
315 |
– |
setLastAlertLevel(getNextAlertLevel()); |
316 |
– |
} |
317 |
– |
try { |
318 |
– |
// note if we fail to get this value, we won't process the res of this |
319 |
– |
int reachFINALcount = Integer.parseInt(_cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".reachFINALcount")); |
320 |
– |
if (getLastAlertLevel() == Alert.alertLevels.length - 2) { |
321 |
– |
_maxLevelCount++; |
322 |
– |
if(_maxLevelCount > reachFINALcount) { |
323 |
– |
setLastAlertLevel(Alert.alertFINAL); |
324 |
– |
} |
325 |
– |
} |
326 |
– |
} catch (PropertyNotFoundException e) { |
327 |
– |
// we NEVER reach FINAL in this case |
328 |
– |
} catch (NumberFormatException e) { |
329 |
– |
// we NEVER reach FINAL in this case |
330 |
– |
} |
350 |
|
} |
351 |
|
|
352 |
|
//---ATTRIBUTES--- |