/[monit]/monit/protocols/apache_status.c
ViewVC logotype

Diff of /monit/protocols/apache_status.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by hauk, Sun Dec 12 23:45:09 2004 UTC revision 1.2 by hauk, Sat Dec 18 23:41:20 2004 UTC
# Line 101  int check_apache_status(Socket_T s) { Line 101  int check_apache_status(Socket_T s) {
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;
# Line 216  static int check_apache_stat(Socket_T s) Line 215  static int check_apache_stat(Socket_T s)
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:"
# Line 226  static int check_apache_stat(Socket_T s) Line 224  static int check_apache_stat(Socket_T s)
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:"
# Line 236  static int check_apache_stat(Socket_T s) Line 233  static int check_apache_stat(Socket_T s)
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:"
# Line 247  static int check_apache_stat(Socket_T s) Line 243  static int check_apache_stat(Socket_T s)
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:"
# Line 257  static int check_apache_stat(Socket_T s) Line 252  static int check_apache_stat(Socket_T s)
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:"
# Line 267  static int check_apache_stat(Socket_T s) Line 261  static int check_apache_stat(Socket_T s)
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:"
# Line 277  static int check_apache_stat(Socket_T s) Line 270  static int check_apache_stat(Socket_T s)
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:"
# Line 288  static int check_apache_stat(Socket_T s) Line 280  static int check_apache_stat(Socket_T s)
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:"
# Line 299  static int check_apache_stat(Socket_T s) Line 290  static int check_apache_stat(Socket_T s)
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:"
# Line 310  static int check_apache_stat(Socket_T s) Line 300  static int check_apache_stat(Socket_T s)
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:"
# Line 320  static int check_apache_stat(Socket_T s) Line 309  static int check_apache_stat(Socket_T s)
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  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26