/[monit]/monit/http/cervlet.c
ViewVC logotype

Diff of /monit/http/cervlet.c

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

revision 1.196 by martinp, Sat Nov 5 14:09:02 2005 UTC revision 1.197 by martinp, Fri Nov 11 12:50:13 2005 UTC
# Line 126  static void print_service_params_match(H Line 126  static void print_service_params_match(H
126  static void print_service_params_checksum(HttpResponse, Service_T);  static void print_service_params_checksum(HttpResponse, Service_T);
127  static void print_service_params_process(HttpResponse, Service_T);  static void print_service_params_process(HttpResponse, Service_T);
128  static void print_status(HttpRequest, HttpResponse);  static void print_status(HttpRequest, HttpResponse);
 static void status_system_txt(HttpResponse, short);  
129  static void status_service_txt(Service_T, HttpResponse, short);  static void status_service_txt(Service_T, HttpResponse, short);
130  static char *get_service_status_html(Service_T);  static char *get_service_status_html(Service_T);
131  static char *get_service_status_text(Service_T);  static char *get_service_status_text(Service_T);
# Line 2244  static void print_status(HttpRequest req Line 2243  static void print_status(HttpRequest req
2243      out_print(res, "The monit daemon %s uptime: %s\n\n", VERSION, uptime);      out_print(res, "The monit daemon %s uptime: %s\n\n", VERSION, uptime);
2244      FREE(uptime);      FREE(uptime);
2245    
     if(Run.doprocess)  
     {  
       status_system_txt(res, level);  
     }  
2246      for(s= servicelist_conf; s; s= s->next_conf)      for(s= servicelist_conf; s; s= s->next_conf)
2247      {      {
2248        status_service_txt(s, res, level);        status_service_txt(s, res, level);
# Line 2257  static void print_status(HttpRequest req Line 2252  static void print_status(HttpRequest req
2252  }  }
2253    
2254    
 static void status_system_txt(HttpResponse res, short level) {  
   char time[STRLEN];  
   
   if(level == LEVEL_SUMMARY)  
   {  
     char prefix[STRLEN];  
   
     snprintf(prefix, STRLEN, "System '%s'", Run.localhostname);  
     out_print(res, "%-35s [%.2f] [%.2f] [%.2f]\n",  
       prefix,  
       systeminfo.loadavg[0],  
       systeminfo.loadavg[1],  
       systeminfo.loadavg[2]);  
   }  
   else  
   {  
     ctime_r(&systeminfo.collected, time);  
     out_print(res,  
       "System '%s'\n"  
       "  %-33s [%.2f] [%.2f] [%.2f]\n"  
       "  %-33s %.1f%%us %.1f%%sy"  
     #ifdef HAVE_CPU_WAIT  
       " %.1f%%wa"  
     #endif  
       "\n"  
       "  %-33s %ld kB [%.1f%%]\n"  
       "  %-33s %s\n",  
       Run.localhostname,  
       "load average",  
       systeminfo.loadavg[0],  
       systeminfo.loadavg[1],  
       systeminfo.loadavg[2],  
       "cpu",  
       systeminfo.total_cpu_user_percent/10.,  
       systeminfo.total_cpu_syst_percent/10.,  
     #ifdef HAVE_CPU_WAIT  
       systeminfo.total_cpu_wait_percent/10.,  
     #endif  
       "memory usage",  
       systeminfo.total_mem_kbyte,  
       systeminfo.total_mem_percent/10.,  
       "data collected",  
       time);  
   }  
   
 }  
   
   
2255  static void status_service_txt(Service_T s, HttpResponse res, short level) {  static void status_service_txt(Service_T s, HttpResponse res, short level) {
2256    char *status = get_service_status_text(s);    char *status = get_service_status_text(s);
2257    
# Line 2446  static void status_service_txt(Service_T Line 2393  static void status_service_txt(Service_T
2393          }          }
2394          }          }
2395        }        }
2396          if(s->type == TYPE_SYSTEM) {
2397            out_print(res,
2398              "  %-33s [%.2f] [%.2f] [%.2f]\n"
2399              "  %-33s %.1f%%us %.1f%%sy"
2400            #ifdef HAVE_CPU_WAIT
2401              " %.1f%%wa"
2402            #endif
2403              "\n"
2404              "  %-33s %ld kB [%.1f%%]\n",
2405              "load average",
2406              systeminfo.loadavg[0],
2407              systeminfo.loadavg[1],
2408              systeminfo.loadavg[2],
2409              "cpu",
2410              systeminfo.total_cpu_user_percent/10.,
2411              systeminfo.total_cpu_syst_percent/10.,
2412            #ifdef HAVE_CPU_WAIT
2413              systeminfo.total_cpu_wait_percent/10.,
2414            #endif
2415              "memory usage",
2416              systeminfo.total_mem_kbyte,
2417              systeminfo.total_mem_percent/10.);
2418          }
2419      }      }
2420      ctime_r(&s->collected, time);      ctime_r(&s->collected, time);
2421      out_print(res, "  %-33s %s\n", "data collected", time);      out_print(res, "  %-33s %s\n", "data collected", time);

Legend:
Removed from v.1.196  
changed lines
  Added in v.1.197

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