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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/Disk__Monitor.java (file contents):
Revision 1.2 by ajm, Fri Mar 9 03:30:55 2001 UTC vs.
Revision 1.6 by ajm, Thu Mar 22 01:51:27 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.client.monitors;
2 > package uk.org.iscream.client.monitors;
3  
4   //---IMPORTS---
5   import java.util.HashMap;
# Line 7 | Line 7 | import java.util.ArrayList;
7   import java.util.Set;
8   import java.util.Iterator;
9   import java.text.NumberFormat;
10 < import uk.ac.ukc.iscream.client.*;
11 < import uk.ac.ukc.iscream.core.*;
12 < import uk.ac.ukc.iscream.util.*;
13 < import uk.ac.ukc.iscream.componentmanager.*;
10 > import uk.org.iscream.client.*;
11 > import uk.org.iscream.core.*;
12 > import uk.org.iscream.util.*;
13 > import uk.org.iscream.componentmanager.*;
14  
15   /**
16   * This Monitor watches the Disks for all machines
# Line 89 | Line 89 | public class Disk__Monitor extends MonitorSkeleton {
89                          // check if we've seen this disk before on a previous run
90                          // if not, we need to create a register for it
91                          if(!diskRegisters.containsKey(diskNumber)) {
92 <                            diskRegisters.put(diskNumber, new Register(source, _name));
92 >                            diskRegisters.put(diskNumber, new Register(source, _name, mount));
93                          }
94  
95                          // get the register for this disk
# Line 109 | Line 109 | public class Disk__Monitor extends MonitorSkeleton {
109                              // don't try to continue and process, try next disk
110                              break;
111                          }
112 <            
113 <                        // percentage of memory in use
114 <                        double diskInUse = (1 - (diskAvail / diskTotal)) * 100;
112 >                        
113 >                        boolean useValue = false;
114 >                        try {
115 >                            String option = _cp.getProperty("Host." + source, "Monitor." + _name + ".thresholdMeasure");
116 >                            if (option.equals("VALUE")) {
117 >                                useValue = true;
118 >                            }                            
119 >                        } catch (PropertyNotFoundException e) {
120 >                            // we default to percentage
121 >                        }
122 >                        
123 >                        // this  bit determines if the disk check is a % check
124 >                        // or a kb check
125 >                        double diskInUse;
126 >                        String type;
127 >                        if(useValue) {
128 >                            // kb disk in use
129 >                            diskInUse = diskTotal - diskAvail;
130 >                            type = "kb";
131 >                        } else {
132 >                            // % disk in use
133 >                            diskInUse = (1 - (diskAvail / diskTotal)) * 100;
134 >                            type = "%";
135 >                        }
136 >                        
137 >                        
138 >                        
139                          int newThreshold = checkAttributeThreshold(diskInUse, reg);
140              
141 <                        // format the memoryInUse to a String
141 >                        // format the diskInUse to a String
142                          NumberFormat nf = NumberFormat.getInstance();
143                          nf.setMaximumFractionDigits(2);
144                          nf.setMinimumFractionDigits(2);
145                          String strDiskInUse = nf.format(diskInUse);
146    
147                          // say which disk had the problem
148 <                        String attributeName = "Disk in use % on " + mount + " (" + device + ")";
148 >                        String attributeName = "Disk in use " + type + " on " + mount + " (" + device + ")";
149                                                  
150                          processAlert(newThreshold, attributeName, reg, source, strDiskInUse);
151                      }
# Line 134 | Line 158 | public class Disk__Monitor extends MonitorSkeleton {
158       * Overrides the {@link java.lang.Object#toString() Object.toString()}
159       * method to provide clean logging (every class should have this).
160       *
161 <     * This uses the uk.ac.ukc.iscream.util.NameFormat class
161 >     * This uses the uk.org.iscream.util.NameFormat class
162       * to format the toString()
163       *
164       * @return the name of this class and its CVS revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines