24 |
|
*/ |
25 |
|
public final String REVISION = "$Revision$"; |
26 |
|
|
27 |
+ |
/** |
28 |
+ |
* A description of this monitor |
29 |
+ |
*/ |
30 |
|
public final String DESC = "Monitors Swap."; |
31 |
|
|
32 |
|
//---STATIC METHODS--- |
34 |
|
//---CONSTRUCTORS--- |
35 |
|
|
36 |
|
//---PUBLIC METHODS--- |
37 |
< |
|
37 |
> |
|
38 |
> |
/** |
39 |
> |
* Analyse a packet of data, and generate an alert if |
40 |
> |
* necessary. |
41 |
> |
* |
42 |
> |
* @param packet the XMLPacket to analyse |
43 |
> |
*/ |
44 |
|
public void analysePacket(XMLPacket packet) { |
45 |
|
String source = packet.getParam("packet.attributes.machine_name"); |
46 |
|
if (!_hosts.containsKey(source)) { |
106 |
|
} |
107 |
|
|
108 |
|
//---PRIVATE METHODS--- |
109 |
< |
|
109 |
> |
|
110 |
> |
/** |
111 |
> |
* Checks a piece of current data, and returns the |
112 |
> |
* threshold it breaches, if any. |
113 |
> |
* |
114 |
> |
* @param attributeString a String representing the current data value |
115 |
> |
* @param reg the Register for the host |
116 |
> |
* @return the threshold level breached, if any |
117 |
> |
*/ |
118 |
|
private int checkAttributeThreshold(double swapInUse, Register reg) { |
119 |
|
for(int thresholdLevel = Alert.thresholdLevels.length - 1; thresholdLevel >= 0; thresholdLevel--) { |
120 |
|
if (reg.getThreshold(thresholdLevel) != -1.0) { |
127 |
|
} |
128 |
|
|
129 |
|
//---ACCESSOR/MUTATOR METHODS--- |
130 |
< |
|
130 |
> |
|
131 |
> |
/** |
132 |
> |
* Returns a reference to a specific Queue for this |
133 |
> |
* monitor. This Queue returns only the data packets |
134 |
> |
* (based on type) that we want too look at. |
135 |
> |
* |
136 |
> |
* @return a reference to a Queue |
137 |
> |
*/ |
138 |
|
protected Queue getQueue() { |
139 |
|
return MonitorManager.getInstance().getDataQueue(); |
140 |
|
} |
154 |
|
private String _name = "Swap"; |
155 |
|
|
156 |
|
/** |
157 |
< |
* A reference to the configuration proxy in use |
157 |
> |
* A HashMap of Registers (or groups of Registers), one |
158 |
> |
* for each host we're monitoring. |
159 |
|
*/ |
135 |
– |
private ConfigurationProxy _cp = ConfigurationProxy.getInstance(); |
136 |
– |
|
160 |
|
private HashMap _hosts = new HashMap(); |
161 |
|
|
162 |
|
//---STATIC ATTRIBUTES--- |