35 |
|
if (packet.getParam("packet.attributes.type").equals("data")) { |
36 |
|
String source = packet.getParam("packet.attributes.machine_name"); |
37 |
|
if (!_hosts.containsKey(source)) { |
38 |
< |
_hosts.put(source, new Register(source, _name, _attributes.length)); |
38 |
> |
HashMap attributeRegisters = new HashMap(); |
39 |
> |
initAttributeRegsiters(source, attributeRegisters); |
40 |
> |
_hosts.put(source, attributeRegisters); |
41 |
|
} |
42 |
< |
|
43 |
< |
Register reg = (Register) _hosts.get(source); |
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, attributeNum, attributeName, reg, source, currentValue); |
51 |
> |
processAlert(newThreshold, attributeName, reg, source, currentValue); |
52 |
|
} |
53 |
|
} |
54 |
|
} |
93 |
|
} |
94 |
|
} |
95 |
|
return Alert.thresholdNORMAL; |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
private void initAttributeRegsiters(String source, HashMap attributeRegisters) { |
99 |
+ |
for(int attributeNum = 0; attributeNum < _attributes.length; attributeNum++) { |
100 |
+ |
attributeRegisters.put(_attributes[attributeNum], new Register(source, _name)); |
101 |
+ |
} |
102 |
|
} |
103 |
|
|
104 |
|
//---ACCESSOR/MUTATOR METHODS--- |