ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/Queue__Monitor.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/Queue__Monitor.java (file contents):
Revision 1.4 by ajm, Thu Mar 22 17:57:06 2001 UTC vs.
Revision 1.11 by tdb, Fri Mar 23 18:07:42 2001 UTC

# Line 28 | Line 28 | public class Queue__Monitor extends MonitorSkeleton {
28       */
29      public final String REVISION = "$Revision$";
30      
31 +    /**
32 +     * A description of this monitor
33 +     */
34      public final String DESC = "Who watches the watchmen?";
35      
36 +    private final String SOURCE = "i-scream-server";
37 +    
38   //---STATIC METHODS---
39  
40   //---CONSTRUCTORS---
41  
42   //---PUBLIC METHODS---
43 <
43 >    
44 >    /**
45 >     * Analyse a packet of data, and generate an alert if
46 >     * necessary.
47 >     *
48 >     * @param packet the XMLPacket to analyse
49 >     */
50      public void analysePacket(XMLPacket packet) {
51          if (packet.getParam("packet.attributes.type").equals("queueStat")) {
52              String source = packet.getParam("packet.attributes.hashCode");
# Line 63 | Line 74 | public class Queue__Monitor extends MonitorSkeleton {
74                      // check if we've seen this queue before on a previous run
75                      // if not, we need to create a register for it
76                      if(!queueRegisters.containsKey(dataKey)) {
77 <                        queueRegisters.put(dataKey, new Register(source, _name));
77 >                        queueRegisters.put(dataKey, new Register(_name, _name));
78                      }
79  
80                      // get the register for this disk
# Line 86 | Line 97 | public class Queue__Monitor extends MonitorSkeleton {
97                      
98                      boolean useValue = false;
99                      try {
100 <                        String option = _cp.getProperty("Host." + source, "Monitor." + _name + ".thresholdMeasure");
100 >                        String option = _cp.getProperty(_name, "Monitor." + _name + ".thresholdMeasure");
101                          if (option.equals("VALUE")) {
102                              useValue = true;
103                          }                            
# Line 99 | Line 110 | public class Queue__Monitor extends MonitorSkeleton {
110                      double checkValue;
111                      String type;
112                      if(useValue) {
113 <                        // kb disk in use
113 >                        // queue count
114                          checkValue = qSize;
115                          type = "count";
116                      } else {
117 <                        // % disk in use
117 >                        // % of queue
118                          checkValue = (qSize / qMax) * 100;
119                          type = "%";
120                      }
# Line 117 | Line 128 | public class Queue__Monitor extends MonitorSkeleton {
128                      String strCheckValue = nf.format(checkValue);
129  
130                      // say which disk had the problem
131 <                    String attributeName = "Size of queue " + type + " in " + queueName;
131 >                    String attributeName = "Size of queue " + type + " in " + queueName + " " + dataKey.substring(dataKey.lastIndexOf('.')+1);
132                                              
133 <                    processAlert(newThreshold, attributeName, reg, source, strCheckValue);
133 >                    processAlert(newThreshold, attributeName, reg, SOURCE, strCheckValue);
134                    
135                  }
136              }
# Line 150 | Line 161 | public class Queue__Monitor extends MonitorSkeleton {
161      }
162  
163   //---PRIVATE METHODS---
164 <
164 >    
165 >    /**
166 >     * Checks a piece of current data, and returns the
167 >     * threshold it breaches, if any.
168 >     *
169 >     * @param qSize the size of a queue
170 >     * @param reg the Register for the host
171 >     * @return the threshold level breached, if any
172 >     */
173      private int checkAttributeThreshold(double qSize, Register reg) {
174          for(int thresholdLevel = Alert.thresholdLevels.length - 1; thresholdLevel >= 0; thresholdLevel--) {
175              if (reg.getThreshold(thresholdLevel) != -1.0) {
# Line 163 | Line 182 | public class Queue__Monitor extends MonitorSkeleton {
182      }
183  
184   //---ACCESSOR/MUTATOR METHODS---
185 <
185 >    
186 >    /**
187 >     * Returns a reference to a specific Queue for this
188 >     * monitor. This Queue returns only the data packets
189 >     * (based on type) that we want too look at.
190 >     *
191 >     * @return a reference to a Queue
192 >     */
193      protected Queue getQueue() {
194          return MonitorManager.getInstance().getOtherQueue();
195      }
# Line 186 | Line 212 | public class Queue__Monitor extends MonitorSkeleton {
212       * A reference to the configuration proxy in use
213       */
214      private ConfigurationProxy _cp = ConfigurationProxy.getInstance();
215 <
215 >    
216 >    /**
217 >     * A HashMap of Registers (or groups of Registers), one
218 >     * for each host we're monitoring.
219 >     */
220      private HashMap _hosts = new HashMap();
221  
222   //---STATIC ATTRIBUTES---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines