51 |
|
if(reg.getLastThresholdLevel(attributeNum) != Alert.thresholdNORMAL) { |
52 |
|
// if the time since the last alert is more than the time for |
53 |
|
// its timeout, fire an alert, escalate the alert |
54 |
< |
long timeout = reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum); |
54 |
> |
long timeout = reg.getLastAlertTimeout(attributeNum); |
55 |
|
if ((timeout > 0) && (reg.getTimeLastSent(attributeNum) > 0)) { |
56 |
|
if((System.currentTimeMillis() - reg.getTimeLastSent(attributeNum)) > timeout) { |
57 |
|
reg.escalateAlert(attributeNum); |
58 |
|
reg.setTimeLastSent(attributeNum, System.currentTimeMillis()); |
59 |
+ |
reg.setLastAlertTimeout(attributeNum, reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum)); |
60 |
|
fireAlert(reg, packet, attributeNum); |
61 |
|
} |
62 |
|
// if we don't have a timeout configured...we got STRAIGHT to the next level |
63 |
|
} else { |
64 |
|
reg.escalateAlert(attributeNum); |
65 |
|
reg.setTimeLastSent(attributeNum, System.currentTimeMillis()); |
66 |
+ |
reg.setLastAlertTimeout(attributeNum, reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum)); |
67 |
|
fireAlert(reg, packet, attributeNum); |
68 |
|
} |
69 |
|
|
73 |
|
// but if we weren't we only set OK, once the timout of the last |
74 |
|
// alert has occourd |
75 |
|
if (reg.getLastAlertLevel(attributeNum) != Alert.alertOK) { |
76 |
< |
long timeout = reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum); |
76 |
> |
long timeout = reg.getLastAlertTimeout(attributeNum); |
77 |
|
if ((timeout > 0) && (reg.getTimeLastSent(attributeNum) > 0)) { |
78 |
|
if ((System.currentTimeMillis() - reg.getTimeLastSent(attributeNum)) > timeout) { |
79 |
|
reg.setLastAlertLevel(attributeNum, Alert.alertOK); |
80 |
|
reg.setTimeLastSent(attributeNum, System.currentTimeMillis()); |
81 |
+ |
reg.setLastAlertTimeout(attributeNum, timeout); |
82 |
|
fireAlert(reg, packet, attributeNum); |
83 |
|
} |
81 |
– |
} else { |
82 |
– |
reg.setLastAlertLevel(attributeNum, Alert.alertOK); |
83 |
– |
reg.setTimeLastSent(attributeNum, System.currentTimeMillis()); |
84 |
– |
fireAlert(reg, packet, attributeNum); |
84 |
|
} |
85 |
|
} |
86 |
|
} |