![]() |
Icinga-core 1.4.0
next gen monitoring
|
00001 /*********************************************************************** 00002 * 00003 * TAC.C - Icinga Tactical Monitoring Overview CGI 00004 * 00005 * Copyright (c) 2001-2008 Ethan Galstad (egalstad@nagios.org) 00006 * Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org) 00007 * 00008 * This CGI program will display the contents of the Icinga 00009 * log file. 00010 * 00011 * License: 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License version 2 as 00015 * published by the Free Software Foundation. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 ***********************************************************************/ 00026 00027 #include "../include/config.h" 00028 #include "../include/common.h" 00029 #include "../include/objects.h" 00030 #include "../include/statusdata.h" 00031 00032 #include "../include/getcgi.h" 00033 #include "../include/cgiutils.h" 00034 #include "../include/cgiauth.h" 00035 00036 00037 #define HEALTH_WARNING_PERCENTAGE 90 00038 #define HEALTH_CRITICAL_PERCENTAGE 75 00039 00040 00041 /* HOSTOUTAGE structure */ 00042 typedef struct hostoutage_struct{ 00043 host *hst; 00044 int affected_child_hosts; 00045 struct hostoutage_struct *next; 00046 }hostoutage; 00047 00048 00049 extern char main_config_file[MAX_FILENAME_LENGTH]; 00050 extern char url_html_path[MAX_FILENAME_LENGTH]; 00051 extern char url_images_path[MAX_FILENAME_LENGTH]; 00052 extern char url_stylesheets_path[MAX_FILENAME_LENGTH]; 00053 extern char url_js_path[MAX_FILENAME_LENGTH]; 00054 extern char url_media_path[MAX_FILENAME_LENGTH]; 00055 00056 extern char *service_critical_sound; 00057 extern char *service_warning_sound; 00058 extern char *service_unknown_sound; 00059 extern char *host_down_sound; 00060 extern char *host_unreachable_sound; 00061 extern char *normal_sound; 00062 00063 extern host *host_list; 00064 extern hostgroup *hostgroup_list; 00065 extern hoststatus *hoststatus_list; 00066 extern servicestatus *servicestatus_list; 00067 00068 extern int enable_notifications; 00069 extern int execute_service_checks; 00070 extern int execute_host_checks; 00071 extern int accept_passive_service_checks; 00072 extern int accept_passive_host_checks; 00073 extern int enable_event_handlers; 00074 extern int enable_flap_detection; 00075 00076 extern int nagios_process_state; 00077 00078 extern int tac_show_only_hard_state; 00079 extern int show_tac_header; 00080 00081 00082 void analyze_status_data(void); 00083 void display_tac_overview(void); 00084 00085 void find_hosts_causing_outages(void); 00086 void calculate_outage_effect_of_host(host *,int *); 00087 int is_route_to_host_blocked(host *); 00088 int number_of_host_services(host *); 00089 void add_hostoutage(host *); 00090 void free_hostoutage_list(void); 00091 00092 int process_cgivars(void); 00093 00094 authdata current_authdata; 00095 00096 extern int embedded; 00097 extern int refresh; 00098 extern int display_header; 00099 extern int daemon_check; 00100 extern int tac_header; 00101 extern int content_type; 00102 00103 hostoutage *hostoutage_list=NULL; 00104 00105 int total_blocking_outages=0; 00106 int total_nonblocking_outages=0; 00107 00108 int total_service_health=0; 00109 int total_host_health=0; 00110 int potential_service_health=0; 00111 int potential_host_health=0; 00112 double percent_service_health=0.0; 00113 double percent_host_health=0.0; 00114 00115 int total_hosts=0; 00116 int total_services=0; 00117 00118 int total_active_service_checks=0; 00119 int total_active_host_checks=0; 00120 int total_passive_service_checks=0; 00121 int total_passive_host_checks=0; 00122 00123 double min_service_execution_time=-1.0; 00124 double max_service_execution_time=-1.0; 00125 double total_service_execution_time=0.0; 00126 double average_service_execution_time=-1.0; 00127 double min_host_execution_time=-1.0; 00128 double max_host_execution_time=-1.0; 00129 double total_host_execution_time=0.0; 00130 double average_host_execution_time=-1.0; 00131 double min_service_latency=-1.0; 00132 double max_service_latency=-1.0; 00133 double total_service_latency=0.0; 00134 double average_service_latency=-1.0; 00135 double min_host_latency=-1.0; 00136 double max_host_latency=-1.0; 00137 double total_host_latency=0.0; 00138 double average_host_latency=-1.0; 00139 00140 int flapping_services=0; 00141 int flapping_hosts=0; 00142 int flap_disabled_services=0; 00143 int flap_disabled_hosts=0; 00144 int notification_disabled_services=0; 00145 int notification_disabled_hosts=0; 00146 int event_handler_disabled_services=0; 00147 int event_handler_disabled_hosts=0; 00148 int active_checks_disabled_services=0; 00149 int active_checks_disabled_hosts=0; 00150 int passive_checks_disabled_services=0; 00151 int passive_checks_disabled_hosts=0; 00152 00153 int hosts_pending=0; 00154 int hosts_pending_disabled=0; 00155 int hosts_up_disabled=0; 00156 int hosts_up_unacknowledged=0; 00157 int hosts_up=0; 00158 int hosts_down_scheduled=0; 00159 int hosts_down_acknowledged=0; 00160 int hosts_down_disabled=0; 00161 int hosts_down_unacknowledged=0; 00162 int hosts_down=0; 00163 int hosts_unreachable_scheduled=0; 00164 int hosts_unreachable_acknowledged=0; 00165 int hosts_unreachable_disabled=0; 00166 int hosts_unreachable_unacknowledged=0; 00167 int hosts_unreachable=0; 00168 00169 int services_pending=0; 00170 int services_pending_disabled=0; 00171 int services_ok_disabled=0; 00172 int services_ok_unacknowledged=0; 00173 int services_ok=0; 00174 int services_warning_host_problem=0; 00175 int services_warning_scheduled=0; 00176 int services_warning_acknowledged=0; 00177 int services_warning_disabled=0; 00178 int services_warning_unacknowledged=0; 00179 int services_warning=0; 00180 int services_unknown_host_problem=0; 00181 int services_unknown_scheduled=0; 00182 int services_unknown_acknowledged=0; 00183 int services_unknown_disabled=0; 00184 int services_unknown_unacknowledged=0; 00185 int services_unknown=0; 00186 int services_critical_host_problem=0; 00187 int services_critical_scheduled=0; 00188 int services_critical_acknowledged=0; 00189 int services_critical_disabled=0; 00190 int services_critical_unacknowledged=0; 00191 int services_critical=0; 00192 00193 int display_type=DISPLAY_HOSTS; 00194 int show_all_hosts=TRUE; 00195 int show_all_hostgroups=TRUE; 00196 int show_all_servicegroups=TRUE; 00197 00198 char *host_name=NULL; 00199 char *host_filter=NULL; 00200 char *hostgroup_name=NULL; 00201 char *servicegroup_name=NULL; 00202 char *service_desc=NULL; 00203 char *service_filter=NULL; 00204 00205 int CGI_ID=TAC_CGI_ID; 00206 00207 /*efine DEBUG 1*/ 00208 00209 int main(void){ 00210 int result=OK; 00211 char *sound=NULL; 00212 #ifdef DEBUG 00213 time_t t1,t2,t3,t4,t5,t6,t7,t8,t9; 00214 #endif 00215 00216 00217 #ifdef DEBUG 00218 time(&t1); 00219 #endif 00220 00221 /* get the CGI variables passed in the URL */ 00222 process_cgivars(); 00223 00224 /* reset internal variables */ 00225 reset_cgi_vars(); 00226 00227 /* read the CGI configuration file */ 00228 result=read_cgi_config_file(get_cgi_config_location()); 00229 if(result==ERROR){ 00230 document_header(CGI_ID,FALSE); 00231 print_error(get_cgi_config_location(), ERROR_CGI_CFG_FILE); 00232 document_footer(CGI_ID); 00233 return ERROR; 00234 } 00235 00236 #ifdef DEBUG 00237 time(&t2); 00238 #endif 00239 00240 /* read the main configuration file */ 00241 result=read_main_config_file(main_config_file); 00242 if(result==ERROR){ 00243 document_header(CGI_ID,FALSE); 00244 print_error(main_config_file, ERROR_CGI_MAIN_CFG); 00245 document_footer(CGI_ID); 00246 return ERROR; 00247 } 00248 00249 #ifdef DEBUG 00250 time(&t3); 00251 #endif 00252 00253 /* read all object configuration data */ 00254 result=read_all_object_configuration_data(main_config_file,READ_ALL_OBJECT_DATA); 00255 if(result==ERROR){ 00256 document_header(CGI_ID,FALSE); 00257 print_error(NULL, ERROR_CGI_OBJECT_DATA); 00258 document_footer(CGI_ID); 00259 return ERROR; 00260 } 00261 00262 #ifdef DEBUG 00263 time(&t4); 00264 #endif 00265 00266 /* read all status data */ 00267 result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); 00268 if(result==ERROR && daemon_check==TRUE){ 00269 document_header(CGI_ID,FALSE); 00270 print_error(NULL, ERROR_CGI_STATUS_DATA); 00271 document_footer(CGI_ID); 00272 free_memory(); 00273 return ERROR; 00274 } 00275 00276 #ifdef DEBUG 00277 time(&t5); 00278 #endif 00279 00280 document_header(CGI_ID,TRUE); 00281 00282 /* get authentication information */ 00283 get_authentication_information(¤t_authdata); 00284 00285 #ifdef DEBUG 00286 time(&t6); 00287 #endif 00288 00289 /* analyze current host and service status data for tac overview */ 00290 analyze_status_data(); 00291 00292 #ifdef DEBUG 00293 time(&t7); 00294 #endif 00295 00296 /* find all hosts that are causing network outages */ 00297 find_hosts_causing_outages(); 00298 00299 00300 #ifdef DEBUG 00301 time(&t8); 00302 #endif 00303 00304 /* embed sound tag if necessary... */ 00305 if(hosts_unreachable_unacknowledged > 0 && host_unreachable_sound!=NULL) 00306 sound=host_unreachable_sound; 00307 else if(hosts_down_unacknowledged > 0 && host_down_sound!=NULL) 00308 sound=host_down_sound; 00309 else if(services_critical_unacknowledged > 0 && service_critical_sound!=NULL) 00310 sound=service_critical_sound; 00311 else if(services_warning_unacknowledged > 0 && service_warning_sound!=NULL) 00312 sound=service_warning_sound; 00313 else if(services_unknown_unacknowledged==0 && services_warning_unacknowledged==0 && services_critical_unacknowledged==0 && hosts_down_unacknowledged==0 && hosts_unreachable_unacknowledged==0 && normal_sound!=NULL) 00314 sound=normal_sound; 00315 if(sound!=NULL && content_type!=JSON_CONTENT){ 00316 printf("<object type=\"audio/x-wav\" data=\"%s%s\" height=\"-\" width=\"0\">",url_media_path,sound); 00317 printf("<param name=\"filename\" value=\"%s%s\">",url_media_path,sound); 00318 printf("<param name=\"autostart\" value=\"true\">"); 00319 printf("<param name=\"playcount\" value=\"1\">"); 00320 printf("</object>"); 00321 } 00322 00323 00324 /**** display main tac screen ****/ 00325 display_tac_overview(); 00326 00327 #ifdef DEBUG 00328 time(&t9); 00329 #endif 00330 00331 document_footer(CGI_ID); 00332 00333 /* free memory allocated to the host outage list */ 00334 free_hostoutage_list(); 00335 00336 /* free allocated memory */ 00337 free_memory(); 00338 00339 #ifdef DEBUG 00340 printf("T1: %lu\n",(unsigned long)t1); 00341 printf("T2: %lu\n",(unsigned long)t2); 00342 printf("T3: %lu\n",(unsigned long)t3); 00343 printf("T4: %lu\n",(unsigned long)t4); 00344 printf("T5: %lu\n",(unsigned long)t5); 00345 printf("T6: %lu\n",(unsigned long)t6); 00346 printf("T7: %lu\n",(unsigned long)t7); 00347 printf("T8: %lu\n",(unsigned long)t8); 00348 printf("T9: %lu\n",(unsigned long)t9); 00349 #endif 00350 00351 return OK; 00352 } 00353 00354 int process_cgivars(void){ 00355 char **variables; 00356 int error=FALSE; 00357 int x; 00358 00359 variables=getcgivars(); 00360 00361 for(x=0;variables[x]!=NULL;x++){ 00362 00363 /* do some basic length checking on the variable identifier to prevent buffer overflows */ 00364 if(strlen(variables[x])>=MAX_INPUT_BUFFER-1) 00365 continue; 00366 00367 /* we found the embed option */ 00368 else if(!strcmp(variables[x],"embedded")) 00369 embedded=TRUE; 00370 00371 /* we found the noheader option */ 00372 else if(!strcmp(variables[x],"noheader")) 00373 display_header=FALSE; 00374 00375 /* we found the pause option */ 00376 else if(!strcmp(variables[x],"paused")) 00377 refresh=FALSE; 00378 00379 /* we found the nodaemoncheck option */ 00380 else if(!strcmp(variables[x],"nodaemoncheck")) 00381 daemon_check=FALSE; 00382 00383 /* we found the tac_header option */ 00384 else if(!strcmp(variables[x],"tac_header")){ 00385 tac_header=TRUE; 00386 embedded=TRUE; 00387 } 00388 00389 /* we found the JSON output option */ 00390 else if(!strcmp(variables[x],"jsonoutput")){ 00391 display_header=FALSE; 00392 content_type=JSON_CONTENT; 00393 } 00394 00395 /* we received an invalid argument */ 00396 else 00397 error=TRUE; 00398 00399 } 00400 00401 /* free memory allocated to the CGI variables */ 00402 free_cgivars(variables); 00403 00404 return error; 00405 } 00406 00407 00408 00409 void analyze_status_data(void){ 00410 servicestatus *temp_servicestatus; 00411 service *temp_service; 00412 hoststatus *temp_hoststatus; 00413 host *temp_host; 00414 int problem=TRUE; 00415 00416 00417 /* check all services */ 00418 for(temp_servicestatus=servicestatus_list;temp_servicestatus!=NULL;temp_servicestatus=temp_servicestatus->next){ 00419 00420 /* see if user is authorized to view this service */ 00421 temp_service=find_service(temp_servicestatus->host_name,temp_servicestatus->description); 00422 if(is_authorized_for_service(temp_service,¤t_authdata)==FALSE) 00423 continue; 00424 00425 /* check if only hard states to be shown */ 00426 if(tac_show_only_hard_state==TRUE && temp_servicestatus->state_type!=HARD_STATE) 00427 continue; 00428 00429 00430 /******** CHECK FEATURES *******/ 00431 00432 /* check flapping */ 00433 if(temp_servicestatus->flap_detection_enabled==FALSE) 00434 flap_disabled_services++; 00435 else if(temp_servicestatus->is_flapping==TRUE) 00436 flapping_services++; 00437 00438 /* check notifications */ 00439 if(temp_servicestatus->notifications_enabled==FALSE) 00440 notification_disabled_services++; 00441 00442 /* check event handler */ 00443 if(temp_servicestatus->event_handler_enabled==FALSE) 00444 event_handler_disabled_services++; 00445 00446 /* active check execution */ 00447 if(temp_servicestatus->checks_enabled==FALSE) 00448 active_checks_disabled_services++; 00449 00450 /* passive check acceptance */ 00451 if(temp_servicestatus->accept_passive_service_checks==FALSE) 00452 passive_checks_disabled_services++; 00453 00454 00455 /********* CHECK STATUS ********/ 00456 00457 problem=TRUE; 00458 00459 if(temp_servicestatus->status==SERVICE_OK){ 00460 if(temp_servicestatus->checks_enabled==FALSE) 00461 services_ok_disabled++; 00462 else 00463 services_ok_unacknowledged++; 00464 services_ok++; 00465 } 00466 00467 else if(temp_servicestatus->status==SERVICE_WARNING){ 00468 temp_hoststatus=find_hoststatus(temp_servicestatus->host_name); 00469 if(temp_hoststatus!=NULL && (temp_hoststatus->status==HOST_DOWN || temp_hoststatus->status==HOST_UNREACHABLE)){ 00470 services_warning_host_problem++; 00471 problem=FALSE; 00472 } 00473 if(temp_servicestatus->scheduled_downtime_depth>0){ 00474 services_warning_scheduled++; 00475 problem=FALSE; 00476 } 00477 if(temp_servicestatus->problem_has_been_acknowledged==TRUE){ 00478 services_warning_acknowledged++; 00479 problem=FALSE; 00480 } 00481 if(temp_servicestatus->checks_enabled==FALSE){ 00482 services_warning_disabled++; 00483 problem=FALSE; 00484 } 00485 if(problem==TRUE) 00486 services_warning_unacknowledged++; 00487 services_warning++; 00488 } 00489 00490 else if(temp_servicestatus->status==SERVICE_UNKNOWN){ 00491 temp_hoststatus=find_hoststatus(temp_servicestatus->host_name); 00492 if(temp_hoststatus!=NULL && (temp_hoststatus->status==HOST_DOWN || temp_hoststatus->status==HOST_UNREACHABLE)){ 00493 services_unknown_host_problem++; 00494 problem=FALSE; 00495 } 00496 if(temp_servicestatus->scheduled_downtime_depth>0){ 00497 services_unknown_scheduled++; 00498 problem=FALSE; 00499 } 00500 if(temp_servicestatus->problem_has_been_acknowledged==TRUE){ 00501 services_unknown_acknowledged++; 00502 problem=FALSE; 00503 } 00504 if(temp_servicestatus->checks_enabled==FALSE){ 00505 services_unknown_disabled++; 00506 problem=FALSE; 00507 } 00508 if(problem==TRUE) 00509 services_unknown_unacknowledged++; 00510 services_unknown++; 00511 } 00512 00513 else if(temp_servicestatus->status==SERVICE_CRITICAL){ 00514 temp_hoststatus=find_hoststatus(temp_servicestatus->host_name); 00515 if(temp_hoststatus!=NULL && (temp_hoststatus->status==HOST_DOWN || temp_hoststatus->status==HOST_UNREACHABLE)){ 00516 services_critical_host_problem++; 00517 problem=FALSE; 00518 } 00519 if(temp_servicestatus->scheduled_downtime_depth>0){ 00520 services_critical_scheduled++; 00521 problem=FALSE; 00522 } 00523 if(temp_servicestatus->problem_has_been_acknowledged==TRUE){ 00524 services_critical_acknowledged++; 00525 problem=FALSE; 00526 } 00527 if(temp_servicestatus->checks_enabled==FALSE){ 00528 services_critical_disabled++; 00529 problem=FALSE; 00530 } 00531 if(problem==TRUE) 00532 services_critical_unacknowledged++; 00533 services_critical++; 00534 } 00535 00536 else if(temp_servicestatus->status==SERVICE_PENDING){ 00537 if(temp_servicestatus->checks_enabled==FALSE) 00538 services_pending_disabled++; 00539 services_pending++; 00540 } 00541 00542 00543 /* get health stats */ 00544 if(temp_servicestatus->status==SERVICE_OK) 00545 total_service_health+=2; 00546 00547 else if(temp_servicestatus->status==SERVICE_WARNING || temp_servicestatus->status==SERVICE_UNKNOWN) 00548 total_service_health++; 00549 00550 if(temp_servicestatus->status!=SERVICE_PENDING) 00551 potential_service_health+=2; 00552 00553 00554 /* calculate execution time and latency stats */ 00555 if(temp_servicestatus->check_type==SERVICE_CHECK_ACTIVE){ 00556 00557 total_active_service_checks++; 00558 00559 if(min_service_latency==-1.0 || temp_servicestatus->latency<min_service_latency) 00560 min_service_latency=temp_servicestatus->latency; 00561 if(max_service_latency==-1.0 || temp_servicestatus->latency>max_service_latency) 00562 max_service_latency=temp_servicestatus->latency; 00563 00564 if(min_service_execution_time==-1.0 || temp_servicestatus->execution_time<min_service_execution_time) 00565 min_service_execution_time=temp_servicestatus->execution_time; 00566 if(max_service_execution_time==-1.0 || temp_servicestatus->execution_time>max_service_execution_time) 00567 max_service_execution_time=temp_servicestatus->execution_time; 00568 00569 total_service_latency+=temp_servicestatus->latency; 00570 total_service_execution_time+=temp_servicestatus->execution_time; 00571 } 00572 else 00573 total_passive_service_checks++; 00574 00575 00576 total_services++; 00577 } 00578 00579 00580 00581 /* check all hosts */ 00582 for(temp_hoststatus=hoststatus_list;temp_hoststatus!=NULL;temp_hoststatus=temp_hoststatus->next){ 00583 00584 /* see if user is authorized to view this host */ 00585 temp_host=find_host(temp_hoststatus->host_name); 00586 if(is_authorized_for_host(temp_host,¤t_authdata)==FALSE) 00587 continue; 00588 00589 /* check if only hard states to be shown */ 00590 if(tac_show_only_hard_state==TRUE && temp_hoststatus->state_type!=HARD_STATE) 00591 continue; 00592 00593 /******** CHECK FEATURES *******/ 00594 00595 /* check flapping */ 00596 if(temp_hoststatus->flap_detection_enabled==FALSE) 00597 flap_disabled_hosts++; 00598 else if(temp_hoststatus->is_flapping==TRUE) 00599 flapping_hosts++; 00600 00601 /* check notifications */ 00602 if(temp_hoststatus->notifications_enabled==FALSE) 00603 notification_disabled_hosts++; 00604 00605 /* check event handler */ 00606 if(temp_hoststatus->event_handler_enabled==FALSE) 00607 event_handler_disabled_hosts++; 00608 00609 /* active check execution */ 00610 if(temp_hoststatus->checks_enabled==FALSE) 00611 active_checks_disabled_hosts++; 00612 00613 /* passive check acceptance */ 00614 if(temp_hoststatus->accept_passive_host_checks==FALSE) 00615 passive_checks_disabled_hosts++; 00616 00617 00618 /********* CHECK STATUS ********/ 00619 00620 problem=TRUE; 00621 00622 if(temp_hoststatus->status==HOST_UP){ 00623 if(temp_hoststatus->checks_enabled==FALSE) 00624 hosts_up_disabled++; 00625 else 00626 hosts_up_unacknowledged++; 00627 hosts_up++; 00628 } 00629 00630 else if(temp_hoststatus->status==HOST_DOWN){ 00631 if(temp_hoststatus->scheduled_downtime_depth>0){ 00632 hosts_down_scheduled++; 00633 problem=FALSE; 00634 } 00635 if(temp_hoststatus->problem_has_been_acknowledged==TRUE){ 00636 hosts_down_acknowledged++; 00637 problem=FALSE; 00638 } 00639 if(temp_hoststatus->checks_enabled==FALSE){ 00640 hosts_down_disabled++; 00641 problem=FALSE; 00642 } 00643 if(problem==TRUE) 00644 hosts_down_unacknowledged++; 00645 hosts_down++; 00646 } 00647 00648 else if(temp_hoststatus->status==HOST_UNREACHABLE){ 00649 if(temp_hoststatus->scheduled_downtime_depth>0){ 00650 hosts_unreachable_scheduled++; 00651 problem=FALSE; 00652 } 00653 if(temp_hoststatus->problem_has_been_acknowledged==TRUE){ 00654 hosts_unreachable_acknowledged++; 00655 problem=FALSE; 00656 } 00657 if(temp_hoststatus->checks_enabled==FALSE){ 00658 hosts_unreachable_disabled++; 00659 problem=FALSE; 00660 } 00661 if(problem==TRUE) 00662 hosts_unreachable_unacknowledged++; 00663 hosts_unreachable++; 00664 } 00665 00666 else if(temp_hoststatus->status==HOST_PENDING){ 00667 if(temp_hoststatus->checks_enabled==FALSE) 00668 hosts_pending_disabled++; 00669 hosts_pending++; 00670 } 00671 00672 /* get health stats */ 00673 if(temp_hoststatus->status==HOST_UP) 00674 total_host_health++; 00675 00676 if(temp_hoststatus->status!=HOST_PENDING) 00677 potential_host_health++; 00678 00679 /* check type stats */ 00680 if(temp_hoststatus->check_type==HOST_CHECK_ACTIVE){ 00681 00682 total_active_host_checks++; 00683 00684 if(min_host_latency==-1.0 || temp_hoststatus->latency<min_host_latency) 00685 min_host_latency=temp_hoststatus->latency; 00686 if(max_host_latency==-1.0 || temp_hoststatus->latency>max_host_latency) 00687 max_host_latency=temp_hoststatus->latency; 00688 00689 if(min_host_execution_time==-1.0 || temp_hoststatus->execution_time<min_host_execution_time) 00690 min_host_execution_time=temp_hoststatus->execution_time; 00691 if(max_host_execution_time==-1.0 || temp_hoststatus->execution_time>max_host_execution_time) 00692 max_host_execution_time=temp_hoststatus->execution_time; 00693 00694 total_host_latency+=temp_hoststatus->latency; 00695 total_host_execution_time+=temp_hoststatus->execution_time; 00696 } 00697 else 00698 total_passive_host_checks++; 00699 00700 total_hosts++; 00701 } 00702 00703 00704 /* calculate service health */ 00705 if(potential_service_health==0) 00706 percent_service_health=0.0; 00707 else 00708 percent_service_health=((double)total_service_health/(double)potential_service_health)*100.0; 00709 00710 /* calculate host health */ 00711 if(potential_host_health==0) 00712 percent_host_health=0.0; 00713 else 00714 percent_host_health=((double)total_host_health/(double)potential_host_health)*100.0; 00715 00716 /* calculate service latency */ 00717 if(total_service_latency==0L) 00718 average_service_latency=0.0; 00719 else 00720 average_service_latency=((double)total_service_latency/(double)total_active_service_checks); 00721 00722 /* calculate host latency */ 00723 if(total_host_latency==0L) 00724 average_host_latency=0.0; 00725 else 00726 average_host_latency=((double)total_host_latency/(double)total_active_host_checks); 00727 00728 /* calculate service execution time */ 00729 if(total_service_execution_time==0.0) 00730 average_service_execution_time=0.0; 00731 else 00732 average_service_execution_time=((double)total_service_execution_time/(double)total_active_service_checks); 00733 00734 /* calculate host execution time */ 00735 if(total_host_execution_time==0.0) 00736 average_host_execution_time=0.0; 00737 else 00738 average_host_execution_time=((double)total_host_execution_time/(double)total_active_host_checks); 00739 00740 return; 00741 } 00742 00743 00744 00745 00746 /* determine what hosts are causing network outages */ 00747 void find_hosts_causing_outages(void){ 00748 hoststatus *temp_hoststatus; 00749 hostoutage *temp_hostoutage; 00750 host *temp_host; 00751 00752 /* check all hosts */ 00753 for(temp_hoststatus=hoststatus_list;temp_hoststatus!=NULL;temp_hoststatus=temp_hoststatus->next){ 00754 00755 /* check only hosts that are not up and not pending */ 00756 if(temp_hoststatus->status!=HOST_UP && temp_hoststatus->status!=HOST_PENDING){ 00757 00758 /* find the host entry */ 00759 temp_host=find_host(temp_hoststatus->host_name); 00760 00761 if(temp_host==NULL) 00762 continue; 00763 00764 if (is_authorized_for_host(temp_host,¤t_authdata)==FALSE) 00765 continue; 00766 00767 /* if the route to this host is not blocked, it is a causing an outage */ 00768 if(is_route_to_host_blocked(temp_host)==FALSE) 00769 add_hostoutage(temp_host); 00770 } 00771 } 00772 00773 00774 /* check all hosts that are causing problems and calculate the extent of the problem */ 00775 for(temp_hostoutage=hostoutage_list;temp_hostoutage!=NULL;temp_hostoutage=temp_hostoutage->next){ 00776 00777 /* calculate the outage effect of this particular hosts */ 00778 calculate_outage_effect_of_host(temp_hostoutage->hst,&temp_hostoutage->affected_child_hosts); 00779 00780 if(temp_hostoutage->affected_child_hosts>1) 00781 total_blocking_outages++; 00782 else 00783 total_nonblocking_outages++; 00784 } 00785 00786 return; 00787 } 00788 00789 00790 00791 00792 00793 /* adds a host outage entry */ 00794 void add_hostoutage(host *hst){ 00795 hostoutage *new_hostoutage; 00796 00797 /* allocate memory for a new structure */ 00798 new_hostoutage=(hostoutage *)malloc(sizeof(hostoutage)); 00799 00800 if(new_hostoutage==NULL) 00801 return; 00802 00803 new_hostoutage->hst=hst; 00804 new_hostoutage->affected_child_hosts=0; 00805 00806 /* add the structure to the head of the list in memory */ 00807 new_hostoutage->next=hostoutage_list; 00808 hostoutage_list=new_hostoutage; 00809 00810 return; 00811 } 00812 00813 00814 00815 00816 /* frees all memory allocated to the host outage list */ 00817 void free_hostoutage_list(void){ 00818 hostoutage *this_hostoutage; 00819 hostoutage *next_hostoutage; 00820 00821 for(this_hostoutage=hostoutage_list;this_hostoutage!=NULL;this_hostoutage=next_hostoutage){ 00822 next_hostoutage=this_hostoutage->next; 00823 free(this_hostoutage); 00824 } 00825 00826 return; 00827 } 00828 00829 00830 00831 /* calculates network outage effect of a particular host being down or unreachable */ 00832 void calculate_outage_effect_of_host(host *hst, int *affected_hosts){ 00833 int total_child_hosts_affected=0; 00834 int temp_child_hosts_affected=0; 00835 host *temp_host; 00836 00837 00838 /* find all child hosts of this host */ 00839 for(temp_host=host_list;temp_host!=NULL;temp_host=temp_host->next){ 00840 00841 /* skip this host if it is not a child */ 00842 if(is_host_immediate_child_of_host(hst,temp_host)==FALSE) 00843 continue; 00844 00845 /* calculate the outage effect of the child */ 00846 calculate_outage_effect_of_host(temp_host,&temp_child_hosts_affected); 00847 00848 /* keep a running total of outage effects */ 00849 total_child_hosts_affected+=temp_child_hosts_affected; 00850 } 00851 00852 *affected_hosts=total_child_hosts_affected+1; 00853 00854 return; 00855 } 00856 00857 00858 00859 /* tests whether or not a host is "blocked" by upstream parents (host is already assumed to be down or unreachable) */ 00860 int is_route_to_host_blocked(host *hst){ 00861 hostsmember *temp_hostsmember; 00862 hoststatus *temp_hoststatus; 00863 00864 /* if the host has no parents, it is not being blocked by anyone */ 00865 if(hst->parent_hosts==NULL) 00866 return FALSE; 00867 00868 /* check all parent hosts */ 00869 for(temp_hostsmember=hst->parent_hosts;temp_hostsmember!=NULL;temp_hostsmember=temp_hostsmember->next){ 00870 00871 /* find the parent host's status */ 00872 temp_hoststatus=find_hoststatus(temp_hostsmember->host_name); 00873 00874 if(temp_hoststatus==NULL) 00875 continue; 00876 00877 /* at least one parent it up (or pending), so this host is not blocked */ 00878 if(temp_hoststatus->status==HOST_UP || temp_hoststatus->status==HOST_PENDING) 00879 return FALSE; 00880 } 00881 00882 return TRUE; 00883 } 00884 00885 00886 void display_tac_overview(void){ 00887 char host_health_image[16]; 00888 char service_health_image[16]; 00889 00890 if(tac_header==TRUE && show_tac_header==FALSE){ // we want the top header, but not the tac version 00891 00892 printf(" <div id='banner' align='center'><img src='%s%s' alt='%s' /></div>",url_images_path,TAC_HEADER_DEFAULT_LOGO,TAC_HEADER_DEFAULT_LOGO_ALT); 00893 return; //we're done here 00894 00895 } else if(tac_header==TRUE && show_tac_header==TRUE){ // we want the tac header 00896 00897 printf("<table width='100%%' border='0'>\n"); 00898 printf("<tr>\n"); 00899 printf("<td width='auto'><table border='0'>\n"); 00900 printf("<tr>\n"); 00901 printf("<td nowrap='nowrap'><img src='%s%s' alt='Hosts' width='16' height='16' align='right' /></td>\n",url_images_path,TAC_HEADER_HOST_ICON); 00902 printf("<td><table width='92%%' border='0'>\n"); 00903 printf("<tr>\n"); 00904 printf("<td>\n"); 00905 printf("<div class='tacheader-overall-status-item'>\n"); 00906 00907 printf("<div class='tacheader-status %s'>",(hosts_up > 0)?"tacheader-status-up color":"gray"); 00908 00909 printf("<a target='main' href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d'> %d UP </a></div>\n",STATUS_CGI,HOST_UP,hosts_up); 00910 printf("</div>\n"); 00911 printf("</td>\n"); 00912 printf("<td width=auto>\n"); 00913 printf("<div class='tacheader-overall-status-item'>\n"); 00914 00915 printf("<div class='tacheader-status %s'>",(hosts_down_unacknowledged > 0)?"tacheader-status-down color":"gray"); 00916 00917 printf("<a target='main' href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'> %d DOWN </a></div>\n",STATUS_CGI,HOST_DOWN,HOST_NO_SCHEDULED_DOWNTIME|HOST_STATE_UNACKNOWLEDGED|HOST_CHECKS_ENABLED,hosts_down_unacknowledged); 00918 printf("</div>\n"); 00919 printf("</td>\n"); 00920 printf("<td>\n"); 00921 printf("<div class='tacheader-overall-status-item'>\n"); 00922 00923 printf("<div class='tacheader-status %s'>",(hosts_unreachable_unacknowledged > 0)?"tacheader-status-unreachable color":"gray"); 00924 00925 printf("<a target='main' href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'> %d UNREACHABLE </a></div>\n",STATUS_CGI,HOST_UNREACHABLE,HOST_NO_SCHEDULED_DOWNTIME|HOST_STATE_UNACKNOWLEDGED|HOST_CHECKS_ENABLED,hosts_unreachable_unacknowledged); 00926 printf("</div>\n"); 00927 printf("</td>\n"); 00928 printf("<td>\n"); 00929 printf("<div class='tacheader-overall-status-item'>\n"); 00930 printf("<div class='tacheader-status gray'>"); 00931 printf("<a target='main' href='%s?hostgroup=all&style=hostdetail'> %d IN TOTAL </a></div>\n",STATUS_CGI,total_hosts); 00932 printf("</div>\n"); 00933 printf("</td>\n"); 00934 printf("</tr>\n"); 00935 printf("</table></td>\n"); 00936 printf("</tr>\n"); 00937 printf("<tr>\n"); 00938 printf("<td><img src='%s%s' alt='Services' width='16' height='16' align='right' /></td>\n",url_images_path,TAC_HEADER_SERVICE_ICON); 00939 printf("<td nowrap='nowrap'><table width=auto border='0'>\n"); 00940 printf("<tr>\n"); 00941 printf("<td>\n"); 00942 printf("<div class='tacheader-overall-status-item'>\n"); 00943 00944 printf("<div class='tacheader-status %s'>",(services_ok > 0)?"tacheader-status-ok color":"gray"); 00945 00946 printf("<a target='main' href='%s?host=all&style=detail&servicestatustypes=%d'> %d OK </a></div>\n",STATUS_CGI,SERVICE_OK,services_ok); 00947 printf("</div>\n"); 00948 printf("</td>\n"); 00949 printf("<td>\n"); 00950 printf("<div class='tacheader-overall-status-item'>\n"); 00951 00952 printf("<div class='tacheader-status %s'>",(services_warning_unacknowledged > 0)?"tacheader-status-warning color":"gray"); 00953 00954 printf("<a target='main' href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'> %d WARNING </a></div>\n",STATUS_CGI,SERVICE_WARNING,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_warning_unacknowledged); 00955 printf("</div>\n"); 00956 printf("</td>\n"); 00957 printf("<td>\n"); 00958 printf("<div class='tacheader-overall-status-item'>\n"); 00959 00960 printf("<div class='tacheader-status %s'>",(services_critical_unacknowledged > 0)?"tacheader-status-critical color":"gray"); 00961 00962 printf("<a target='main' href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'> %d CRITICAL </a></div>\n",STATUS_CGI,SERVICE_CRITICAL,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_critical_unacknowledged); 00963 printf("</div>\n"); 00964 printf("</td>\n"); 00965 printf("<td>\n"); 00966 printf("<div class='tacheader-overall-status-item'>\n"); 00967 00968 printf("<div class='tacheader-status %s'>",(services_unknown_unacknowledged > 0)?"tacheader-status-unknown color":"gray"); 00969 00970 printf("<a target='main' href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'> %d UNKNOWN </a></div>\n",STATUS_CGI,SERVICE_UNKNOWN,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_unknown_unacknowledged); 00971 printf("</div>\n"); 00972 printf("</td>\n"); 00973 printf("<td>\n"); 00974 printf("<div class='tacheader-overall-status-item'>\n"); 00975 printf("<div class='tacheader-status gray'>"); 00976 printf("<a target='main' href='%s?host=all'> %d IN TOTAL </a></div>\n",STATUS_CGI,total_services); 00977 printf("</div>\n"); 00978 printf("</td>\n"); 00979 printf("</tr>\n"); 00980 printf("</table></td>\n"); 00981 printf("</tr>\n"); 00982 printf("</table></td>\n"); 00983 00984 /* Monitor Performance */ 00985 printf("<td width='460px' style='background-image: url(%s%s)'><table width='280px' border='0' align='right' class='tacheader-monitor-performance-container'>\n",url_images_path,TAC_HEADER_LOGO); 00986 printf("<tr>\n"); 00987 printf("<td><img src='%s%s' width='16' height='16' alt='Hosts (active/passive)' /></td>\n",url_images_path,TAC_HEADER_HOST_ICON); 00988 printf("<td>\n"); 00989 printf("<div class='tacheader-monitor'>"); 00990 printf("<a target='main' href='%s?hostgroup=all&hostprops=%d&style=hostdetail'>%d</a> / <a target='main' href='%s?hostgroup=all&hostprops=%d&style=hostdetail'>%d</a></div>\n",STATUS_CGI,HOST_ACTIVE_CHECK,total_active_host_checks,STATUS_CGI,HOST_PASSIVE_CHECK,total_passive_host_checks); 00991 printf("</td>\n"); 00992 printf("<td><img src='%s%s' width='16' height='16' alt='Services (active/passive)' /></td>\n",url_images_path,TAC_HEADER_SERVICE_ICON); 00993 printf("<td>\n"); 00994 printf("<div class='tacheader-monitor'>"); 00995 printf("<a target='main' href='%s?host=all&serviceprops=%d'>%d</a> / <a target='main' href='%s?host=all&serviceprops=%d'>%d</a></div>\n",STATUS_CGI,SERVICE_ACTIVE_CHECK,total_active_service_checks,STATUS_CGI,SERVICE_PASSIVE_CHECK,total_passive_service_checks); 00996 printf("</td>\n"); 00997 printf("</tr>\n"); 00998 printf("<tr>\n"); 00999 printf("<td><img src='%s%s' width='16' height='16' alt='Host Execution Time (min/avg/max)' /></td>\n",url_images_path,TAC_HEADER_EXECUTION_ICON); 01000 printf("<td nowrap='nowrap'>\n"); 01001 printf("<div class='tacheader-monitor'>"); 01002 printf("<a target='main' href='%s?type=%d'>%.2f / %.2f / %.3f s</a></div>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_host_execution_time,max_host_execution_time,average_host_execution_time); 01003 printf("</td>\n"); 01004 printf("<td><img src='%s%s' width='16' height='16' alt='Service Execution Time (min/avg/max)' /></td>\n",url_images_path,TAC_HEADER_EXECUTION_ICON); 01005 printf("<td nowrap='nowrap'>\n"); 01006 printf("<div class='tacheader-monitor'>"); 01007 printf("<a target='main' href='%s?type=%d'>%.2f / %.2f / %.3f s</a></div>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_service_execution_time,max_service_execution_time,average_service_execution_time); 01008 printf("</td>\n"); 01009 printf("</tr>\n"); 01010 printf("<tr>\n"); 01011 printf("<td><img src='%s%s' width='16' height='16' alt='Host Latency (min/avg/max)' /></td>\n",url_images_path,TAC_HEADER_LATENCY_ICON); 01012 printf("<td nowrap='nowrap'>\n"); 01013 printf("<div class='tacheader-monitor'>"); 01014 printf("<a target='main' href='%s?type=%d'>%.2f / %.2f / %.3f s</a></div>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_host_latency,max_host_latency,average_host_latency); 01015 printf("</td>\n"); 01016 printf("<td><img src='%s%s' width='16' height='16' alt='Service Latency (min/avg/max)' /></td>\n",url_images_path,TAC_HEADER_LATENCY_ICON); 01017 printf("<td nowrap='nowrap'>\n"); 01018 printf("<div class='tacheader-monitor'>"); 01019 printf("<a target='main' href='%s?type=%d'>%.2f / %.2f / %.3f s</a></div>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_service_latency,max_service_latency,average_service_latency); 01020 printf("</td>\n"); 01021 printf("</tr>\n"); 01022 printf("</table></td>\n"); 01023 printf("</tr>\n"); 01024 printf("</table>\n"); 01025 01026 return; //we're done here 01027 } 01028 01029 01030 if(content_type==JSON_CONTENT) { 01031 printf("\"tac_overview\": {\n"); 01032 01033 /* outages */ 01034 printf("\"network_outages\": %d,\n",total_blocking_outages); 01035 01036 /* network health */ 01037 printf("\"percent_host_health\": %2.1f,\n",percent_host_health); 01038 printf("\"percent_service_health\": %2.1f,\n",percent_service_health); 01039 01040 /* host data */ 01041 printf("\"hosts_down\": %d,\n",hosts_down); 01042 printf("\"hosts_down_unacknowledged\": %d,\n",hosts_down_unacknowledged); 01043 printf("\"hosts_down_scheduled\": %d,\n",hosts_down_scheduled); 01044 printf("\"hosts_unreachable_acknowledged\": %d,\n",hosts_unreachable_acknowledged); 01045 printf("\"hosts_down_disabled\": %d,\n",hosts_down_disabled); 01046 01047 printf("\"hosts_unreachable\": %d,\n",hosts_unreachable); 01048 printf("\"hosts_unreachable_unacknowledged\": %d,\n",hosts_unreachable_unacknowledged); 01049 printf("\"hosts_unreachable_scheduled\": %d,\n",hosts_unreachable_scheduled); 01050 printf("\"hosts_unreachable_acknowledged\": %d,\n",hosts_unreachable_acknowledged); 01051 printf("\"hosts_unreachable_disabled\": %d,\n",hosts_unreachable_disabled); 01052 01053 printf("\"hosts_up\": %d,\n",hosts_up); 01054 printf("\"hosts_up_disabled\": %d,\n",hosts_up_disabled); 01055 01056 printf("\"hosts_pending\": %d,\n",hosts_pending); 01057 printf("\"hosts_pending_disabled\": %d,\n",hosts_pending_disabled); 01058 01059 /* service data */ 01060 printf("\"services_critical\": %d,\n",services_critical); 01061 printf("\"services_critical_unacknowledged\": %d,\n",services_critical_unacknowledged); 01062 printf("\"services_critical_host_problem\": %d,\n",services_critical_host_problem); 01063 printf("\"services_critical_scheduled\": %d,\n",services_critical_scheduled); 01064 printf("\"services_critical_acknowledged\": %d,\n",services_critical_acknowledged); 01065 printf("\"services_critical_disabled\": %d,\n",services_critical_disabled); 01066 01067 printf("\"services_warning\": %d,\n",services_warning); 01068 printf("\"services_warning_unacknowledged\": %d,\n",services_warning_unacknowledged); 01069 printf("\"services_warning_host_problem\": %d,\n",services_warning_host_problem); 01070 printf("\"services_warning_scheduled\": %d,\n",services_warning_scheduled); 01071 printf("\"services_warning_acknowledged\": %d,\n",services_warning_acknowledged); 01072 printf("\"services_warning_disabled\": %d,\n",services_warning_disabled); 01073 01074 printf("\"services_unknown\": %d,\n",services_unknown); 01075 printf("\"services_unknown_unacknowledged\": %d,\n",services_unknown_unacknowledged); 01076 printf("\"services_unknown_host_problem\": %d,\n",services_unknown_host_problem); 01077 printf("\"services_unknown_scheduled\": %d,\n",services_unknown_scheduled); 01078 printf("\"services_unknown_acknowledged\": %d,\n",services_unknown_acknowledged); 01079 printf("\"services_unknown_disabled\": %d,\n",services_unknown_disabled); 01080 01081 printf("\"services_ok\": %d,\n",services_ok); 01082 printf("\"services_ok_disabled\": %d,\n",services_ok_disabled); 01083 01084 printf("\"services_pending\": %d,\n",services_pending); 01085 printf("\"services_pending_disabled\": %d,\n",services_pending_disabled); 01086 01087 /* monitoring features */ 01088 printf("\"flap_detection_enabled\": %s,\n",(enable_flap_detection==TRUE)?"true":"false"); 01089 printf("\"flap_disabled_services\": %d,\n",flap_disabled_services); 01090 printf("\"flapping_services\": %d,\n",flapping_services); 01091 printf("\"flap_disabled_hosts\": %d,\n",flap_disabled_hosts); 01092 printf("\"flapping_hosts\": %d,\n",flapping_hosts); 01093 01094 printf("\"notifications_enabled\": %s,\n",(enable_notifications==TRUE)?"true":"false"); 01095 printf("\"notification_disabled_services\": %d,\n",notification_disabled_services); 01096 printf("\"notification_disabled_hosts\": %d,\n",notification_disabled_hosts); 01097 01098 printf("\"event_handlers_enabled\": %s,\n",(enable_event_handlers==TRUE)?"true":"false"); 01099 printf("\"event_handler_disabled_services\": %d,\n",event_handler_disabled_services); 01100 printf("\"event_handler_disabled_hosts\": %d,\n",event_handler_disabled_hosts); 01101 01102 printf("\"execute_service_checks\": %s,\n",(execute_service_checks==TRUE)?"true":"false"); 01103 printf("\"execute_host_checks\": %s,\n",(execute_host_checks==TRUE)?"true":"false"); 01104 printf("\"active_checks_disabled_services\": %d,\n",active_checks_disabled_services); 01105 printf("\"active_checks_disabled_hosts\": %d,\n",active_checks_disabled_hosts); 01106 01107 printf("\"accept_passive_service_checks\": %s,\n",(accept_passive_service_checks==TRUE)?"true":"false"); 01108 printf("\"accept_passive_host_checks\": %s,\n",(accept_passive_host_checks==TRUE)?"true":"false"); 01109 printf("\"passive_checks_disabled_services\": %d,\n",passive_checks_disabled_services); 01110 printf("\"passive_checks_disabled_hosts\": %d,\n",passive_checks_disabled_hosts); 01111 01112 /* monitoring performance */ 01113 printf("\"min_service_check_execution_time\": %.2f,\n",min_service_execution_time); 01114 printf("\"max_service_check_execution_time\": %.2f,\n",max_service_execution_time); 01115 printf("\"average_service_check_execution_time\": %.3f,\n",average_service_execution_time); 01116 01117 printf("\"min_service_check_latency\": %.2f,\n",min_service_latency); 01118 printf("\"max_service_check_latency\": %.2f,\n",max_service_latency); 01119 printf("\"average_service_check_latency\": %.3f,\n",average_service_latency); 01120 01121 printf("\"min_host_check_execution_time\": %.2f,\n",min_host_execution_time); 01122 printf("\"max_host_check_execution_time\": %.2f,\n",max_host_execution_time); 01123 printf("\"average_host_check_execution_time\": %.3f,\n",average_host_execution_time); 01124 01125 printf("\"min_host_check_latency\": %.2f,\n",min_host_latency); 01126 printf("\"max_host_check_latency\": %.2f,\n",max_host_latency); 01127 printf("\"average_host_check_latency\": %.3f,\n",average_host_latency); 01128 01129 printf("\"total_active_host_checks\": %d,\n",total_active_host_checks); 01130 printf("\"total_active_service_checks\": %d,\n",total_active_service_checks); 01131 01132 printf("\"total_passive_host_checks\": %d,\n",total_passive_host_checks); 01133 printf("\"total_passive_service_checks\": %d\n",total_passive_service_checks); 01134 01135 printf(" }\n"); 01136 01137 // we return here if JSON content. Next time we make an if condition for the html output 01138 return; 01139 } 01140 01141 if(display_header==TRUE){ 01142 printf("<p align=left>\n"); 01143 01144 printf("<table border=0 align=left width=100%% cellspacing=4 cellpadding=0>\n"); 01145 printf("<tr>\n"); 01146 01147 /* left column */ 01148 printf("<td align=left valign=top width=50%%>\n"); 01149 01150 display_info_table("Tactical Monitoring Overview",refresh,¤t_authdata, daemon_check); 01151 01152 printf("</td>\n"); 01153 01154 01155 /* right column */ 01156 printf("<td align=right valign=bottom width=50%%>\n"); 01157 01158 printf("<table border=0 cellspacing=0 cellspadding=0>\n"); 01159 01160 printf("<tr>\n"); 01161 01162 printf("<td valign=bottom align=right>\n"); 01163 01164 /* display context-sensitive help */ 01165 display_context_help(CONTEXTHELP_TAC); 01166 01167 printf("</td>\n"); 01168 01169 printf("<td>\n"); 01170 01171 printf("<table border=0 cellspacing=4 cellspadding=0>\n"); 01172 printf("<tr>\n"); 01173 printf("<td class='perfTitle'> <a href='%s?type=%d' class='perfTitle'>Monitoring Performance</a></td>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE); 01174 printf("</tr>\n"); 01175 01176 printf("<tr>\n"); 01177 printf("<td>\n"); 01178 01179 printf("<table border=0 cellspacing=0 cellspadding=0>\n"); 01180 printf("<tr>\n"); 01181 printf("<td class='perfBox'>\n"); 01182 printf("<table border=0 cellspacing=4 cellspadding=0>\n"); 01183 printf("<tr>\n"); 01184 printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Service Check Execution Time:</a></td>",EXTINFO_CGI,DISPLAY_PERFORMANCE); 01185 printf("<td valign=top class='perfValue' nowrap><a href='%s?type=%d' class='perfValue'>%.2f / %.2f / %.3f sec</a></td>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_service_execution_time,max_service_execution_time,average_service_execution_time); 01186 printf("</tr>\n"); 01187 printf("<tr>\n"); 01188 printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Service Check Latency:</a></td>",EXTINFO_CGI,DISPLAY_PERFORMANCE); 01189 printf("<td valign=top class='perfValue' nowrap><a href='%s?type=%d' class='perfValue'>%.2f / %.2f / %.3f sec</a></td>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_service_latency,max_service_latency,average_service_latency); 01190 printf("</tr>\n"); 01191 printf("<tr>\n"); 01192 printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Host Check Execution Time:</a></td>",EXTINFO_CGI,DISPLAY_PERFORMANCE); 01193 printf("<td valign=top class='perfValue' nowrap><a href='%s?type=%d' class='perfValue'>%.2f / %.2f / %.3f sec</a></td>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_host_execution_time,max_host_execution_time,average_host_execution_time); 01194 printf("</tr>\n"); 01195 printf("<tr>\n"); 01196 printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Host Check Latency:</a></td>",EXTINFO_CGI,DISPLAY_PERFORMANCE); 01197 printf("<td valign=top class='perfValue' nowrap><a href='%s?type=%d' class='perfValue'>%.2f / %.2f / %2.3f sec</a></td>\n",EXTINFO_CGI,DISPLAY_PERFORMANCE,min_host_latency,max_host_latency,average_host_latency); 01198 printf("</tr>\n"); 01199 printf("<tr>\n"); 01200 printf("<td align=left valign=center class='perfItem'><a href='%s?host=all&serviceprops=%d' class='perfItem'># Active Host / Service Checks:</a></td>",STATUS_CGI,SERVICE_ACTIVE_CHECK); 01201 printf("<td valign=top class='perfValue' nowrap><a href='%s?hostgroup=all&hostprops=%d&style=hostdetail' class='perfValue'>%d</a> / <a href='%s?host=all&serviceprops=%d' class='perfValue'>%d</a></td>\n",STATUS_CGI,HOST_ACTIVE_CHECK,total_active_host_checks,STATUS_CGI,SERVICE_ACTIVE_CHECK,total_active_service_checks); 01202 printf("</tr>\n"); 01203 printf("<tr>\n"); 01204 printf("<td align=left valign=center class='perfItem'><a href='%s?host=all&serviceprops=%d' class='perfItem'># Passive Host / Service Checks:</a></td>",STATUS_CGI,SERVICE_PASSIVE_CHECK); 01205 printf("<td valign=top class='perfValue' nowrap><a href='%s?hostgroup=all&hostprops=%d&style=hostdetail' class='perfValue'>%d</a> / <a href='%s?host=all&serviceprops=%d' class='perfValue'>%d</a></td>\n",STATUS_CGI,HOST_PASSIVE_CHECK,total_passive_host_checks,STATUS_CGI,SERVICE_PASSIVE_CHECK,total_passive_service_checks); 01206 printf("</tr>\n"); 01207 printf("</table>\n"); 01208 printf("</td>\n"); 01209 printf("</tr>\n"); 01210 printf("</table>\n"); 01211 01212 printf("</td>\n"); 01213 printf("</tr>\n"); 01214 printf("</table>\n"); 01215 01216 printf("</td>\n"); 01217 printf("</tr>\n"); 01218 printf("</table>\n"); 01219 01220 printf("</td>\n"); 01221 01222 printf("</tr>\n"); 01223 printf("</table>\n"); 01224 printf("</p>\n"); 01225 } 01226 01227 printf("<br clear=all>\n"); 01228 printf("<br>\n"); 01229 01230 01231 printf("<table border=0 cellspacing=0 cellpadding=0 width=100%%>\n"); 01232 printf("<tr>\n"); 01233 printf("<td valign=top align=left width=50%%>\n"); 01234 01235 01236 /******* OUTAGES ********/ 01237 01238 printf("<p>\n"); 01239 01240 printf("<table class='tac' width=125 cellspacing=4 cellpadding=0 border=0>\n"); 01241 01242 printf("<tr><td colspan=1 height=20 class='outageTitle'> Network Outages</td></tr>\n"); 01243 01244 printf("<tr>\n"); 01245 printf("<td class='outageHeader' width=125><a href='%s' class='outageHeader'>",OUTAGES_CGI); 01246 01247 printf("%d Outages",total_blocking_outages); 01248 printf("</a></td>\n"); 01249 printf("</tr>\n"); 01250 01251 printf("<tr>\n"); 01252 01253 printf("<td valign=top>\n"); 01254 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01255 printf("<tr>\n"); 01256 printf("<td valign=bottom width=25> </td>\n"); 01257 printf("<Td width=10> </td>\n"); 01258 01259 printf("<Td valign=top width=100%%>\n"); 01260 printf("<table border=0 width=100%%>\n"); 01261 01262 if(total_blocking_outages>0) 01263 printf("<tr><td width=100%% class='outageImportantProblem'><a href='%s'>%d Blocking Outages</a></td></tr>\n",OUTAGES_CGI,total_blocking_outages); 01264 01265 /* 01266 if(total_nonblocking_outages>0) 01267 printf("<tr><td width=100%% class='outageUnimportantProblem'><a href='%s'>%d Nonblocking Outages</a></td></tr>\n",OUTAGES_CGI,total_nonblocking_outages); 01268 */ 01269 01270 printf("</table>\n"); 01271 printf("</td>\n"); 01272 01273 printf("</tr>\n"); 01274 printf("</table>\n"); 01275 printf("</td>\n"); 01276 01277 printf("</tr>\n"); 01278 printf("</table>\n"); 01279 01280 printf("</p>\n"); 01281 01282 printf("</td>\n"); 01283 01284 01285 01286 /* right column */ 01287 printf("<td valign=top align=right width=50%%>\n"); 01288 01289 if(percent_host_health<HEALTH_CRITICAL_PERCENTAGE) 01290 strncpy(host_health_image,THERM_CRITICAL_IMAGE,sizeof(host_health_image)); 01291 else if(percent_host_health<HEALTH_WARNING_PERCENTAGE) 01292 strncpy(host_health_image,THERM_WARNING_IMAGE,sizeof(host_health_image)); 01293 else 01294 strncpy(host_health_image,THERM_OK_IMAGE,sizeof(host_health_image)); 01295 host_health_image[sizeof(host_health_image)-1]='\x0'; 01296 01297 if(percent_service_health<HEALTH_CRITICAL_PERCENTAGE) 01298 strncpy(service_health_image,THERM_CRITICAL_IMAGE,sizeof(service_health_image)); 01299 else if(percent_service_health<HEALTH_WARNING_PERCENTAGE) 01300 strncpy(service_health_image,THERM_WARNING_IMAGE,sizeof(service_health_image)); 01301 else 01302 strncpy(service_health_image,THERM_OK_IMAGE,sizeof(service_health_image)); 01303 service_health_image[sizeof(service_health_image)-1]='\x0'; 01304 01305 printf("<table border=0 cellspacing=0 cellspadding=0>\n"); 01306 printf("<tr>\n"); 01307 printf("<td>\n"); 01308 01309 printf("<table border=0 cellspacing=4 cellspadding=0>\n"); 01310 printf("<tr>\n"); 01311 printf("<td class='healthTitle'> Network Health</td>\n"); 01312 printf("</tr>\n"); 01313 01314 printf("<tr>\n"); 01315 printf("<td>\n"); 01316 01317 printf("<table border=0 cellspacing=0 cellspadding=0>\n"); 01318 printf("<tr>\n"); 01319 printf("<td class='healthBox'>\n"); 01320 printf("<table border=0 cellspacing=4 cellspadding=0>\n"); 01321 printf("<tr>\n"); 01322 printf("<td align=left valign=center class='healthItem'>Host Health:</td>"); 01323 printf("<td valign=top width=100 class='healthBar'><img src='%s%s' border=0 width=%d height=20 alt='%2.1f%% Health' title='%2.1f%% Health'></td>\n",url_images_path,host_health_image,(percent_host_health<5.0)?5:(int)percent_host_health,percent_host_health,percent_host_health); 01324 printf("</tr>\n"); 01325 printf("<tr>\n"); 01326 printf("<td align=left valign=center class='healthItem'>Service Health:</td>"); 01327 printf("<td valign=top width=100 class='healthBar'><img src='%s%s' border=0 width=%d height=20 alt='%2.1f%% Health' title='%2.1f%% Health'></td>\n",url_images_path,service_health_image,(percent_service_health<5.0)?5:(int)percent_service_health,percent_service_health,percent_service_health); 01328 printf("</tr>\n"); 01329 printf("</table>\n"); 01330 printf("</td>\n"); 01331 printf("</tr>\n"); 01332 printf("</table>\n"); 01333 01334 printf("</td>\n"); 01335 printf("</tr>\n"); 01336 printf("</table>\n"); 01337 01338 printf("</td>\n"); 01339 printf("</tr>\n"); 01340 printf("</table>\n"); 01341 01342 printf("</td>\n"); 01343 printf("</tr>\n"); 01344 printf("</table>\n"); 01345 01346 01347 01348 01349 01350 01351 /******* HOSTS ********/ 01352 01353 printf("<p>\n"); 01354 01355 printf("<table class='tac' width=516 cellspacing=4 cellpadding=0 border=0>\n"); 01356 01357 printf("<tr><td colspan=4 height=20 class='hostTitle'> Hosts</td></tr>\n"); 01358 01359 printf("<tr>\n"); 01360 printf("<td class='hostHeader' width=125><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d' class='hostHeader'>%d Down</a></td>\n",STATUS_CGI,HOST_DOWN,hosts_down); 01361 printf("<td class='hostHeader' width=125><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d' class='hostHeader'>%d Unreachable</a></td>\n",STATUS_CGI,HOST_UNREACHABLE,hosts_unreachable); 01362 printf("<td class='hostHeader' width=125><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d' class='hostHeader'>%d Up</a></td>\n",STATUS_CGI,HOST_UP,hosts_up); 01363 printf("<td class='hostHeader' width=125><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d' class='hostHeader'>%d Pending</a></td>\n",STATUS_CGI,HOST_PENDING,hosts_pending); 01364 printf("</tr>\n"); 01365 01366 printf("<tr>\n"); 01367 01368 01369 printf("<td valign=top>\n"); 01370 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01371 printf("<tr>\n"); 01372 printf("<td valign=bottom width=25> </td>\n"); 01373 printf("<Td width=10> </td>\n"); 01374 01375 printf("<Td valign=top width=100%%>\n"); 01376 printf("<table border=0 width=100%%>\n"); 01377 01378 if(hosts_down_unacknowledged>0) 01379 printf("<tr><td width=100%% class='hostImportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Unhandled Problems</a></td></tr>\n",STATUS_CGI,HOST_DOWN,HOST_NO_SCHEDULED_DOWNTIME|HOST_STATE_UNACKNOWLEDGED|HOST_CHECKS_ENABLED,hosts_down_unacknowledged); 01380 01381 if(hosts_down_scheduled>0) 01382 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Scheduled</a></td></tr>\n",STATUS_CGI,HOST_DOWN,HOST_SCHEDULED_DOWNTIME,hosts_down_scheduled); 01383 01384 if(hosts_down_acknowledged>0) 01385 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Acknowledged</a></td></tr>\n",STATUS_CGI,HOST_DOWN,HOST_STATE_ACKNOWLEDGED,hosts_down_acknowledged); 01386 01387 if(hosts_down_disabled>0) 01388 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,HOST_DOWN,HOST_CHECKS_DISABLED,hosts_down_disabled); 01389 01390 printf("</table>\n"); 01391 printf("</td>\n"); 01392 01393 printf("</tr>\n"); 01394 printf("</table>\n"); 01395 printf("</td>\n"); 01396 01397 01398 01399 01400 printf("<td valign=top>\n"); 01401 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01402 printf("<tr>\n"); 01403 printf("<td valign=bottom width=25> </td>\n"); 01404 printf("<Td width=10> </td>\n"); 01405 01406 printf("<Td valign=top width=100%%>\n"); 01407 printf("<table border=0 width=100%%>\n"); 01408 01409 if(hosts_unreachable_unacknowledged>0) 01410 printf("<tr><td width=100%% class='hostImportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Unhandled Problems</a></td></tr>\n",STATUS_CGI,HOST_UNREACHABLE,HOST_NO_SCHEDULED_DOWNTIME|HOST_STATE_UNACKNOWLEDGED|HOST_CHECKS_ENABLED,hosts_unreachable_unacknowledged); 01411 01412 if(hosts_unreachable_scheduled>0) 01413 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Scheduled</a></td></tr>\n",STATUS_CGI,HOST_UNREACHABLE,HOST_SCHEDULED_DOWNTIME,hosts_unreachable_scheduled); 01414 01415 if(hosts_unreachable_acknowledged>0) 01416 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Acknowledged</a></td></tr>\n",STATUS_CGI,HOST_UNREACHABLE,HOST_STATE_ACKNOWLEDGED,hosts_unreachable_acknowledged); 01417 01418 if(hosts_unreachable_disabled>0) 01419 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,HOST_UNREACHABLE,HOST_CHECKS_DISABLED,hosts_unreachable_disabled); 01420 01421 printf("</table>\n"); 01422 printf("</td>\n"); 01423 01424 printf("</tr>\n"); 01425 printf("</table>\n"); 01426 printf("</td>\n"); 01427 01428 01429 01430 01431 printf("<td valign=top>\n"); 01432 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01433 printf("<tr>\n"); 01434 printf("<td valign=bottom width=25> </td>\n"); 01435 printf("<Td width=10> </td>\n"); 01436 01437 printf("<Td valign=top width=100%%>\n"); 01438 printf("<table border=0 width=100%%>\n"); 01439 01440 if(hosts_up_disabled>0) 01441 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,HOST_UP,HOST_CHECKS_DISABLED,hosts_up_disabled); 01442 01443 printf("</table>\n"); 01444 printf("</td>\n"); 01445 01446 printf("</tr>\n"); 01447 printf("</table>\n"); 01448 printf("</td>\n"); 01449 01450 01451 01452 01453 printf("<td valign=top>\n"); 01454 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01455 printf("<tr>\n"); 01456 printf("<td valign=bottom width=25> </td>\n"); 01457 printf("<Td width=10> </td>\n"); 01458 01459 printf("<Td valign=top width=100%%>\n"); 01460 printf("<table border=0 width=100%%>\n"); 01461 01462 if(hosts_pending_disabled>0) 01463 printf("<tr><td width=100%% class='hostUnimportantProblem'><a href='%s?hostgroup=all&style=hostdetail&hoststatustypes=%d&hostprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,HOST_PENDING,HOST_CHECKS_DISABLED,hosts_pending_disabled); 01464 01465 printf("</table>\n"); 01466 printf("</td>\n"); 01467 01468 printf("</tr>\n"); 01469 printf("</table>\n"); 01470 printf("</td>\n"); 01471 01472 01473 01474 01475 printf("</tr>\n"); 01476 printf("</table>\n"); 01477 01478 /* 01479 printf("</tr>\n"); 01480 printf("</table>\n"); 01481 */ 01482 01483 printf("</p>\n"); 01484 01485 01486 01487 01488 /*printf("<br clear=all>\n");*/ 01489 01490 01491 01492 01493 /******* SERVICES ********/ 01494 01495 printf("<p>\n"); 01496 01497 printf("<table class='tac' width=641 cellspacing=4 cellpadding=0 border=0>\n"); 01498 01499 printf("<tr><td colspan=5 height=20 class='serviceTitle'> Services</td></tr>\n"); 01500 01501 printf("<tr>\n"); 01502 printf("<td class='serviceHeader' width=125><a href='%s?host=all&style=detail&servicestatustypes=%d' class='serviceHeader'>%d Critical</a></td>\n",STATUS_CGI,SERVICE_CRITICAL,services_critical); 01503 printf("<td class='serviceHeader' width=125><a href='%s?host=all&style=detail&servicestatustypes=%d' class='serviceHeader'>%d Warning</a></td>\n",STATUS_CGI,SERVICE_WARNING,services_warning); 01504 printf("<td class='serviceHeader' width=125><a href='%s?host=all&style=detail&servicestatustypes=%d' class='serviceHeader'>%d Unknown</a></td>\n",STATUS_CGI,SERVICE_UNKNOWN,services_unknown); 01505 printf("<td class='serviceHeader' width=125><a href='%s?host=all&style=detail&servicestatustypes=%d' class='serviceHeader'>%d Ok</a></td>\n",STATUS_CGI,SERVICE_OK,services_ok); 01506 printf("<td class='serviceHeader' width=125><a href='%s?host=all&style=detail&servicestatustypes=%d' class='serviceHeader'>%d Pending</a></td>\n",STATUS_CGI,SERVICE_PENDING,services_pending); 01507 printf("</tr>\n"); 01508 01509 printf("<tr>\n"); 01510 01511 01512 printf("<td valign=top>\n"); 01513 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01514 printf("<tr>\n"); 01515 printf("<td valign=bottom width=25> </td>\n"); 01516 printf("<Td width=10> </td>\n"); 01517 01518 printf("<Td valign=top width=100%%>\n"); 01519 printf("<table border=0 width=100%%>\n"); 01520 01521 if(services_critical_unacknowledged>0) 01522 printf("<tr><td width=100%% class='serviceImportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'>%d Unhandled Problems</a></td></tr>\n",STATUS_CGI,SERVICE_CRITICAL,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_critical_unacknowledged); 01523 01524 if(services_critical_host_problem>0) 01525 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d'>%d on Problem Hosts</a></td></tr>\n",STATUS_CGI,SERVICE_CRITICAL,HOST_DOWN|HOST_UNREACHABLE,services_critical_host_problem); 01526 01527 if(services_critical_scheduled>0) 01528 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Scheduled</a></td></tr>\n",STATUS_CGI,SERVICE_CRITICAL,SERVICE_SCHEDULED_DOWNTIME,services_critical_scheduled); 01529 01530 if(services_critical_acknowledged>0) 01531 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Acknowledged</a></td></tr>\n",STATUS_CGI,SERVICE_CRITICAL,SERVICE_STATE_ACKNOWLEDGED,services_critical_acknowledged); 01532 01533 if(services_critical_disabled>0) 01534 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_CRITICAL,SERVICE_CHECKS_DISABLED,services_critical_disabled); 01535 01536 printf("</table>\n"); 01537 printf("</td>\n"); 01538 01539 printf("</tr>\n"); 01540 printf("</table>\n"); 01541 printf("</td>\n"); 01542 01543 01544 01545 01546 01547 printf("<td valign=top>\n"); 01548 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01549 printf("<tr>\n"); 01550 printf("<td valign=bottom width=25> </td>\n"); 01551 printf("<Td width=10> </td>\n"); 01552 01553 printf("<Td valign=top width=100%%>\n"); 01554 printf("<table border=0 width=100%%>\n"); 01555 01556 if(services_warning_unacknowledged>0) 01557 printf("<tr><td width=100%% class='serviceImportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'>%d Unhandled Problems</a></td></tr>\n",STATUS_CGI,SERVICE_WARNING,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_warning_unacknowledged); 01558 01559 if(services_warning_host_problem>0) 01560 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d'>%d on Problem Hosts</a></td></tr>\n",STATUS_CGI,SERVICE_WARNING,HOST_DOWN|HOST_UNREACHABLE,services_warning_host_problem); 01561 01562 if(services_warning_scheduled>0) 01563 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Scheduled</a></td></tr>\n",STATUS_CGI,SERVICE_WARNING,SERVICE_SCHEDULED_DOWNTIME,services_warning_scheduled); 01564 01565 if(services_warning_acknowledged>0) 01566 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Acknowledged</a></td></tr>\n",STATUS_CGI,SERVICE_WARNING,SERVICE_STATE_ACKNOWLEDGED,services_warning_acknowledged); 01567 01568 if(services_warning_disabled>0) 01569 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_WARNING,SERVICE_CHECKS_DISABLED,services_warning_disabled); 01570 01571 printf("</table>\n"); 01572 printf("</td>\n"); 01573 01574 printf("</tr>\n"); 01575 printf("</table>\n"); 01576 printf("</td>\n"); 01577 01578 01579 01580 01581 01582 printf("<td valign=top>\n"); 01583 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01584 printf("<tr>\n"); 01585 printf("<td valign=bottom width=25> </td>\n"); 01586 printf("<Td width=10> </td>\n"); 01587 01588 printf("<Td valign=top width=100%%>\n"); 01589 printf("<table border=0 width=100%%>\n"); 01590 01591 if(services_unknown_unacknowledged>0) 01592 printf("<tr><td width=100%% class='serviceImportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d&serviceprops=%d'>%d Unhandled Problems</a></td></tr>\n",STATUS_CGI,SERVICE_UNKNOWN,HOST_UP|HOST_PENDING,SERVICE_NO_SCHEDULED_DOWNTIME|SERVICE_STATE_UNACKNOWLEDGED|SERVICE_CHECKS_ENABLED,services_unknown_unacknowledged); 01593 01594 if(services_unknown_host_problem>0) 01595 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&hoststatustypes=%d'>%d on Problem Hosts</a></td></tr>\n",STATUS_CGI,SERVICE_UNKNOWN,HOST_DOWN|HOST_UNREACHABLE,services_unknown_host_problem); 01596 01597 if(services_unknown_scheduled>0) 01598 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Scheduled</a></td></tr>\n",STATUS_CGI,SERVICE_UNKNOWN,SERVICE_SCHEDULED_DOWNTIME,services_unknown_scheduled); 01599 01600 if(services_unknown_acknowledged>0) 01601 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Acknowledged</a></td></tr>\n",STATUS_CGI,SERVICE_UNKNOWN,SERVICE_STATE_ACKNOWLEDGED,services_unknown_acknowledged); 01602 01603 if(services_unknown_disabled>0) 01604 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_UNKNOWN,SERVICE_CHECKS_DISABLED,services_unknown_disabled); 01605 01606 printf("</table>\n"); 01607 printf("</td>\n"); 01608 01609 printf("</tr>\n"); 01610 printf("</table>\n"); 01611 printf("</td>\n"); 01612 01613 01614 01615 01616 printf("<td valign=top>\n"); 01617 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01618 printf("<tr>\n"); 01619 printf("<td valign=bottom width=25> </td>\n"); 01620 printf("<Td width=10> </td>\n"); 01621 01622 printf("<Td valign=top width=100%%>\n"); 01623 printf("<table border=0 width=100%%>\n"); 01624 01625 if(services_ok_disabled>0) 01626 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_OK,SERVICE_CHECKS_DISABLED,services_ok_disabled); 01627 01628 printf("</table>\n"); 01629 printf("</td>\n"); 01630 01631 printf("</tr>\n"); 01632 printf("</table>\n"); 01633 printf("</td>\n"); 01634 01635 01636 01637 printf("<td valign=top>\n"); 01638 printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n"); 01639 printf("<tr>\n"); 01640 printf("<td valign=bottom width=25> </td>\n"); 01641 printf("<Td width=10> </td>\n"); 01642 01643 printf("<td valign=top width=100%%>\n"); 01644 printf("<table border=0 width=100%%>\n"); 01645 01646 if(services_pending_disabled>0) 01647 printf("<tr><td width=100%% class='serviceUnimportantProblem'><a href='%s?host=all&type=detail&servicestatustypes=%d&serviceprops=%d'>%d Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_PENDING,SERVICE_CHECKS_DISABLED,services_pending_disabled); 01648 01649 printf("</table>\n"); 01650 printf("</td>\n"); 01651 01652 printf("</tr>\n"); 01653 printf("</table>\n"); 01654 printf("</td>\n"); 01655 01656 01657 01658 printf("</tr>\n"); 01659 printf("</table>\n"); 01660 01661 printf("</p>\n"); 01662 01663 01664 01665 01666 /*printf("<br clear=all>\n");*/ 01667 01668 01669 01670 01671 01672 /******* MONITORING FEATURES ********/ 01673 01674 printf("<p>\n"); 01675 01676 printf("<table class='tac' cellspacing=4 cellpadding=0 border=0>\n"); 01677 01678 printf("<tr><td colspan=5 height=20 class='featureTitle'> Monitoring Features</td></tr>\n"); 01679 01680 printf("<tr>\n"); 01681 printf("<td class='featureHeader' width=135>Flap Detection</td>\n"); 01682 printf("<td class='featureHeader' width=135>Notifications</td>\n"); 01683 printf("<td class='featureHeader' width=135>Event Handlers</td>\n"); 01684 printf("<td class='featureHeader' width=135>Active Checks</td>\n"); 01685 printf("<td class='featureHeader' width=135>Passive Checks</td>\n"); 01686 printf("</tr>\n"); 01687 01688 printf("<tr>\n"); 01689 01690 printf("<td valign=top>\n"); 01691 printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n"); 01692 printf("<tr>\n"); 01693 printf("<td valign=top><a href='%s?cmd_typ=%d'><img src='%s%s' border=0 alt='Flap Detection %s' title='Flap Detection %s'></a></td>\n",CMD_CGI,(enable_flap_detection==TRUE)?CMD_DISABLE_FLAP_DETECTION:CMD_ENABLE_FLAP_DETECTION,url_images_path,(enable_flap_detection==TRUE)?TAC_ENABLED_ICON:TAC_DISABLED_ICON,(enable_flap_detection==TRUE)?"Enabled":"Disabled",(enable_flap_detection==TRUE)?"Enabled":"Disabled"); 01694 printf("<Td width=10> </td>\n"); 01695 if(enable_flap_detection==TRUE){ 01696 printf("<Td valign=top width=100%% class='featureEnabledFlapDetection'>\n"); 01697 printf("<table border=0 width=100%%>\n"); 01698 01699 if(flap_disabled_services>0) 01700 printf("<tr><td width=100%% class='featureItemDisabledServiceFlapDetection'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_FLAP_DETECTION_DISABLED,flap_disabled_services,(flap_disabled_services==1)?"":"s"); 01701 else 01702 printf("<tr><td width=100%% class='featureItemEnabledServiceFlapDetection'>All Services Enabled</td></tr>\n"); 01703 01704 if(flapping_services>0) 01705 printf("<tr><td width=100%% class='featureItemServicesFlapping'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Flapping</a></td></tr>\n",STATUS_CGI,SERVICE_IS_FLAPPING,flapping_services,(flapping_services==1)?"":"s"); 01706 else 01707 printf("<tr><td width=100%% class='featureItemServicesNotFlapping'>No Services Flapping</td></tr>\n"); 01708 01709 if(flap_disabled_hosts>0) 01710 printf("<tr><td width=100%% class='featureItemDisabledHostFlapDetection'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n",STATUS_CGI,HOST_FLAP_DETECTION_DISABLED,flap_disabled_hosts,(flap_disabled_hosts==1)?"":"s"); 01711 else 01712 printf("<tr><td width=100%% class='featureItemEnabledHostFlapDetection'>All Hosts Enabled</td></tr>\n"); 01713 01714 if(flapping_hosts>0) 01715 printf("<tr><td width=100%% class='featureItemHostsFlapping'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Flapping</a></td></tr>\n",STATUS_CGI,HOST_IS_FLAPPING,flapping_hosts,(flapping_hosts==1)?"":"s"); 01716 else 01717 printf("<tr><td width=100%% class='featureItemHostsNotFlapping'>No Hosts Flapping</td></tr>\n"); 01718 01719 printf("</table>\n"); 01720 printf("</td>\n"); 01721 } 01722 else 01723 printf("<Td valign=center width=100%% class='featureDisabledFlapDetection'>N/A</td>\n"); 01724 printf("</tr>\n"); 01725 printf("</table>\n"); 01726 printf("</td>\n"); 01727 01728 01729 01730 01731 printf("<td valign=top>\n"); 01732 printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n"); 01733 printf("<tr>\n"); 01734 printf("<td valign=top><a href='%s?cmd_typ=%d'><img src='%s%s' border=0 alt='Notifications %s' title='Notifications %s'></a></td>\n",CMD_CGI,(enable_notifications==TRUE)?CMD_DISABLE_NOTIFICATIONS:CMD_ENABLE_NOTIFICATIONS,url_images_path,(enable_notifications==TRUE)?TAC_ENABLED_ICON:TAC_DISABLED_ICON,(enable_notifications==TRUE)?"Enabled":"Disabled",(enable_notifications==TRUE)?"Enabled":"Disabled"); 01735 printf("<Td width=10> </td>\n"); 01736 if(enable_notifications==TRUE){ 01737 printf("<Td valign=top width=100%% class='featureEnabledNotifications'>\n"); 01738 printf("<table border=0 width=100%%>\n"); 01739 01740 if(notification_disabled_services>0) 01741 printf("<tr><td width=100%% class='featureItemDisabledServiceNotifications'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_NOTIFICATIONS_DISABLED,notification_disabled_services,(notification_disabled_services==1)?"":"s"); 01742 else 01743 printf("<tr><td width=100%% class='featureItemEnabledServiceNotifications'>All Services Enabled</td></tr>\n"); 01744 01745 if(notification_disabled_hosts>0) 01746 printf("<tr><td width=100%% class='featureItemDisabledHostNotifications'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n",STATUS_CGI,HOST_NOTIFICATIONS_DISABLED,notification_disabled_hosts,(notification_disabled_hosts==1)?"":"s"); 01747 else 01748 printf("<tr><td width=100%% class='featureItemEnabledHostNotifications'>All Hosts Enabled</td></tr>\n"); 01749 01750 printf("</table>\n"); 01751 printf("</td>\n"); 01752 } 01753 else 01754 printf("<Td valign=center width=100%% class='featureDisabledNotifications'>N/A</td>\n"); 01755 printf("</tr>\n"); 01756 printf("</table>\n"); 01757 printf("</td>\n"); 01758 01759 01760 01761 01762 01763 printf("<td valign=top>\n"); 01764 printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n"); 01765 printf("<tr>\n"); 01766 printf("<td valign=top><a href='%s?cmd_typ=%d'><img src='%s%s' border=0 alt='Event Handlers %s' title='Event Handlers %s'></a></td>\n",CMD_CGI,(enable_event_handlers==TRUE)?CMD_DISABLE_EVENT_HANDLERS:CMD_ENABLE_EVENT_HANDLERS,url_images_path,(enable_event_handlers==TRUE)?TAC_ENABLED_ICON:TAC_DISABLED_ICON,(enable_event_handlers==TRUE)?"Enabled":"Disabled",(enable_event_handlers==TRUE)?"Enabled":"Disabled"); 01767 printf("<Td width=10> </td>\n"); 01768 if(enable_event_handlers==TRUE){ 01769 printf("<Td valign=top width=100%% class='featureEnabledHandlers'>\n"); 01770 printf("<table border=0 width=100%%>\n"); 01771 01772 if(event_handler_disabled_services>0) 01773 printf("<tr><td width=100%% class='featureItemDisabledServiceHandlers'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_EVENT_HANDLER_DISABLED,event_handler_disabled_services,(event_handler_disabled_services==1)?"":"s"); 01774 else 01775 printf("<tr><td width=100%% class='featureItemEnabledServiceHandlers'>All Services Enabled</td></tr>\n"); 01776 01777 if(event_handler_disabled_hosts>0) 01778 printf("<tr><td width=100%% class='featureItemDisabledHostHandlers'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n",STATUS_CGI,HOST_EVENT_HANDLER_DISABLED,event_handler_disabled_hosts,(event_handler_disabled_hosts==1)?"":"s"); 01779 else 01780 printf("<tr><td width=100%% class='featureItemEnabledHostHandlers'>All Hosts Enabled</td></tr>\n"); 01781 01782 printf("</table>\n"); 01783 printf("</td>\n"); 01784 } 01785 else 01786 printf("<Td valign=center width=100%% class='featureDisabledHandlers'>N/A</td>\n"); 01787 printf("</tr>\n"); 01788 printf("</table>\n"); 01789 printf("</td>\n"); 01790 01791 01792 01793 01794 01795 printf("<td valign=top>\n"); 01796 printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n"); 01797 printf("<tr>\n"); 01798 printf("<td valign=top><a href='%s?type=%d'><img src='%s%s' border='0' alt='Active Checks %s' title='Active Checks %s'></a></td>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO,url_images_path,(execute_service_checks==TRUE)?TAC_ENABLED_ICON:TAC_DISABLED_ICON,(execute_service_checks==TRUE)?"Enabled":"Disabled",(execute_service_checks==TRUE)?"Enabled":"Disabled"); 01799 printf("<Td width=10> </td>\n"); 01800 if(execute_service_checks==TRUE){ 01801 printf("<Td valign=top width=100%% class='featureEnabledActiveChecks'>\n"); 01802 printf("<table border=0 width=100%%>\n"); 01803 01804 if(active_checks_disabled_services>0) 01805 printf("<tr><td width=100%% class='featureItemDisabledActiveServiceChecks'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_CHECKS_DISABLED,active_checks_disabled_services,(active_checks_disabled_services==1)?"":"s"); 01806 else 01807 printf("<tr><td width=100%% class='featureItemEnabledActiveServiceChecks'>All Services Enabled</td></tr>\n"); 01808 01809 if(active_checks_disabled_hosts>0) 01810 printf("<tr><td width=100%% class='featureItemDisabledActiveHostChecks'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n",STATUS_CGI,HOST_CHECKS_DISABLED,active_checks_disabled_hosts,(active_checks_disabled_hosts==1)?"":"s"); 01811 else 01812 printf("<tr><td width=100%% class='featureItemEnabledActiveHostChecks'>All Hosts Enabled</td></tr>\n"); 01813 01814 printf("</table>\n"); 01815 printf("</td>\n"); 01816 } 01817 else 01818 printf("<Td valign=center width=100%% class='featureDisabledActiveChecks'>N/A</td>\n"); 01819 printf("</tr>\n"); 01820 printf("</table>\n"); 01821 printf("</td>\n"); 01822 01823 01824 01825 01826 01827 printf("<td valign=top>\n"); 01828 printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n"); 01829 printf("<tr>\n"); 01830 printf("<td valign=top><a href='%s?type=%d'><img src='%s%s' border='0' alt='Passive Checks %s' title='Passive Checks %s'></a></td>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO,url_images_path,(accept_passive_service_checks==TRUE)?TAC_ENABLED_ICON:TAC_DISABLED_ICON,(accept_passive_service_checks==TRUE)?"Enabled":"Disabled",(accept_passive_service_checks==TRUE)?"Enabled":"Disabled"); 01831 printf("<Td width=10> </td>\n"); 01832 if(accept_passive_service_checks==TRUE){ 01833 01834 printf("<Td valign=top width=100%% class='featureEnabledPassiveChecks'>\n"); 01835 printf("<table border=0 width=100%%>\n"); 01836 01837 if(passive_checks_disabled_services>0) 01838 printf("<tr><td width=100%% class='featureItemDisabledPassiveServiceChecks'><a href='%s?host=all&type=detail&serviceprops=%d'>%d Service%s Disabled</a></td></tr>\n",STATUS_CGI,SERVICE_PASSIVE_CHECKS_DISABLED,passive_checks_disabled_services,(passive_checks_disabled_services==1)?"":"s"); 01839 else 01840 printf("<tr><td width=100%% class='featureItemEnabledPassiveServiceChecks'>All Services Enabled</td></tr>\n"); 01841 01842 if(passive_checks_disabled_hosts>0) 01843 printf("<tr><td width=100%% class='featureItemDisabledPassiveHostChecks'><a href='%s?hostgroup=all&style=hostdetail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n",STATUS_CGI,HOST_PASSIVE_CHECKS_DISABLED,passive_checks_disabled_hosts,(passive_checks_disabled_hosts==1)?"":"s"); 01844 else 01845 printf("<tr><td width=100%% class='featureItemEnabledPassiveHostChecks'>All Hosts Enabled</td></tr>\n"); 01846 01847 printf("</table>\n"); 01848 printf("</td>\n"); 01849 } 01850 else 01851 printf("<Td valign=center width=100%% class='featureDisabledPassiveChecks'>N/A</td>\n"); 01852 printf("</tr>\n"); 01853 printf("</table>\n"); 01854 printf("</td>\n"); 01855 01856 printf("</tr>\n"); 01857 01858 printf("</table>\n"); 01859 01860 printf("</p>\n"); 01861 01862 01863 return; 01864 } 01865