101 |
*/ |
*/ |
102 |
static int check_apache_stat(Socket_T s) { |
static int check_apache_stat(Socket_T s) { |
103 |
|
|
|
char line[STRLEN]; |
|
|
char search_string[STRLEN]; |
|
104 |
int scored = 0; |
int scored = 0; |
|
int tests = 0; |
|
105 |
int errors = 0; |
int errors = 0; |
106 |
|
char line[STRLEN]; |
107 |
|
char search_string[STRLEN]; |
108 |
|
|
109 |
int loglimit= 0; |
int loglimit= 0; |
110 |
int closelimit= 0; |
int closelimit= 0; |
215 |
*/ |
*/ |
216 |
|
|
217 |
if(loglimit > 0){ |
if(loglimit > 0){ |
|
tests++; |
|
218 |
if(Util_evalQExpression(myPort->ApacheStatus.loglimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.loglimitOP, |
219 |
(100 * no_logging / active_servers), loglimit)) { |
(100 * no_logging / active_servers), loglimit)) { |
220 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
224 |
} |
} |
225 |
|
|
226 |
if(startlimit > 0){ |
if(startlimit > 0){ |
|
tests++; |
|
227 |
if(Util_evalQExpression(myPort->ApacheStatus.startlimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.startlimitOP, |
228 |
(100 * no_start / active_servers), startlimit)) { |
(100 * no_start / active_servers), startlimit)) { |
229 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
233 |
} |
} |
234 |
|
|
235 |
if(requestlimit > 0){ |
if(requestlimit > 0){ |
|
tests++; |
|
236 |
if(Util_evalQExpression(myPort->ApacheStatus.requestlimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.requestlimitOP, |
237 |
(100 * no_request / active_servers), requestlimit)) { |
(100 * no_request / active_servers), requestlimit)) { |
238 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
243 |
} |
} |
244 |
|
|
245 |
if(replylimit > 0 ){ |
if(replylimit > 0 ){ |
|
tests++; |
|
246 |
if(Util_evalQExpression(myPort->ApacheStatus.replylimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.replylimitOP, |
247 |
(100 * no_reply / active_servers), replylimit)) { |
(100 * no_reply / active_servers), replylimit)) { |
248 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
252 |
} |
} |
253 |
|
|
254 |
if(keepalivelimit > 0){ |
if(keepalivelimit > 0){ |
|
tests++; |
|
255 |
if(Util_evalQExpression(myPort->ApacheStatus.keepalivelimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.keepalivelimitOP, |
256 |
(100 * no_keepalive / active_servers), keepalivelimit)) { |
(100 * no_keepalive / active_servers), keepalivelimit)) { |
257 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
261 |
} |
} |
262 |
|
|
263 |
if(dnslimit > 0){ |
if(dnslimit > 0){ |
|
tests++; |
|
264 |
if(Util_evalQExpression(myPort->ApacheStatus.dnslimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.dnslimitOP, |
265 |
(100 * no_dns / active_servers), dnslimit)) { |
(100 * no_dns / active_servers), dnslimit)) { |
266 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
270 |
} |
} |
271 |
|
|
272 |
if(closelimit > 0){ |
if(closelimit > 0){ |
|
tests++; |
|
273 |
if(Util_evalQExpression(myPort->ApacheStatus.closelimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.closelimitOP, |
274 |
(100 * no_close / active_servers), closelimit)){ |
(100 * no_close / active_servers), closelimit)){ |
275 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
280 |
} |
} |
281 |
|
|
282 |
if(gracefullimit > 0){ |
if(gracefullimit > 0){ |
|
tests++; |
|
283 |
if(Util_evalQExpression(myPort->ApacheStatus.gracefullimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.gracefullimitOP, |
284 |
(100 * no_graceful / active_servers), gracefullimit)) { |
(100 * no_graceful / active_servers), gracefullimit)) { |
285 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
290 |
} |
} |
291 |
|
|
292 |
if(cleanuplimit > 0){ |
if(cleanuplimit > 0){ |
|
tests++; |
|
293 |
if(Util_evalQExpression(myPort->ApacheStatus.cleanuplimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.cleanuplimitOP, |
294 |
(100 * no_cleanup / active_servers), cleanuplimit)) { |
(100 * no_cleanup / active_servers), cleanuplimit)) { |
295 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
300 |
} |
} |
301 |
|
|
302 |
if(waitlimit > 0){ |
if(waitlimit > 0){ |
|
tests++; |
|
303 |
if(Util_evalQExpression(myPort->ApacheStatus.waitlimitOP, |
if(Util_evalQExpression(myPort->ApacheStatus.waitlimitOP, |
304 |
(100 * no_wait / active_servers), waitlimit)) { |
(100 * no_wait / active_servers), waitlimit)) { |
305 |
log("APACHE-STATUS error:" |
log("APACHE-STATUS error:" |
309 |
} |
} |
310 |
} |
} |
311 |
|
|
312 |
/* If no tests have been specified just return true. This should |
return (errors==0); |
|
been catched by the parser */ |
|
|
if(tests == 0){ |
|
|
DEBUG("APACHE-STATUS warning: no tests given to perform\n"); |
|
|
return TRUE; |
|
|
} |
|
|
|
|
|
/* Single and multple tests return here, if all are failed */ |
|
|
if(errors == tests) |
|
|
return FALSE; |
|
|
|
|
|
/* Single test passed, or multiple tests but not all failed */ |
|
|
return TRUE; |
|
313 |
|
|
314 |
} |
} |