46 |
|
_monitorName = monitorName; |
47 |
|
_lastAlertLevels = new int[numAttributes]; |
48 |
|
_lastThresholdLevels = new int[numAttributes]; |
49 |
+ |
_initialAlertTime = new long[numAttributes]; |
50 |
|
_lastAlertTimeout = new long[numAttributes]; |
51 |
|
_times = new long[numAttributes][Alert.alertLevels.length]; |
52 |
|
// initialise the arrays to 0 |
53 |
|
for (int x = 0; x < _lastAlertLevels.length; x++) { |
54 |
|
_lastAlertLevels[x] = 0; |
55 |
+ |
_initialAlertTime[x] = 0; |
56 |
|
_lastThresholdLevels[x] = 0; |
57 |
|
_lastAlertTimeout[x] = 0; |
58 |
|
for(int y = 0; y < Alert.alertLevels.length; y++) { |
109 |
|
* Note that if this is setting to an OK |
110 |
|
* level alert, it resets _maxLevelCount. |
111 |
|
* |
112 |
+ |
* This also sets the "initialAlertTime" |
113 |
+ |
* if the next alert after OK is set. |
114 |
+ |
* And resets it to 0 if it IS an OK. |
115 |
+ |
* |
116 |
|
* @param attributeNum the attribute to set |
117 |
|
* @param level the new last alert level |
118 |
|
*/ |
120 |
|
_lastAlertLevels[attributeNum] = level; |
121 |
|
if (level == Alert.alertOK) { |
122 |
|
_maxLevelCount = 0; |
123 |
+ |
_initialAlertTime[attributeNum] = 0; |
124 |
|
} |
125 |
+ |
if (level == Alert.alertOK + 1) { |
126 |
+ |
_initialAlertTime[attributeNum] = System.currentTimeMillis(); |
127 |
+ |
} |
128 |
|
} |
129 |
|
|
130 |
|
/** |
250 |
|
} |
251 |
|
|
252 |
|
/** |
253 |
+ |
* Returns the time that the first alert was sent |
254 |
+ |
* for an attribute that has passed a threshold value |
255 |
+ |
* |
256 |
+ |
* @param attrubuteNum the attribute to get the first alert time for |
257 |
+ |
*/ |
258 |
+ |
public long getInitialAlertTime(int attributeNum) { |
259 |
+ |
return _initialAlertTime[attributeNum]; |
260 |
+ |
} |
261 |
+ |
|
262 |
+ |
/** |
263 |
|
* Advances the alert level to the next one up. |
264 |
|
* |
265 |
|
* This keeps track of the number of the number |
336 |
|
* was last sent for each attribute. |
337 |
|
*/ |
338 |
|
private long[][] _times; |
339 |
+ |
|
340 |
+ |
/** |
341 |
+ |
* Initial times that an alert was first |
342 |
+ |
* raised. |
343 |
+ |
*/ |
344 |
+ |
private long[] _initialAlertTime; |
345 |
|
|
346 |
|
/** |
347 |
|
* A reference to the configuration proxy in use |