76 |
|
|
77 |
|
std::cout << "Starting Data Collection\n"; |
78 |
|
// work out which is closer, the next heartbeat or the next data collection |
79 |
< |
long localTime = time(NULL); |
79 |
> |
int localTime = time(NULL); |
80 |
|
// std::cout << "#"; |
81 |
|
int nextUDPTime = localTime + UDPUpdateTime; |
82 |
|
int nextAveragerTime = localTime + AveragerUpdateTime; |
83 |
|
int nextTCPTime = localTime + TCPUpdateTime; |
84 |
< |
long sequence = 0; |
84 |
> |
int sequence = 0; |
85 |
|
|
86 |
|
int nextAction = 0; |
87 |
|
while ( noErrors == 1){ |
127 |
|
} // if |
128 |
|
MaxFilterRetrys = 5; |
129 |
|
} // if |
130 |
< |
|
130 |
> |
// reloadConfig is done now |
131 |
> |
reloadConfig = 0; |
132 |
|
} // if reloadconfig |
133 |
|
|
134 |
|
|
135 |
+ |
|
136 |
|
localTime = time(NULL); |
137 |
|
// std::cout << "."; |
138 |
|
// keep going while no non-fatal errors have occurred |
166 |
|
|
167 |
|
// sleep until this time only if it is greater than 1! |
168 |
|
if ( waitTime >= 1 ){ |
167 |
– |
// need to output \n to std::cout or the wait is infinate!!!! ????? |
168 |
– |
// will core dump if debug = 0 |
169 |
|
sleep(waitTime); /// crashes here |
170 |
|
|
171 |
|
} |
213 |
|
string host = (config.getSmallNet())->getHostName(); |
214 |
|
string ip = (config.getSmallNet())->getHostIP(); |
215 |
|
|
216 |
< |
char * buffer; |
217 |
< |
buffer = l64a( sequence ); |
218 |
< |
char * seq = buffer; |
219 |
< |
buffer = l64a( localTime ); |
220 |
< |
char * date = buffer; |
221 |
< |
|
222 |
< |
|
223 |
< |
string attributes = "type=\"data\" machine_name=\""+host+"\" ip=\""+ip+"\" date=\""+date+"\" seq_no=\""+seq+"\""; |
216 |
> |
string seq = ""; |
217 |
> |
// char * buffer; |
218 |
> |
char buffer[32]; |
219 |
> |
sprintf(buffer,"%u", sequence); |
220 |
> |
seq = buffer; |
221 |
> |
string date = ""; |
222 |
> |
sprintf(buffer,"%u", localTime); |
223 |
> |
date = buffer; |
224 |
> |
string attributes = "type=\"data\" machine_name=\""+host+"\" ip=\""+ip+"\" date=\""+date+"\" seq_no=\""+seq+"\""; |
225 |
|
|
226 |
|
XMLFormatter xml("packet",attributes); |
227 |
|
// put in the data |
228 |
|
xml.addString(sysMon.getData()); |
229 |
|
(config.getSmallNet())->sendUPDPacket(config.getUDPFilterName(), config.getUDPFilterPort(), xml.returnXML()); |
230 |
< |
|
230 |
> |
sequence++; |
231 |
|
break; |
232 |
|
} // switch |
233 |
|
|
241 |
|
|
242 |
|
return 0; |
243 |
|
|
244 |
< |
} // main |
244 |
> |
} // main |