| Line 32... |
Line 32... |
| 32 |
entityHandler = context.getBean(EntityHandler.class);
|
32 |
entityHandler = context.getBean(EntityHandler.class);
|
| 33 |
}
|
33 |
}
|
| 34 |
|
34 |
|
| 35 |
public static void main(String[] args) {
|
35 |
public static void main(String[] args) {
|
| 36 |
AlertTask alertTask = new AlertTask();
|
36 |
AlertTask alertTask = new AlertTask();
|
| 37 |
// entitiesToBeAlerted = entityHandler.getEntitiesToBeAlerted();
|
- |
|
| 38 |
activeAlertEntities = entityHandler.getActiveAlertEntities();
|
37 |
activeAlertEntities = entityHandler.getActiveAlertEntities();
|
| 39 |
|
38 |
|
| 40 |
for(MonitoredEntity entity : activeAlertEntities) {
|
39 |
for(MonitoredEntity entity : activeAlertEntities) {
|
| 41 |
if(entity.getCriticalExpiryTime() <= (new Date()).getTime()) {
|
40 |
if(entity.getCriticalExpiryTime()!=0 && entity.getCriticalExpiryTime() <= (new Date()).getTime()) {
|
| 42 |
AlertMapper alertMap;
|
41 |
AlertMapper alertMap;
|
| 43 |
String delayedEventDescription = "UNKNOWN";
|
42 |
String delayedEventDescription = "UNKNOWN";
|
| 44 |
alertMap = entityHandler.getAlertMapper(entity.getEntityType(), entity.getEventType());
|
43 |
alertMap = entityHandler.getAlertMapper(entity.getEntityType(), entity.getEventType());
|
| 45 |
if(alertMap!=null) {
|
44 |
if(alertMap!=null) {
|
| 46 |
delayedEventDescription = alertMap.getEventdesciption();
|
45 |
delayedEventDescription = alertMap.getEventdesciption();
|
| Line 52... |
Line 51... |
| 52 |
if(entity.getEntityProcessedState() != EntityProcessedState.CRITICAL_SENT) {
|
51 |
if(entity.getEntityProcessedState() != EntityProcessedState.CRITICAL_SENT) {
|
| 53 |
alert(entity, EntityProcessedState.CRITICAL_SENT);
|
52 |
alert(entity, EntityProcessedState.CRITICAL_SENT);
|
| 54 |
entityHandler.updateEntityProcessedState(entity.getId(),
|
53 |
entityHandler.updateEntityProcessedState(entity.getId(),
|
| 55 |
EntityProcessedState.CRITICAL_SENT);
|
54 |
EntityProcessedState.CRITICAL_SENT);
|
| 56 |
}
|
55 |
}
|
| 57 |
} else if(entity.getWarnExpiryTime() <= (new Date()).getTime()) {
|
56 |
} else if(entity.getWarnExpiryTime()!=0 && entity.getWarnExpiryTime() <= (new Date()).getTime()) {
|
| 58 |
AlertMapper alertMap;
|
57 |
AlertMapper alertMap;
|
| 59 |
String delayedEventDescription = "UNKNOWN";
|
58 |
String delayedEventDescription = "UNKNOWN";
|
| 60 |
alertMap = entityHandler.getAlertMapper(entity.getEntityType(), entity.getEventType());
|
59 |
alertMap = entityHandler.getAlertMapper(entity.getEntityType(), entity.getEventType());
|
| 61 |
if(alertMap!=null) {
|
60 |
if(alertMap!=null) {
|
| 62 |
delayedEventDescription = alertMap.getEventdesciption();
|
61 |
delayedEventDescription = alertMap.getEventdesciption();
|
| Line 95... |
Line 94... |
| 95 |
logActive.warn(new Date(entity.getLastAlertedTime()) + "\tEntityType=" +
|
94 |
logActive.warn(new Date(entity.getLastAlertedTime()) + "\tEntityType=" +
|
| 96 |
entity.getEntityType() + " ; "+"\tEventType=" + delayedEventDescription + " ; " +
|
95 |
entity.getEntityType() + " ; "+"\tEventType=" + delayedEventDescription + " ; " +
|
| 97 |
"AlertSeverity=WARN ; " + "ExpiredTime=" + new Date(entity.getLastAlertedTime()));
|
96 |
"AlertSeverity=WARN ; " + "ExpiredTime=" + new Date(entity.getLastAlertedTime()));
|
| 98 |
}
|
97 |
}
|
| 99 |
}
|
98 |
}
|
| 100 |
|
- |
|
| 101 |
}
|
99 |
}
|
| 102 |
|
100 |
|
| 103 |
private static boolean alert(MonitoredEntity entity,
|
101 |
private static boolean alert(MonitoredEntity entity,
|
| 104 |
EntityProcessedState state) {
|
102 |
EntityProcessedState state) {
|
| 105 |
String delayedEventDescription = "UNKNOWN";
|
103 |
String delayedEventDescription = "UNKNOWN";
|