ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/java/SystemMonitor.java
(Generate patch)

Comparing projects/cms/source/host/java/SystemMonitor.java (file contents):
Revision 1.8 by tdb, Fri Jan 19 00:13:49 2001 UTC vs.
Revision 1.9 by ab11, Mon Mar 19 17:30:17 2001 UTC

# Line 8 | Line 8 | import java.util.*;
8  
9   /**
10   * Gathers system information then outputs it as XML
11 < * Collects data based on properties gained from the configurator
12 < * then packages these up using XMLFormatter and outputs them if
13 < * the timeout has passed.
11 > * Collects data based on properties gained from the
12 > * configurator then packages these up using XMLFormatter
13 > * and outputs them if the timeout has passed.
14   *
15   * @author  $Author$
16   * @version $Id$
# Line 24 | Line 24 | class SystemMonitor {
24   //---CONSTRUCTORS---
25  
26   /**
27 < * Public constructor for the class. Takes in a Config object to gain its
28 < * properties from.
27 > * Public constructor for the class. Takes in a Config
28 > * object to gain its properties from.
29   *
30   */  
31   public SystemMonitor( Config config ){
# Line 34 | Line 34 | class SystemMonitor {
34          
35          lastCheck = System.currentTimeMillis();
36          sequence = 1;
37
38
39        // why oh why wont ultra edit let me put Long in the next line? oh its trying to
40        // correct keywords =|
41        /*
37          
43        try {
44                udpcheckInterval = Long.parseLong(config.getProperty("UDPUpdateTime")) * 1000;
45        }
46        catch ( NumberFormatException e ){
47                System.out.println("The value for UDPUpdateTime is invalid, using a default");
48                // 5 mins
49                udpcheckInterval = 5000 * 60;
50        }
51        */
52        
53        // make the check interval into seconds
54        
38      }
39  
40   //---PUBLIC METHODS---
# Line 67 | Line 50 | class SystemMonitor {
50          String ip = new String();
51          try {
52              host = InetAddress.getLocalHost().getHostName();
53 <                    ip = InetAddress.getLocalHost().getHostAddress();
53 >            ip = InetAddress.getLocalHost().getHostAddress();
54          } catch(UnknownHostException e) {
55              System.out.println(e);
56          }
57 <                String date = Long.toString(System.currentTimeMillis());
57 >        String date = Long.toString(System.currentTimeMillis());
58          XMLFormatter xml = new XMLFormatter("packet", "machine_name=\""+host+"\" ip=\""+ip+"\" date=\""+date+"\" seq_no=\""+sequence+"\" type=\"data\"");
59  
60 <            // get and decode the data
61 <            DecodeCPU_TXT details = new DecodeCPU_TXT();
60 >        // get and decode the data
61 >        DecodeCPU_TXT details = new DecodeCPU_TXT();
62  
63          // add the decoded info
64          xml.addString(details.getItems());
82        
83        
84        /*
85        // MUST FIX THIS..!!!!
86        try {
87                long updateIn = ( lastCheck + udpcheckInterval )-System.currentTimeMillis();
88                if ( updateIn > 0 ){
89                        Thread.sleep(updateIn);
90                }
91                else
92                {
93                        Thread.sleep(defaultUpdateTime);
94                }
95        }
96        catch( InterruptedException e ){
97                System.out.println("Sleep interrupted");
98        }
99        */
65          
66          // increment sequence.
67          sequence++;
# Line 117 | Line 82 | class SystemMonitor {
82  
83   //---STATIC ATTRIBUTES---
84  
85 < } // class
85 > } // class

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines