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

Comparing projects/cms/source/host/c++/Host.cpp (file contents):
Revision 1.3 by ab11, Tue Mar 6 00:40:28 2001 UTC vs.
Revision 1.4 by ab11, Fri Mar 23 14:08:49 2001 UTC

# Line 134 | Line 134 | int main(){
134                  
135                  
136                  localTime = time(NULL);
137                //  std::cout << ".";
137                  // keep going while no non-fatal errors have occurred
138                  int waitTime = 0;
139                  
140                  if ( nextTCPTime  <= nextAveragerTime ){
142                        // std::cout << "-";
141                          if ( nextTCPTime >= nextUDPTime ){
144                                // std::cout << "}";
142                                  nextAction = 3;
143                                  waitTime = nextUDPTime - localTime;
144                          } else {
145                                  // set the heartbeat to be the next item
149                                // std::cout << "{";
146                                  nextAction = 1;
147                                  waitTime = nextTCPTime - localTime;
148                          } // if
149                  } else {
154                        // std::cout << "+";
150                          if ( nextAveragerTime >=  nextUDPTime ){
156                                // std::cout << "[";
151                                  nextAction = 3;
152                                  waitTime = nextUDPTime - localTime;
153                          } else {
154                                  // set grabstats to be in the next action
161                                // std::cout << "]";
155                                  nextAction = 2;
156                                  waitTime = nextAveragerTime - localTime;
157                          } // if
# Line 166 | Line 159 | int main(){
159                  
160                  // sleep until this time only if it is greater than 1!
161                  if ( waitTime >= 1 ){
162 <                        sleep(waitTime); /// crashes here
162 >                        sleep(waitTime);
163                          
164                  }
165                  
# Line 202 | Line 195 | int main(){
195                                  
196                                  break;
197                          case 2: nextAveragerTime = localTime + AveragerUpdateTime;
198 +                                /*
199                                  if ( sysMon.collect() > 0 ){
200                                          // suggests that there should be an alert
201                                          std::cout << "Alert Status" << endl;                                    
202 <                                }
202 >                                    }*/
203                                  break;
204                          default: std::cout << "Scheduled UDP Connection" << endl;
205 +                             sysMon.collect();
206                                   nextUDPTime = localTime + UDPUpdateTime;
207                                   // package up the system data
208 <                                 string host = (config.getSmallNet())->getHostName();
208 >                                 string host = config.getFQDN();
209                                   string ip = (config.getSmallNet())->getHostIP();
210                                  
211                                   string seq = "";
# Line 221 | Line 216 | int main(){
216                                   string date = "";
217                                   sprintf(buffer,"%u", localTime);
218                                   date = buffer;
219 <                         string attributes = "type=\"data\" machine_name=\""+host+"\" ip=\""+ip+"\" date=\""+date+"\" seq_no=\""+seq+"\"";
219 >                         string attributes = "type=\"data\" machine_name=\""+host+"\" date=\""+date+"\" seq_no=\""+seq+"\"";
220  
221                                   XMLFormatter xml("packet",attributes);
222                                   // put in the data
223                                   xml.addString(sysMon.getData());
224                                   (config.getSmallNet())->sendUPDPacket(config.getUDPFilterName(), config.getUDPFilterPort(), xml.returnXML());
225 +                                 // now clear the averaged data
226 +                                 sysMon.clearData();
227                                   sequence++;
228                                   break;
229                  } // switch

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines