1 |
|
/* |
2 |
|
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org |
4 |
|
* Copyright (C) 2000-2002 i-scream |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or |
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; |
309 |
– |
} |
310 |
– |
|
311 |
– |
/** |
312 |
– |
* Advances the alert level to the next one up. |
313 |
– |
* |
314 |
– |
* This keeps track of the number of the number |
315 |
– |
* of times the highest NON-FINAL alert level |
316 |
– |
* has been reached. Note this isn't a specific |
317 |
– |
* level, just the highest, so you could configure |
318 |
– |
* more levels and not affect this. |
319 |
– |
* |
320 |
– |
* If the count exceeds the number of times |
321 |
– |
* set in the configuration, it escalates to |
322 |
– |
* a FINAL alert if we're using FINAL's. |
323 |
– |
* |
324 |
– |
* It determines if to use FINAL's from the config |
325 |
– |
* entry reachFINALcount, when the count exceeds |
326 |
– |
* this value, it escalates to a FINAL. If that attribute |
327 |
– |
* is mis-read or is not configured. It will NEVER reach |
328 |
– |
* a FINAL. |
329 |
– |
* |
330 |
– |
*/ |
331 |
– |
public void escalateAlert() { |
332 |
– |
// don't escalate if we're already on the last alert |
333 |
– |
if(getLastAlertLevel() != Alert.alertLevels.length -1) { |
334 |
– |
setLastAlertLevel(getNextAlertLevel()); |
335 |
– |
} |
336 |
– |
try { |
337 |
– |
// note if we fail to get this value, we won't process the res of this |
338 |
– |
int reachFINALcount = Integer.parseInt(_cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".reachFINALcount")); |
339 |
– |
if (getLastAlertLevel() == Alert.alertLevels.length - 2) { |
340 |
– |
_maxLevelCount++; |
341 |
– |
if(_maxLevelCount > reachFINALcount) { |
342 |
– |
setLastAlertLevel(Alert.alertFINAL); |
343 |
– |
} |
344 |
– |
} |
345 |
– |
} catch (PropertyNotFoundException e) { |
346 |
– |
// we NEVER reach FINAL in this case |
347 |
– |
} catch (NumberFormatException e) { |
348 |
– |
// we NEVER reach FINAL in this case |
349 |
– |
} |
350 |
|
} |
351 |
|
|
352 |
|
//---ATTRIBUTES--- |