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.client; |
22 |
> |
package uk.org.iscream.cms.server.client; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.org.iscream.util.*; |
26 |
< |
import uk.org.iscream.componentmanager.*; |
25 |
> |
import uk.org.iscream.cms.util.*; |
26 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
27 |
|
|
28 |
|
/** |
29 |
|
* The Register class holds theshold values, |
226 |
|
* and is converted from the value in the config, |
227 |
|
* which should be seconds. |
228 |
|
* |
229 |
+ |
* Note that if the alert timeout for the current monitor |
230 |
+ |
* is not configured, it will try to obtain the default |
231 |
+ |
* timeout for all Monitor's. If there is no alert timeout |
232 |
+ |
* for either the monitor or a default setting this returns 0. |
233 |
+ |
* |
234 |
|
* Note that this is dependant on the threshold value |
235 |
|
* given, the timeout is obatined from the config, then |
236 |
|
* divided by the threshold value, this allows alerts to |
237 |
|
* progress faster should a higher threshold value be passed |
238 |
|
* |
214 |
– |
* If there is no alert timeout for a |
215 |
– |
* given level, this returns 0 |
216 |
– |
* |
239 |
|
* @param level the alert level |
240 |
|
* @param thresholdLevel the threshold leve we are on |
241 |
|
*/ |
243 |
|
// 0 means we don't use this value |
244 |
|
long timeout = 0; |
245 |
|
try { |
246 |
< |
String timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]); |
246 |
> |
String timeoutString; |
247 |
> |
try { |
248 |
> |
timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]); |
249 |
> |
} catch (PropertyNotFoundException e) { |
250 |
> |
// if there is no timeout for the monitor |
251 |
> |
// check for a default |
252 |
> |
timeoutString = _cp.getProperty("Host." + _hostname, "Monitor.alertTimeout." + Alert.alertLevels[level]); |
253 |
> |
} |
254 |
|
int threshold = getLastThresholdLevel(); |
255 |
|
if (threshold > 0) { |
256 |
|
timeout = (Long.parseLong(timeoutString) / threshold) * 1000; |