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/CPU__Monitor.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/CPU__Monitor.java (file contents):
Revision 1.13 by ajm, Sun Mar 4 05:23:41 2001 UTC vs.
Revision 1.14 by ajm, Mon Mar 5 12:45:51 2001 UTC

# Line 54 | Line 54 | public class CPU__Monitor implements PluginMonitor {
54                      long timeout = reg.getLastAlertTimeout(attributeNum);
55                      if ((timeout > 0) && (reg.getTimeLastSent(attributeNum) > 0)) {
56                          if((System.currentTimeMillis() - reg.getTimeLastSent(attributeNum)) > timeout) {
57 +                            int lastAlert = reg.getLastAlertLevel(attributeNum);
58                              reg.escalateAlert(attributeNum);
59                              reg.setTimeLastSent(attributeNum, System.currentTimeMillis());
60                              reg.setLastAlertTimeout(attributeNum, reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum));
61 <                            fireAlert(reg, packet, attributeNum);
61 >                            fireAlert(reg, lastAlert, packet, attributeNum);
62                          }
63                      // if we don't have a timeout configured...we got STRAIGHT to the next level
64                      } else {
65 +                        int lastAlert = reg.getLastAlertLevel(attributeNum);
66                          reg.escalateAlert(attributeNum);
67                          reg.setTimeLastSent(attributeNum, System.currentTimeMillis());
68                          reg.setLastAlertTimeout(attributeNum, reg.getAlertTimeout(reg.getLastAlertLevel(attributeNum), attributeNum));
69 <                        fireAlert(reg, packet, attributeNum);
69 >                        fireAlert(reg, lastAlert, packet, attributeNum);
70                      }
71                          
72                  // we must be on ok, check the timeout value for this
# Line 76 | Line 78 | public class CPU__Monitor implements PluginMonitor {
78                          long timeout = reg.getLastAlertTimeout(attributeNum);
79                          if ((timeout > 0) && (reg.getTimeLastSent(attributeNum) > 0)) {
80                              if ((System.currentTimeMillis() - reg.getTimeLastSent(attributeNum)) > timeout) {
81 +                                int lastAlert = reg.getLastAlertLevel(attributeNum);
82                                  reg.setLastAlertLevel(attributeNum, Alert.alertOK);
83                                  reg.setTimeLastSent(attributeNum, System.currentTimeMillis());
84                                  reg.setLastAlertTimeout(attributeNum, timeout);
85 <                                fireAlert(reg, packet, attributeNum);
85 >                                fireAlert(reg, lastAlert, packet, attributeNum);
86                              }
87                          }
88                      }
# Line 130 | Line 133 | public class CPU__Monitor implements PluginMonitor {
133          return 0;
134      }
135  
136 <    private void fireAlert(Register reg, XMLPacket packet, int attributeNum) {
136 >    private void fireAlert(Register reg, int lastAlert, XMLPacket packet, int attributeNum) {
137          int alertLevel = reg.getLastAlertLevel(attributeNum);
138          int thresholdLevel = reg.getLastThresholdLevel(attributeNum);
139          String source = packet.getParam("packet.attributes.machine_name");
# Line 144 | Line 147 | public class CPU__Monitor implements PluginMonitor {
147          if (alertLevel == Alert.alertOK) {
148              time = "0";
149          }
150 <        Alert alert = new Alert(alertLevel, thresholdLevel, source, thresholdValue, currentValue, attributeName, time);
150 >        Alert alert = new Alert(alertLevel, lastAlert, thresholdLevel, source, thresholdValue, currentValue, attributeName, time);
151          _alerterQueue.add(alert);
152          _logger.write(toString(), Logger.DEBUG, "Fired alert for source:" + source + " at alert level:" + Alert.alertLevels[alertLevel] + " on:" + attributeName + " for threshold level:" + Alert.thresholdLevels[thresholdLevel] + " at:" +  currentValue + " exceeding threshold of:" +thresholdValue + " next alert sent in:" + time + "secs");
153      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines