32 |
|
//---PUBLIC METHODS--- |
33 |
|
|
34 |
|
public void analysePacket(XMLPacket packet) { |
35 |
– |
if (packet.getParam("packet.attributes.type").equals("data")) { |
36 |
– |
String source = packet.getParam("packet.attributes.machine_name"); |
37 |
– |
if (!_hosts.containsKey(source)) { |
38 |
– |
HashMap attributeRegisters = new HashMap(); |
39 |
– |
initAttributeRegsiters(source, attributeRegisters); |
40 |
– |
_hosts.put(source, attributeRegisters); |
41 |
– |
} |
35 |
|
|
36 |
< |
HashMap attributeRegisters = (HashMap) _hosts.get(source); |
37 |
< |
for(int attributeNum = 0; attributeNum < _attributes.length; attributeNum++) { |
38 |
< |
Register reg = (Register) attributeRegisters.get(_attributes[attributeNum]); |
39 |
< |
// find out the threshold level we're at |
40 |
< |
String attribute = _attributes[attributeNum]; |
48 |
< |
String attributeName = _attributeNames[attributeNum]; |
49 |
< |
String currentValue = packet.getParam(attribute); |
50 |
< |
int newThreshold = checkAttributeThreshold(currentValue, reg); |
51 |
< |
processAlert(newThreshold, attributeName, reg, source, currentValue); |
52 |
< |
} |
36 |
> |
String source = packet.getParam("packet.attributes.machine_name"); |
37 |
> |
if (!_hosts.containsKey(source)) { |
38 |
> |
HashMap attributeRegisters = new HashMap(); |
39 |
> |
initAttributeRegsiters(source, attributeRegisters); |
40 |
> |
_hosts.put(source, attributeRegisters); |
41 |
|
} |
42 |
+ |
|
43 |
+ |
HashMap attributeRegisters = (HashMap) _hosts.get(source); |
44 |
+ |
for(int attributeNum = 0; attributeNum < _attributes.length; attributeNum++) { |
45 |
+ |
Register reg = (Register) attributeRegisters.get(_attributes[attributeNum]); |
46 |
+ |
// find out the threshold level we're at |
47 |
+ |
String attribute = _attributes[attributeNum]; |
48 |
+ |
String attributeName = _attributeNames[attributeNum]; |
49 |
+ |
String currentValue = packet.getParam(attribute); |
50 |
+ |
int newThreshold = checkAttributeThreshold(currentValue, reg); |
51 |
+ |
processAlert(newThreshold, attributeName, reg, source, currentValue); |
52 |
+ |
} |
53 |
+ |
|
54 |
|
} |
55 |
|
|
56 |
|
/** |
103 |
|
} |
104 |
|
|
105 |
|
//---ACCESSOR/MUTATOR METHODS--- |
106 |
+ |
|
107 |
+ |
protected Queue getQueue() { |
108 |
+ |
return MonitorManager.getInstance().getDataQueue(); |
109 |
+ |
} |
110 |
+ |
|
111 |
|
|
112 |
|
//---ATTRIBUTES--- |
113 |
|
|