1 /***********************************************************************
2  *
3  * TAC.C - Nagios Tactical Monitoring Overview CGI
4  *
5  * Copyright (c) 2001-2010 Ethan Galstad (egalstad@nagios.org)
6  * Last Modified: 08-05-2010
7  *
8  * This CGI program will display the contents of the Nagios
9  * log file.
10  *
11  * License:
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2 as
15  * published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  ***********************************************************************/
26 
27 #include "../include/config.h"
28 #include "../include/common.h"
29 #include "../include/objects.h"
30 #include "../include/statusdata.h"
31 
32 #include "../include/getcgi.h"
33 #include "../include/cgiutils.h"
34 #include "../include/cgiauth.h"
35 
36 
37 #define HEALTH_WARNING_PERCENTAGE       90
38 #define HEALTH_CRITICAL_PERCENTAGE      75
39 
40 
41 /* HOSTOUTAGE structure */
42 typedef struct hostoutage_struct {
43 	host *hst;
44 	int  affected_child_hosts;
45 	struct hostoutage_struct *next;
46 	} hostoutage;
47 
48 
49 extern char   main_config_file[MAX_FILENAME_LENGTH];
50 extern char   url_html_path[MAX_FILENAME_LENGTH];
51 extern char   url_images_path[MAX_FILENAME_LENGTH];
52 extern char   url_stylesheets_path[MAX_FILENAME_LENGTH];
53 extern char   url_media_path[MAX_FILENAME_LENGTH];
54 
55 extern int    refresh_rate;
56 
57 extern char *service_critical_sound;
58 extern char *service_warning_sound;
59 extern char *service_unknown_sound;
60 extern char *host_down_sound;
61 extern char *host_unreachable_sound;
62 extern char *normal_sound;
63 
64 extern host *host_list;
65 extern hostgroup *hostgroup_list;
66 extern hoststatus *hoststatus_list;
67 extern servicestatus *servicestatus_list;
68 
69 extern int enable_notifications;
70 extern int execute_service_checks;
71 extern int accept_passive_service_checks;
72 extern int enable_event_handlers;
73 extern int enable_flap_detection;
74 
75 extern int nagios_process_state;
76 
77 
78 
79 
80 void analyze_status_data(void);
81 void display_tac_overview(void);
82 
83 void find_hosts_causing_outages(void);
84 void calculate_outage_effect_of_host(host *, int *);
85 int is_route_to_host_blocked(host *);
86 int number_of_host_services(host *);
87 void add_hostoutage(host *);
88 void free_hostoutage_list(void);
89 
90 void document_header(int);
91 void document_footer(void);
92 int process_cgivars(void);
93 
94 authdata current_authdata;
95 
96 int embedded = FALSE;
97 int display_header = FALSE;
98 
99 hostoutage *hostoutage_list = NULL;
100 
101 int total_blocking_outages = 0;
102 int total_nonblocking_outages = 0;
103 
104 int total_service_health = 0;
105 int total_host_health = 0;
106 int potential_service_health = 0;
107 int potential_host_health = 0;
108 double percent_service_health = 0.0;
109 double percent_host_health = 0.0;
110 
111 int total_hosts = 0;
112 int total_services = 0;
113 
114 int total_active_service_checks = 0;
115 int total_active_host_checks = 0;
116 int total_passive_service_checks = 0;
117 int total_passive_host_checks = 0;
118 
119 double min_service_execution_time = -1.0;
120 double max_service_execution_time = -1.0;
121 double total_service_execution_time = 0.0;
122 double average_service_execution_time = -1.0;
123 double min_host_execution_time = -1.0;
124 double max_host_execution_time = -1.0;
125 double total_host_execution_time = 0.0;
126 double average_host_execution_time = -1.0;
127 double min_service_latency = -1.0;
128 double max_service_latency = -1.0;
129 double total_service_latency = 0.0;
130 double average_service_latency = -1.0;
131 double min_host_latency = -1.0;
132 double max_host_latency = -1.0;
133 double total_host_latency = 0.0;
134 double average_host_latency = -1.0;
135 
136 int flapping_services = 0;
137 int flapping_hosts = 0;
138 int flap_disabled_services = 0;
139 int flap_disabled_hosts = 0;
140 int notification_disabled_services = 0;
141 int notification_disabled_hosts = 0;
142 int event_handler_disabled_services = 0;
143 int event_handler_disabled_hosts = 0;
144 int active_checks_disabled_services = 0;
145 int active_checks_disabled_hosts = 0;
146 int passive_checks_disabled_services = 0;
147 int passive_checks_disabled_hosts = 0;
148 
149 int hosts_pending = 0;
150 int hosts_pending_disabled = 0;
151 int hosts_up_disabled = 0;
152 int hosts_up_unacknowledged = 0;
153 int hosts_up = 0;
154 int hosts_down_scheduled = 0;
155 int hosts_down_acknowledged = 0;
156 int hosts_down_disabled = 0;
157 int hosts_down_unacknowledged = 0;
158 int hosts_down = 0;
159 int hosts_unreachable_scheduled = 0;
160 int hosts_unreachable_acknowledged = 0;
161 int hosts_unreachable_disabled = 0;
162 int hosts_unreachable_unacknowledged = 0;
163 int hosts_unreachable = 0;
164 
165 int services_pending = 0;
166 int services_pending_disabled = 0;
167 int services_ok_disabled = 0;
168 int services_ok_unacknowledged = 0;
169 int services_ok = 0;
170 int services_warning_host_problem = 0;
171 int services_warning_scheduled = 0;
172 int services_warning_acknowledged = 0;
173 int services_warning_disabled = 0;
174 int services_warning_unacknowledged = 0;
175 int services_warning = 0;
176 int services_unknown_host_problem = 0;
177 int services_unknown_scheduled = 0;
178 int services_unknown_acknowledged = 0;
179 int services_unknown_disabled = 0;
180 int services_unknown_unacknowledged = 0;
181 int services_unknown = 0;
182 int services_critical_host_problem = 0;
183 int services_critical_scheduled = 0;
184 int services_critical_acknowledged = 0;
185 int services_critical_disabled = 0;
186 int services_critical_unacknowledged = 0;
187 int services_critical = 0;
188 
189 
190 /*efine DEBUG 1*/
191 
main(void)192 int main(void) {
193 	int result = OK;
194 	char *sound = NULL;
195 #ifdef DEBUG
196 	time_t t1, t2, t3, t4, t5, t6, t7, t8, t9;
197 #endif
198 
199 
200 #ifdef DEBUG
201 	time(&t1);
202 #endif
203 
204 	/* get the CGI variables passed in the URL */
205 	process_cgivars();
206 
207 	/* reset internal variables */
208 	reset_cgi_vars();
209 
210 	/* read the CGI configuration file */
211 	result = read_cgi_config_file(get_cgi_config_location());
212 	if(result == ERROR) {
213 		document_header(FALSE);
214 		cgi_config_file_error(get_cgi_config_location());
215 		document_footer();
216 		return ERROR;
217 		}
218 
219 #ifdef DEBUG
220 	time(&t2);
221 #endif
222 
223 	/* read the main configuration file */
224 	result = read_main_config_file(main_config_file);
225 	if(result == ERROR) {
226 		document_header(FALSE);
227 		main_config_file_error(main_config_file);
228 		document_footer();
229 		return ERROR;
230 		}
231 
232 #ifdef DEBUG
233 	time(&t3);
234 #endif
235 
236 	/* read all object configuration data */
237 	result = read_all_object_configuration_data(main_config_file, READ_ALL_OBJECT_DATA);
238 	if(result == ERROR) {
239 		document_header(FALSE);
240 		object_data_error();
241 		document_footer();
242 		return ERROR;
243 		}
244 
245 #ifdef DEBUG
246 	time(&t4);
247 #endif
248 
249 	/* read all status data */
250 	result = read_all_status_data(get_cgi_config_location(), READ_ALL_STATUS_DATA);
251 	if(result == ERROR) {
252 		document_header(FALSE);
253 		status_data_error();
254 		document_footer();
255 		free_memory();
256 		return ERROR;
257 		}
258 
259 #ifdef DEBUG
260 	time(&t5);
261 #endif
262 
263 	document_header(TRUE);
264 
265 	/* get authentication information */
266 	get_authentication_information(&current_authdata);
267 
268 	if(display_header == TRUE) {
269 
270 		/* begin top table */
271 		printf("<table border=0 width=100%% cellpadding=0 cellspacing=0>\n");
272 		printf("<tr>\n");
273 
274 		/* left column of top table - info box */
275 		printf("<td align=left valign=top width=33%%>\n");
276 		display_info_table("Tactical Status Overview", TRUE, &current_authdata);
277 		printf("</td>\n");
278 
279 		/* middle column of top table - log file navigation options */
280 		printf("<td align=center valign=top width=33%%>\n");
281 		printf("</td>\n");
282 
283 		/* right hand column of top row */
284 		printf("<td align=right valign=top width=33%%>\n");
285 		printf("</td>\n");
286 
287 		/* end of top table */
288 		printf("</tr>\n");
289 		printf("</table>\n");
290 		printf("</p>\n");
291 
292 		}
293 
294 
295 #ifdef DEBUG
296 	time(&t6);
297 #endif
298 
299 	/* analyze current host and service status data for tac overview */
300 	analyze_status_data();
301 
302 #ifdef DEBUG
303 	time(&t7);
304 #endif
305 
306 	/* find all hosts that are causing network outages */
307 	find_hosts_causing_outages();
308 
309 
310 #ifdef DEBUG
311 	time(&t8);
312 #endif
313 
314 	/* embed sound tag if necessary... */
315 	if(hosts_unreachable_unacknowledged > 0 && host_unreachable_sound != NULL)
316 		sound = host_unreachable_sound;
317 	else if(hosts_down_unacknowledged > 0 && host_down_sound != NULL)
318 		sound = host_down_sound;
319 	else if(services_critical_unacknowledged > 0 && service_critical_sound != NULL)
320 		sound = service_critical_sound;
321 	else if(services_warning_unacknowledged > 0 && service_warning_sound != NULL)
322 		sound = service_warning_sound;
323 	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)
324 		sound = normal_sound;
325 	if(sound != NULL) {
326 		printf("<object type=\"audio/x-wav\" data=\"%s%s\" height=\"-\" width=\"0\">", url_media_path, sound);
327 		printf("<param name=\"filename\" value=\"%s%s\">", url_media_path, sound);
328 		printf("<param name=\"autostart\" value=\"true\">");
329 		printf("<param name=\"playcount\" value=\"1\">");
330 		printf("</object>");
331 		}
332 
333 
334 	/**** display main tac screen ****/
335 	display_tac_overview();
336 
337 #ifdef DEBUG
338 	time(&t9);
339 #endif
340 
341 	document_footer();
342 
343 	/* free memory allocated to the host outage list */
344 	free_hostoutage_list();
345 
346 	/* free allocated memory */
347 	free_memory();
348 
349 #ifdef DEBUG
350 	printf("T1: %lu\n", (unsigned long)t1);
351 	printf("T2: %lu\n", (unsigned long)t2);
352 	printf("T3: %lu\n", (unsigned long)t3);
353 	printf("T4: %lu\n", (unsigned long)t4);
354 	printf("T5: %lu\n", (unsigned long)t5);
355 	printf("T6: %lu\n", (unsigned long)t6);
356 	printf("T7: %lu\n", (unsigned long)t7);
357 	printf("T8: %lu\n", (unsigned long)t8);
358 	printf("T9: %lu\n", (unsigned long)t9);
359 #endif
360 
361 	return OK;
362 	}
363 
364 
365 
366 
document_header(int use_stylesheet)367 void document_header(int use_stylesheet) {
368 	char date_time[MAX_DATETIME_LENGTH];
369 	time_t current_time;
370 	time_t expire_time;
371 
372 	printf("Cache-Control: no-store\r\n");
373 	printf("Pragma: no-cache\r\n");
374 	printf("Refresh: %d\r\n", refresh_rate);
375 
376 	time(&current_time);
377 	get_time_string(&current_time, date_time, (int)sizeof(date_time), HTTP_DATE_TIME);
378 	printf("Last-Modified: %s\r\n", date_time);
379 
380 	expire_time = (time_t)0L;
381 	get_time_string(&expire_time, date_time, (int)sizeof(date_time), HTTP_DATE_TIME);
382 	printf("Expires: %s\r\n", date_time);
383 
384 	printf("Content-type: text/html\r\n\r\n");
385 
386 	if(embedded == TRUE)
387 		return;
388 
389 	printf("<HTML>\n");
390 	printf("<HEAD>\n");
391 	printf("<link rel=\"shortcut icon\" href=\"%sfavicon.ico\" type=\"image/ico\">\n", url_images_path);
392 	printf("<TITLE>\n");
393 	printf("Nagios Tactical Monitoring Overview\n");
394 	printf("</TITLE>\n");
395 
396 	if(use_stylesheet == TRUE) {
397 		printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>\n", url_stylesheets_path, COMMON_CSS);
398 		printf("<LINK REL='stylesheet' TYPE='text/css' HREF='%s%s'>\n", url_stylesheets_path, TAC_CSS);
399 		}
400 
401 	printf("</HEAD>\n");
402 	printf("<BODY CLASS='tac' marginwidth=2 marginheight=2 topmargin=0 leftmargin=0 rightmargin=0>\n");
403 
404 	/* include user SSI header */
405 	include_ssi_files(TAC_CGI, SSI_HEADER);
406 
407 	return;
408 	}
409 
410 
document_footer(void)411 void document_footer(void) {
412 
413 	if(embedded == TRUE)
414 		return;
415 
416 	/* include user SSI footer */
417 	include_ssi_files(TAC_CGI, SSI_FOOTER);
418 
419 	printf("</BODY>\n");
420 	printf("</HTML>\n");
421 
422 	return;
423 	}
424 
425 
process_cgivars(void)426 int process_cgivars(void) {
427 	char **variables;
428 	int error = FALSE;
429 	int x;
430 
431 	variables = getcgivars();
432 
433 	for(x = 0; variables[x] != NULL; x++) {
434 
435 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
436 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
437 			continue;
438 			}
439 
440 		/* we found the embed option */
441 		else if(!strcmp(variables[x], "embedded"))
442 			embedded = TRUE;
443 
444 		/* we found the noheader option */
445 		else if(!strcmp(variables[x], "noheader"))
446 			display_header = FALSE;
447 
448 		/* we received an invalid argument */
449 		else
450 			error = TRUE;
451 
452 		}
453 
454 	/* free memory allocated to the CGI variables */
455 	free_cgivars(variables);
456 
457 	return error;
458 	}
459 
460 
461 
analyze_status_data(void)462 void analyze_status_data(void) {
463 	servicestatus *temp_servicestatus;
464 	service *temp_service;
465 	hoststatus *temp_hoststatus;
466 	host *temp_host;
467 	int problem = TRUE;
468 
469 
470 	/* check all services */
471 	for(temp_servicestatus = servicestatus_list; temp_servicestatus != NULL; temp_servicestatus = temp_servicestatus->next) {
472 
473 		/* see if user is authorized to view this service */
474 		temp_service = find_service(temp_servicestatus->host_name, temp_servicestatus->description);
475 		if(is_authorized_for_service(temp_service, &current_authdata) == FALSE)
476 			continue;
477 
478 		/******** CHECK FEATURES *******/
479 
480 		/* check flapping */
481 		if(temp_servicestatus->flap_detection_enabled == FALSE)
482 			flap_disabled_services++;
483 		else if(temp_servicestatus->is_flapping == TRUE)
484 			flapping_services++;
485 
486 		/* check notifications */
487 		if(temp_servicestatus->notifications_enabled == FALSE)
488 			notification_disabled_services++;
489 
490 		/* check event handler */
491 		if(temp_servicestatus->event_handler_enabled == FALSE)
492 			event_handler_disabled_services++;
493 
494 		/* active check execution */
495 		if(temp_servicestatus->checks_enabled == FALSE)
496 			active_checks_disabled_services++;
497 
498 		/* passive check acceptance */
499 		if(temp_servicestatus->accept_passive_service_checks == FALSE)
500 			passive_checks_disabled_services++;
501 
502 
503 		/********* CHECK STATUS ********/
504 
505 		problem = TRUE;
506 
507 		if(temp_servicestatus->status == SERVICE_OK) {
508 			if(temp_servicestatus->checks_enabled == FALSE)
509 				services_ok_disabled++;
510 			else
511 				services_ok_unacknowledged++;
512 			services_ok++;
513 			}
514 
515 		else if(temp_servicestatus->status == SERVICE_WARNING) {
516 			temp_hoststatus = find_hoststatus(temp_servicestatus->host_name);
517 			if(temp_hoststatus != NULL && (temp_hoststatus->status == HOST_DOWN || temp_hoststatus->status == HOST_UNREACHABLE)) {
518 				services_warning_host_problem++;
519 				problem = FALSE;
520 				}
521 			if(temp_servicestatus->scheduled_downtime_depth > 0) {
522 				services_warning_scheduled++;
523 				problem = FALSE;
524 				}
525 			if(temp_servicestatus->problem_has_been_acknowledged == TRUE) {
526 				services_warning_acknowledged++;
527 				problem = FALSE;
528 				}
529 			if(temp_servicestatus->checks_enabled == FALSE) {
530 				services_warning_disabled++;
531 				problem = FALSE;
532 				}
533 			if(problem == TRUE)
534 				services_warning_unacknowledged++;
535 			services_warning++;
536 			}
537 
538 		else if(temp_servicestatus->status == SERVICE_UNKNOWN) {
539 			temp_hoststatus = find_hoststatus(temp_servicestatus->host_name);
540 			if(temp_hoststatus != NULL && (temp_hoststatus->status == HOST_DOWN || temp_hoststatus->status == HOST_UNREACHABLE)) {
541 				services_unknown_host_problem++;
542 				problem = FALSE;
543 				}
544 			if(temp_servicestatus->scheduled_downtime_depth > 0) {
545 				services_unknown_scheduled++;
546 				problem = FALSE;
547 				}
548 			if(temp_servicestatus->problem_has_been_acknowledged == TRUE) {
549 				services_unknown_acknowledged++;
550 				problem = FALSE;
551 				}
552 			if(temp_servicestatus->checks_enabled == FALSE) {
553 				services_unknown_disabled++;
554 				problem = FALSE;
555 				}
556 			if(problem == TRUE)
557 				services_unknown_unacknowledged++;
558 			services_unknown++;
559 			}
560 
561 		else if(temp_servicestatus->status == SERVICE_CRITICAL) {
562 			temp_hoststatus = find_hoststatus(temp_servicestatus->host_name);
563 			if(temp_hoststatus != NULL && (temp_hoststatus->status == HOST_DOWN || temp_hoststatus->status == HOST_UNREACHABLE)) {
564 				services_critical_host_problem++;
565 				problem = FALSE;
566 				}
567 			if(temp_servicestatus->scheduled_downtime_depth > 0) {
568 				services_critical_scheduled++;
569 				problem = FALSE;
570 				}
571 			if(temp_servicestatus->problem_has_been_acknowledged == TRUE) {
572 				services_critical_acknowledged++;
573 				problem = FALSE;
574 				}
575 			if(temp_servicestatus->checks_enabled == FALSE) {
576 				services_critical_disabled++;
577 				problem = FALSE;
578 				}
579 			if(problem == TRUE)
580 				services_critical_unacknowledged++;
581 			services_critical++;
582 			}
583 
584 		else if(temp_servicestatus->status == SERVICE_PENDING) {
585 			if(temp_servicestatus->checks_enabled == FALSE)
586 				services_pending_disabled++;
587 			services_pending++;
588 			}
589 
590 
591 		/* get health stats */
592 		if(temp_servicestatus->status == SERVICE_OK)
593 			total_service_health += 2;
594 
595 		else if(temp_servicestatus->status == SERVICE_WARNING || temp_servicestatus->status == SERVICE_UNKNOWN)
596 			total_service_health++;
597 
598 		if(temp_servicestatus->status != SERVICE_PENDING)
599 			potential_service_health += 2;
600 
601 
602 		/* calculate execution time and latency stats */
603 		if(temp_servicestatus->check_type == SERVICE_CHECK_ACTIVE) {
604 
605 			total_active_service_checks++;
606 
607 			if(min_service_latency == -1.0 || temp_servicestatus->latency < min_service_latency)
608 				min_service_latency = temp_servicestatus->latency;
609 			if(max_service_latency == -1.0 || temp_servicestatus->latency > max_service_latency)
610 				max_service_latency = temp_servicestatus->latency;
611 
612 			if(min_service_execution_time == -1.0 || temp_servicestatus->execution_time < min_service_execution_time)
613 				min_service_execution_time = temp_servicestatus->execution_time;
614 			if(max_service_execution_time == -1.0 || temp_servicestatus->execution_time > max_service_execution_time)
615 				max_service_execution_time = temp_servicestatus->execution_time;
616 
617 			total_service_latency += temp_servicestatus->latency;
618 			total_service_execution_time += temp_servicestatus->execution_time;
619 			}
620 		else
621 			total_passive_service_checks++;
622 
623 
624 		total_services++;
625 		}
626 
627 
628 
629 	/* check all hosts */
630 	for(temp_hoststatus = hoststatus_list; temp_hoststatus != NULL; temp_hoststatus = temp_hoststatus->next) {
631 
632 		/* see if user is authorized to view this host */
633 		temp_host = find_host(temp_hoststatus->host_name);
634 		if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
635 			continue;
636 
637 		/******** CHECK FEATURES *******/
638 
639 		/* check flapping */
640 		if(temp_hoststatus->flap_detection_enabled == FALSE)
641 			flap_disabled_hosts++;
642 		else if(temp_hoststatus->is_flapping == TRUE)
643 			flapping_hosts++;
644 
645 		/* check notifications */
646 		if(temp_hoststatus->notifications_enabled == FALSE)
647 			notification_disabled_hosts++;
648 
649 		/* check event handler */
650 		if(temp_hoststatus->event_handler_enabled == FALSE)
651 			event_handler_disabled_hosts++;
652 
653 		/* active check execution */
654 		if(temp_hoststatus->checks_enabled == FALSE)
655 			active_checks_disabled_hosts++;
656 
657 		/* passive check acceptance */
658 		if(temp_hoststatus->accept_passive_host_checks == FALSE)
659 			passive_checks_disabled_hosts++;
660 
661 
662 		/********* CHECK STATUS ********/
663 
664 		problem = TRUE;
665 
666 		if(temp_hoststatus->status == HOST_UP) {
667 			if(temp_hoststatus->checks_enabled == FALSE)
668 				hosts_up_disabled++;
669 			else
670 				hosts_up_unacknowledged++;
671 			hosts_up++;
672 			}
673 
674 		else if(temp_hoststatus->status == HOST_DOWN) {
675 			if(temp_hoststatus->scheduled_downtime_depth > 0) {
676 				hosts_down_scheduled++;
677 				problem = FALSE;
678 				}
679 			if(temp_hoststatus->problem_has_been_acknowledged == TRUE) {
680 				hosts_down_acknowledged++;
681 				problem = FALSE;
682 				}
683 			if(temp_hoststatus->checks_enabled == FALSE) {
684 				hosts_down_disabled++;
685 				problem = FALSE;
686 				}
687 			if(problem == TRUE)
688 				hosts_down_unacknowledged++;
689 			hosts_down++;
690 			}
691 
692 		else if(temp_hoststatus->status == HOST_UNREACHABLE) {
693 			if(temp_hoststatus->scheduled_downtime_depth > 0) {
694 				hosts_unreachable_scheduled++;
695 				problem = FALSE;
696 				}
697 			if(temp_hoststatus->problem_has_been_acknowledged == TRUE) {
698 				hosts_unreachable_acknowledged++;
699 				problem = FALSE;
700 				}
701 			if(temp_hoststatus->checks_enabled == FALSE) {
702 				hosts_unreachable_disabled++;
703 				problem = FALSE;
704 				}
705 			if(problem == TRUE)
706 				hosts_unreachable_unacknowledged++;
707 			hosts_unreachable++;
708 			}
709 
710 		else if(temp_hoststatus->status == HOST_PENDING) {
711 			if(temp_hoststatus->checks_enabled == FALSE)
712 				hosts_pending_disabled++;
713 			hosts_pending++;
714 			}
715 
716 		/* get health stats */
717 		if(temp_hoststatus->status == HOST_UP)
718 			total_host_health++;
719 
720 		if(temp_hoststatus->status != HOST_PENDING)
721 			potential_host_health++;
722 
723 		/* check type stats */
724 		if(temp_hoststatus->check_type == HOST_CHECK_ACTIVE) {
725 
726 			total_active_host_checks++;
727 
728 			if(min_host_latency == -1.0 || temp_hoststatus->latency < min_host_latency)
729 				min_host_latency = temp_hoststatus->latency;
730 			if(max_host_latency == -1.0 || temp_hoststatus->latency > max_host_latency)
731 				max_host_latency = temp_hoststatus->latency;
732 
733 			if(min_host_execution_time == -1.0 || temp_hoststatus->execution_time < min_host_execution_time)
734 				min_host_execution_time = temp_hoststatus->execution_time;
735 			if(max_host_execution_time == -1.0 || temp_hoststatus->execution_time > max_host_execution_time)
736 				max_host_execution_time = temp_hoststatus->execution_time;
737 
738 			total_host_latency += temp_hoststatus->latency;
739 			total_host_execution_time += temp_hoststatus->execution_time;
740 			}
741 		else
742 			total_passive_host_checks++;
743 
744 		total_hosts++;
745 		}
746 
747 
748 	/* calculate service health */
749 	if(potential_service_health == 0)
750 		percent_service_health = 0.0;
751 	else
752 		percent_service_health = ((double)total_service_health / (double)potential_service_health) * 100.0;
753 
754 	/* calculate host health */
755 	if(potential_host_health == 0)
756 		percent_host_health = 0.0;
757 	else
758 		percent_host_health = ((double)total_host_health / (double)potential_host_health) * 100.0;
759 
760 	/* calculate service latency */
761 	if(total_service_latency == 0L)
762 		average_service_latency = 0.0;
763 	else
764 		average_service_latency = ((double)total_service_latency / (double)total_active_service_checks);
765 
766 	/* calculate host latency */
767 	if(total_host_latency == 0L)
768 		average_host_latency = 0.0;
769 	else
770 		average_host_latency = ((double)total_host_latency / (double)total_active_host_checks);
771 
772 	/* calculate service execution time */
773 	if(total_service_execution_time == 0.0)
774 		average_service_execution_time = 0.0;
775 	else
776 		average_service_execution_time = ((double)total_service_execution_time / (double)total_active_service_checks);
777 
778 	/* calculate host execution time */
779 	if(total_host_execution_time == 0.0)
780 		average_host_execution_time = 0.0;
781 	else
782 		average_host_execution_time = ((double)total_host_execution_time / (double)total_active_host_checks);
783 
784 	return;
785 	}
786 
787 
788 
789 
790 /* determine what hosts are causing network outages */
find_hosts_causing_outages(void)791 void find_hosts_causing_outages(void) {
792 	hoststatus *temp_hoststatus;
793 	hostoutage *temp_hostoutage;
794 	host *temp_host;
795 
796 	/* user must be authorized for all hosts in order to see outages */
797 	if(is_authorized_for_all_hosts(&current_authdata) == FALSE)
798 		return;
799 
800 	/* check all hosts */
801 	for(temp_hoststatus = hoststatus_list; temp_hoststatus != NULL; temp_hoststatus = temp_hoststatus->next) {
802 
803 		/* check only hosts that are not up and not pending */
804 		if(temp_hoststatus->status != HOST_UP && temp_hoststatus->status != HOST_PENDING) {
805 
806 			/* find the host entry */
807 			temp_host = find_host(temp_hoststatus->host_name);
808 
809 			if(temp_host == NULL)
810 				continue;
811 
812 			/* if the route to this host is not blocked, it is a causing an outage */
813 			if(is_route_to_host_blocked(temp_host) == FALSE)
814 				add_hostoutage(temp_host);
815 			}
816 		}
817 
818 
819 	/* check all hosts that are causing problems and calculate the extent of the problem */
820 	for(temp_hostoutage = hostoutage_list; temp_hostoutage != NULL; temp_hostoutage = temp_hostoutage->next) {
821 
822 		/* calculate the outage effect of this particular hosts */
823 		calculate_outage_effect_of_host(temp_hostoutage->hst, &temp_hostoutage->affected_child_hosts);
824 
825 		if(temp_hostoutage->affected_child_hosts > 1)
826 			total_blocking_outages++;
827 		else
828 			total_nonblocking_outages++;
829 		}
830 
831 	return;
832 	}
833 
834 
835 
836 
837 
838 /* adds a host outage entry */
add_hostoutage(host * hst)839 void add_hostoutage(host *hst) {
840 	hostoutage *new_hostoutage;
841 
842 	/* allocate memory for a new structure */
843 	new_hostoutage = (hostoutage *)malloc(sizeof(hostoutage));
844 
845 	if(new_hostoutage == NULL)
846 		return;
847 
848 	new_hostoutage->hst = hst;
849 	new_hostoutage->affected_child_hosts = 0;
850 
851 	/* add the structure to the head of the list in memory */
852 	new_hostoutage->next = hostoutage_list;
853 	hostoutage_list = new_hostoutage;
854 
855 	return;
856 	}
857 
858 
859 
860 
861 /* frees all memory allocated to the host outage list */
free_hostoutage_list(void)862 void free_hostoutage_list(void) {
863 	hostoutage *this_hostoutage;
864 	hostoutage *next_hostoutage;
865 
866 	for(this_hostoutage = hostoutage_list; this_hostoutage != NULL; this_hostoutage = next_hostoutage) {
867 		next_hostoutage = this_hostoutage->next;
868 		free(this_hostoutage);
869 		}
870 
871 	return;
872 	}
873 
874 
875 
876 /* calculates network outage effect of a particular host being down or unreachable */
calculate_outage_effect_of_host(host * hst,int * affected_hosts)877 void calculate_outage_effect_of_host(host *hst, int *affected_hosts) {
878 	int total_child_hosts_affected = 0;
879 	int temp_child_hosts_affected = 0;
880 	host *temp_host;
881 
882 
883 	/* find all child hosts of this host */
884 	for(temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) {
885 
886 		/* skip this host if it is not a child */
887 		if(is_host_immediate_child_of_host(hst, temp_host) == FALSE)
888 			continue;
889 
890 		/* calculate the outage effect of the child */
891 		calculate_outage_effect_of_host(temp_host, &temp_child_hosts_affected);
892 
893 		/* keep a running total of outage effects */
894 		total_child_hosts_affected += temp_child_hosts_affected;
895 		}
896 
897 	*affected_hosts = total_child_hosts_affected + 1;
898 
899 	return;
900 	}
901 
902 
903 
904 /* tests whether or not a host is "blocked" by upstream parents (host is already assumed to be down or unreachable) */
is_route_to_host_blocked(host * hst)905 int is_route_to_host_blocked(host *hst) {
906 	hostsmember *temp_hostsmember;
907 	hoststatus *temp_hoststatus;
908 
909 	/* if the host has no parents, it is not being blocked by anyone */
910 	if(hst->parent_hosts == NULL)
911 		return FALSE;
912 
913 	/* check all parent hosts */
914 	for(temp_hostsmember = hst->parent_hosts; temp_hostsmember != NULL; temp_hostsmember = temp_hostsmember->next) {
915 
916 		/* find the parent host's status */
917 		temp_hoststatus = find_hoststatus(temp_hostsmember->host_name);
918 
919 		if(temp_hoststatus == NULL)
920 			continue;
921 
922 		/* at least one parent it up (or pending), so this host is not blocked */
923 		if(temp_hoststatus->status == HOST_UP || temp_hoststatus->status == HOST_PENDING)
924 			return FALSE;
925 		}
926 
927 	return TRUE;
928 	}
929 
930 
931 
932 
933 
934 
display_tac_overview(void)935 void display_tac_overview(void) {
936 	char host_health_image[16];
937 	char service_health_image[16];
938 
939 
940 	printf("<p align=left>\n");
941 
942 	printf("<table border=0 align=left width=100%% cellspacing=4 cellpadding=0>\n");
943 	printf("<tr>\n");
944 
945 	/* left column */
946 	printf("<td align=left valign=top width=50%%>\n");
947 
948 	display_info_table("Tactical Monitoring Overview", TRUE, &current_authdata);
949 
950 	printf("</td>\n");
951 
952 
953 	/* right column */
954 	printf("<td align=right valign=bottom width=50%%>\n");
955 
956 	printf("<table border=0 cellspacing=0 cellspadding=0>\n");
957 
958 	printf("<tr>\n");
959 
960 	printf("<td valign=bottom align=right>\n");
961 
962 	/* display context-sensitive help */
963 	display_context_help(CONTEXTHELP_TAC);
964 
965 	printf("</td>\n");
966 
967 	printf("<td>\n");
968 
969 	printf("<table border=0 cellspacing=4 cellspadding=0>\n");
970 	printf("<tr>\n");
971 	printf("<td class='perfTitle'>&nbsp;<a href='%s?type=%d' class='perfTitle'>Monitoring Performance</a></td>\n", EXTINFO_CGI, DISPLAY_PERFORMANCE);
972 	printf("</tr>\n");
973 
974 	printf("<tr>\n");
975 	printf("<td>\n");
976 
977 	printf("<table border=0 cellspacing=0 cellspadding=0>\n");
978 	printf("<tr>\n");
979 	printf("<td class='perfBox'>\n");
980 	printf("<table border=0 cellspacing=4 cellspadding=0>\n");
981 	printf("<tr>\n");
982 	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);
983 	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);
984 	printf("</tr>\n");
985 	printf("<tr>\n");
986 	printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Service Check Latency:</a></td>", EXTINFO_CGI, DISPLAY_PERFORMANCE);
987 	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);
988 	printf("</tr>\n");
989 	printf("<tr>\n");
990 	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);
991 	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);
992 	printf("</tr>\n");
993 	printf("<tr>\n");
994 	printf("<td align=left valign=center class='perfItem'><a href='%s?type=%d' class='perfItem'>Host Check Latency:</a></td>", EXTINFO_CGI, DISPLAY_PERFORMANCE);
995 	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);
996 	printf("</tr>\n");
997 	printf("<tr>\n");
998 	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);
999 	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);
1000 	printf("</tr>\n");
1001 	printf("<tr>\n");
1002 	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);
1003 	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);
1004 	printf("</tr>\n");
1005 	printf("</table>\n");
1006 	printf("</td>\n");
1007 	printf("</tr>\n");
1008 	printf("</table>\n");
1009 
1010 	printf("</td>\n");
1011 	printf("</tr>\n");
1012 	printf("</table>\n");
1013 
1014 	printf("</td>\n");
1015 	printf("</tr>\n");
1016 	printf("</table>\n");
1017 
1018 	printf("</td>\n");
1019 
1020 	printf("</tr>\n");
1021 	printf("</table>\n");
1022 	printf("</p>\n");
1023 
1024 	printf("<br clear=all>\n");
1025 	printf("<br>\n");
1026 
1027 
1028 
1029 
1030 	printf("<table border=0 cellspacing=0 cellpadding=0 width=100%%>\n");
1031 	printf("<tr>\n");
1032 	printf("<td valign=top align=left width=50%%>\n");
1033 
1034 
1035 	/******* OUTAGES ********/
1036 
1037 	printf("<p>\n");
1038 
1039 	printf("<table class='tac' width=125 cellspacing=4 cellpadding=0 border=0>\n");
1040 
1041 	printf("<tr><td colspan=1 height=20 class='outageTitle'>&nbsp;Network Outages</td></tr>\n");
1042 
1043 	printf("<tr>\n");
1044 	printf("<td class='outageHeader' width=125><a href='%s' class='outageHeader'>", OUTAGES_CGI);
1045 	if(is_authorized_for_all_hosts(&current_authdata) == FALSE)
1046 		printf("N/A");
1047 	else
1048 		printf("%d Outages", total_blocking_outages);
1049 	printf("</a></td>\n");
1050 	printf("</tr>\n");
1051 
1052 	printf("<tr>\n");
1053 
1054 	printf("<td valign=top>\n");
1055 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1056 	printf("<tr>\n");
1057 	printf("<td valign=bottom width=25>&nbsp;&nbsp;&nbsp;</td>\n");
1058 	printf("<Td width=10>&nbsp;</td>\n");
1059 
1060 	printf("<Td valign=top width=100%%>\n");
1061 	printf("<table border=0 width=100%%>\n");
1062 
1063 	if(total_blocking_outages > 0)
1064 		printf("<tr><td width=100%% class='outageImportantProblem'><a href='%s'>%d Blocking Outages</a></td></tr>\n", OUTAGES_CGI, total_blocking_outages);
1065 
1066 	/*
1067 	if(total_nonblocking_outages>0)
1068 		printf("<tr><td width=100%% class='outageUnimportantProblem'><a href='%s'>%d Nonblocking Outages</a></td></tr>\n",OUTAGES_CGI,total_nonblocking_outages);
1069 	*/
1070 
1071 	printf("</table>\n");
1072 	printf("</td>\n");
1073 
1074 	printf("</tr>\n");
1075 	printf("</table>\n");
1076 	printf("</td>\n");
1077 
1078 	printf("</tr>\n");
1079 	printf("</table>\n");
1080 
1081 	printf("</p>\n");
1082 
1083 	printf("</td>\n");
1084 
1085 
1086 
1087 	/* right column */
1088 	printf("<td valign=top align=right width=50%%>\n");
1089 
1090 	if(percent_host_health < HEALTH_CRITICAL_PERCENTAGE)
1091 		strncpy(host_health_image, THERM_CRITICAL_IMAGE, sizeof(host_health_image));
1092 	else if(percent_host_health < HEALTH_WARNING_PERCENTAGE)
1093 		strncpy(host_health_image, THERM_WARNING_IMAGE, sizeof(host_health_image));
1094 	else
1095 		strncpy(host_health_image, THERM_OK_IMAGE, sizeof(host_health_image));
1096 	host_health_image[sizeof(host_health_image) - 1] = '\x0';
1097 
1098 	if(percent_service_health < HEALTH_CRITICAL_PERCENTAGE)
1099 		strncpy(service_health_image, THERM_CRITICAL_IMAGE, sizeof(service_health_image));
1100 	else if(percent_service_health < HEALTH_WARNING_PERCENTAGE)
1101 		strncpy(service_health_image, THERM_WARNING_IMAGE, sizeof(service_health_image));
1102 	else
1103 		strncpy(service_health_image, THERM_OK_IMAGE, sizeof(service_health_image));
1104 	service_health_image[sizeof(service_health_image) - 1] = '\x0';
1105 
1106 	printf("<table border=0 cellspacing=0 cellspadding=0>\n");
1107 	printf("<tr>\n");
1108 	printf("<td>\n");
1109 
1110 	printf("<table border=0 cellspacing=4 cellspadding=0>\n");
1111 	printf("<tr>\n");
1112 	printf("<td class='healthTitle'>&nbsp;Network Health</td>\n");
1113 	printf("</tr>\n");
1114 
1115 	printf("<tr>\n");
1116 	printf("<td>\n");
1117 
1118 	printf("<table border=0 cellspacing=0 cellspadding=0>\n");
1119 	printf("<tr>\n");
1120 	printf("<td class='healthBox'>\n");
1121 	printf("<table border=0 cellspacing=4 cellspadding=0>\n");
1122 	printf("<tr>\n");
1123 	printf("<td align=left valign=center class='healthItem'>Host Health:</td>");
1124 	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);
1125 	printf("</tr>\n");
1126 	printf("<tr>\n");
1127 	printf("<td align=left valign=center class='healthItem'>Service Health:</td>");
1128 	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);
1129 	printf("</tr>\n");
1130 	printf("</table>\n");
1131 	printf("</td>\n");
1132 	printf("</tr>\n");
1133 	printf("</table>\n");
1134 
1135 	printf("</td>\n");
1136 	printf("</tr>\n");
1137 	printf("</table>\n");
1138 
1139 	printf("</td>\n");
1140 	printf("</tr>\n");
1141 	printf("</table>\n");
1142 
1143 	printf("</td>\n");
1144 	printf("</tr>\n");
1145 	printf("</table>\n");
1146 
1147 
1148 
1149 
1150 
1151 
1152 	/******* HOSTS ********/
1153 
1154 	printf("<p>\n");
1155 
1156 	printf("<table class='tac' width=516 cellspacing=4 cellpadding=0 border=0>\n");
1157 
1158 	printf("<tr><td colspan=4 height=20 class='hostTitle'>&nbsp;Hosts</td></tr>\n");
1159 
1160 	printf("<tr>\n");
1161 	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);
1162 	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);
1163 	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);
1164 	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);
1165 	printf("</tr>\n");
1166 
1167 	printf("<tr>\n");
1168 
1169 
1170 	printf("<td valign=top>\n");
1171 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1172 	printf("<tr>\n");
1173 	printf("<td valign=bottom width=25>&nbsp;&nbsp;&nbsp;</td>\n");
1174 	printf("<Td width=10>&nbsp;</td>\n");
1175 
1176 	printf("<Td valign=top width=100%%>\n");
1177 	printf("<table border=0 width=100%%>\n");
1178 
1179 	if(hosts_down_unacknowledged > 0)
1180 		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);
1181 
1182 	if(hosts_down_scheduled > 0)
1183 		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);
1184 
1185 	if(hosts_down_acknowledged > 0)
1186 		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);
1187 
1188 	if(hosts_down_disabled > 0)
1189 		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);
1190 
1191 	printf("</table>\n");
1192 	printf("</td>\n");
1193 
1194 	printf("</tr>\n");
1195 	printf("</table>\n");
1196 	printf("</td>\n");
1197 
1198 
1199 
1200 
1201 	printf("<td valign=top>\n");
1202 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1203 	printf("<tr>\n");
1204 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1205 	printf("<Td width=10>&nbsp;</td>\n");
1206 
1207 	printf("<Td valign=top width=100%%>\n");
1208 	printf("<table border=0 width=100%%>\n");
1209 
1210 	if(hosts_unreachable_unacknowledged > 0)
1211 		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);
1212 
1213 	if(hosts_unreachable_scheduled > 0)
1214 		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);
1215 
1216 	if(hosts_unreachable_acknowledged > 0)
1217 		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);
1218 
1219 	if(hosts_unreachable_disabled > 0)
1220 		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);
1221 
1222 	printf("</table>\n");
1223 	printf("</td>\n");
1224 
1225 	printf("</tr>\n");
1226 	printf("</table>\n");
1227 	printf("</td>\n");
1228 
1229 
1230 
1231 
1232 	printf("<td valign=top>\n");
1233 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1234 	printf("<tr>\n");
1235 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1236 	printf("<Td width=10>&nbsp;</td>\n");
1237 
1238 	printf("<Td valign=top width=100%%>\n");
1239 	printf("<table border=0 width=100%%>\n");
1240 
1241 	if(hosts_up_disabled > 0)
1242 		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);
1243 
1244 	printf("</table>\n");
1245 	printf("</td>\n");
1246 
1247 	printf("</tr>\n");
1248 	printf("</table>\n");
1249 	printf("</td>\n");
1250 
1251 
1252 
1253 
1254 	printf("<td valign=top>\n");
1255 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1256 	printf("<tr>\n");
1257 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1258 	printf("<Td width=10>&nbsp;</td>\n");
1259 
1260 	printf("<Td valign=top width=100%%>\n");
1261 	printf("<table border=0 width=100%%>\n");
1262 
1263 	if(hosts_pending_disabled > 0)
1264 		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);
1265 
1266 	printf("</table>\n");
1267 	printf("</td>\n");
1268 
1269 	printf("</tr>\n");
1270 	printf("</table>\n");
1271 	printf("</td>\n");
1272 
1273 
1274 
1275 
1276 	printf("</tr>\n");
1277 	printf("</table>\n");
1278 
1279 	/*
1280 	printf("</tr>\n");
1281 	printf("</table>\n");
1282 	*/
1283 
1284 	printf("</p>\n");
1285 
1286 
1287 
1288 
1289 	/*printf("<br clear=all>\n");*/
1290 
1291 
1292 
1293 
1294 	/******* SERVICES ********/
1295 
1296 	printf("<p>\n");
1297 
1298 	printf("<table class='tac' width=641 cellspacing=4 cellpadding=0 border=0>\n");
1299 
1300 	printf("<tr><td colspan=5 height=20 class='serviceTitle'>&nbsp;Services</td></tr>\n");
1301 
1302 	printf("<tr>\n");
1303 	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);
1304 	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);
1305 	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);
1306 	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);
1307 	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);
1308 	printf("</tr>\n");
1309 
1310 	printf("<tr>\n");
1311 
1312 
1313 	printf("<td valign=top>\n");
1314 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1315 	printf("<tr>\n");
1316 	printf("<td valign=bottom width=25>&nbsp;&nbsp;&nbsp;</td>\n");
1317 	printf("<Td width=10>&nbsp;</td>\n");
1318 
1319 	printf("<Td valign=top width=100%%>\n");
1320 	printf("<table border=0 width=100%%>\n");
1321 
1322 	if(services_critical_unacknowledged > 0)
1323 		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);
1324 
1325 	if(services_critical_host_problem > 0)
1326 		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);
1327 
1328 	if(services_critical_scheduled > 0)
1329 		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);
1330 
1331 	if(services_critical_acknowledged > 0)
1332 		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);
1333 
1334 	if(services_critical_disabled > 0)
1335 		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);
1336 
1337 	printf("</table>\n");
1338 	printf("</td>\n");
1339 
1340 	printf("</tr>\n");
1341 	printf("</table>\n");
1342 	printf("</td>\n");
1343 
1344 
1345 
1346 
1347 
1348 	printf("<td valign=top>\n");
1349 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1350 	printf("<tr>\n");
1351 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1352 	printf("<Td width=10>&nbsp;</td>\n");
1353 
1354 	printf("<Td valign=top width=100%%>\n");
1355 	printf("<table border=0 width=100%%>\n");
1356 
1357 	if(services_warning_unacknowledged > 0)
1358 		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);
1359 
1360 	if(services_warning_host_problem > 0)
1361 		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);
1362 
1363 	if(services_warning_scheduled > 0)
1364 		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);
1365 
1366 	if(services_warning_acknowledged > 0)
1367 		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);
1368 
1369 	if(services_warning_disabled > 0)
1370 		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);
1371 
1372 	printf("</table>\n");
1373 	printf("</td>\n");
1374 
1375 	printf("</tr>\n");
1376 	printf("</table>\n");
1377 	printf("</td>\n");
1378 
1379 
1380 
1381 
1382 
1383 	printf("<td valign=top>\n");
1384 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1385 	printf("<tr>\n");
1386 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1387 	printf("<Td width=10>&nbsp;</td>\n");
1388 
1389 	printf("<Td valign=top width=100%%>\n");
1390 	printf("<table border=0 width=100%%>\n");
1391 
1392 	if(services_unknown_unacknowledged > 0)
1393 		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);
1394 
1395 	if(services_unknown_host_problem > 0)
1396 		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);
1397 
1398 	if(services_unknown_scheduled > 0)
1399 		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);
1400 
1401 	if(services_unknown_acknowledged > 0)
1402 		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);
1403 
1404 	if(services_unknown_disabled > 0)
1405 		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);
1406 
1407 	printf("</table>\n");
1408 	printf("</td>\n");
1409 
1410 	printf("</tr>\n");
1411 	printf("</table>\n");
1412 	printf("</td>\n");
1413 
1414 
1415 
1416 
1417 	printf("<td valign=top>\n");
1418 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1419 	printf("<tr>\n");
1420 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1421 	printf("<Td width=10>&nbsp;</td>\n");
1422 
1423 	printf("<Td valign=top width=100%%>\n");
1424 	printf("<table border=0 width=100%%>\n");
1425 
1426 	if(services_ok_disabled > 0)
1427 		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);
1428 
1429 	printf("</table>\n");
1430 	printf("</td>\n");
1431 
1432 	printf("</tr>\n");
1433 	printf("</table>\n");
1434 	printf("</td>\n");
1435 
1436 
1437 
1438 	printf("<td valign=top>\n");
1439 	printf("<table border=0 width=125 cellspacing=0 cellpadding=0>\n");
1440 	printf("<tr>\n");
1441 	printf("<td valign=bottom width=25>&nbsp;</td>\n");
1442 	printf("<Td width=10>&nbsp;</td>\n");
1443 
1444 	printf("<td valign=top width=100%%>\n");
1445 	printf("<table border=0 width=100%%>\n");
1446 
1447 	if(services_pending_disabled > 0)
1448 		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);
1449 
1450 	printf("</table>\n");
1451 	printf("</td>\n");
1452 
1453 	printf("</tr>\n");
1454 	printf("</table>\n");
1455 	printf("</td>\n");
1456 
1457 
1458 
1459 	printf("</tr>\n");
1460 	printf("</table>\n");
1461 
1462 	printf("</p>\n");
1463 
1464 
1465 
1466 
1467 	/*printf("<br clear=all>\n");*/
1468 
1469 
1470 
1471 
1472 
1473 	/******* MONITORING FEATURES ********/
1474 
1475 	printf("<p>\n");
1476 
1477 	printf("<table class='tac' cellspacing=4 cellpadding=0 border=0>\n");
1478 
1479 	printf("<tr><td colspan=5 height=20 class='featureTitle'>&nbsp;Monitoring Features</td></tr>\n");
1480 
1481 	printf("<tr>\n");
1482 	printf("<td class='featureHeader' width=135>Flap Detection</td>\n");
1483 	printf("<td class='featureHeader' width=135>Notifications</td>\n");
1484 	printf("<td class='featureHeader' width=135>Event Handlers</td>\n");
1485 	printf("<td class='featureHeader' width=135>Active Checks</td>\n");
1486 	printf("<td class='featureHeader' width=135>Passive Checks</td>\n");
1487 	printf("</tr>\n");
1488 
1489 	printf("<tr>\n");
1490 
1491 	printf("<td valign=top>\n");
1492 	printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n");
1493 	printf("<tr>\n");
1494 	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", COMMAND_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");
1495 	printf("<Td width=10>&nbsp;</td>\n");
1496 	if(enable_flap_detection == TRUE) {
1497 		printf("<Td valign=top width=100%% class='featureEnabledFlapDetection'>\n");
1498 		printf("<table border=0 width=100%%>\n");
1499 
1500 		if(flap_disabled_services > 0)
1501 			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");
1502 		else
1503 			printf("<tr><td width=100%% class='featureItemEnabledServiceFlapDetection'>All Services Enabled</td></tr>\n");
1504 
1505 		if(flapping_services > 0)
1506 			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");
1507 		else
1508 			printf("<tr><td width=100%% class='featureItemServicesNotFlapping'>No Services Flapping</td></tr>\n");
1509 
1510 		if(flap_disabled_hosts > 0)
1511 			printf("<tr><td width=100%% class='featureItemDisabledHostFlapDetection'><a href='%s?host=all&type=detail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n", STATUS_CGI, HOST_FLAP_DETECTION_DISABLED, flap_disabled_hosts, (flap_disabled_hosts == 1) ? "" : "s");
1512 		else
1513 			printf("<tr><td width=100%% class='featureItemEnabledHostFlapDetection'>All Hosts Enabled</td></tr>\n");
1514 
1515 		if(flapping_hosts > 0)
1516 			printf("<tr><td width=100%% class='featureItemHostsFlapping'><a href='%s?host=all&type=detail&hostprops=%d'>%d Host%s Flapping</a></td></tr>\n", STATUS_CGI, HOST_IS_FLAPPING, flapping_hosts, (flapping_hosts == 1) ? "" : "s");
1517 		else
1518 			printf("<tr><td width=100%% class='featureItemHostsNotFlapping'>No Hosts Flapping</td></tr>\n");
1519 
1520 		printf("</table>\n");
1521 		printf("</td>\n");
1522 		}
1523 	else
1524 		printf("<Td valign=center width=100%% class='featureDisabledFlapDetection'>N/A</td>\n");
1525 	printf("</tr>\n");
1526 	printf("</table>\n");
1527 	printf("</td>\n");
1528 
1529 
1530 
1531 
1532 	printf("<td valign=top>\n");
1533 	printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n");
1534 	printf("<tr>\n");
1535 	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", COMMAND_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");
1536 	printf("<Td width=10>&nbsp;</td>\n");
1537 	if(enable_notifications == TRUE) {
1538 		printf("<Td valign=top width=100%% class='featureEnabledNotifications'>\n");
1539 		printf("<table border=0 width=100%%>\n");
1540 
1541 		if(notification_disabled_services > 0)
1542 			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");
1543 		else
1544 			printf("<tr><td width=100%% class='featureItemEnabledServiceNotifications'>All Services Enabled</td></tr>\n");
1545 
1546 		if(notification_disabled_hosts > 0)
1547 			printf("<tr><td width=100%% class='featureItemDisabledHostNotifications'><a href='%s?host=all&type=detail&hostprops=%d'>%d Host%s Disabled</a></td></tr>\n", STATUS_CGI, HOST_NOTIFICATIONS_DISABLED, notification_disabled_hosts, (notification_disabled_hosts == 1) ? "" : "s");
1548 		else
1549 			printf("<tr><td width=100%% class='featureItemEnabledHostNotifications'>All Hosts Enabled</td></tr>\n");
1550 
1551 		printf("</table>\n");
1552 		printf("</td>\n");
1553 		}
1554 	else
1555 		printf("<Td valign=center width=100%% class='featureDisabledNotifications'>N/A</td>\n");
1556 	printf("</tr>\n");
1557 	printf("</table>\n");
1558 	printf("</td>\n");
1559 
1560 
1561 
1562 
1563 
1564 	printf("<td valign=top>\n");
1565 	printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n");
1566 	printf("<tr>\n");
1567 	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", COMMAND_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");
1568 	printf("<Td width=10>&nbsp;</td>\n");
1569 	if(enable_event_handlers == TRUE) {
1570 		printf("<Td valign=top width=100%% class='featureEnabledHandlers'>\n");
1571 		printf("<table border=0 width=100%%>\n");
1572 
1573 		if(event_handler_disabled_services > 0)
1574 			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");
1575 		else
1576 			printf("<tr><td width=100%% class='featureItemEnabledServiceHandlers'>All Services Enabled</td></tr>\n");
1577 
1578 		if(event_handler_disabled_hosts > 0)
1579 			printf("<tr><td width=100%% class='featureItemDisabledHostHandlers'><a href='%s?host=all&type=detail&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");
1580 		else
1581 			printf("<tr><td width=100%% class='featureItemEnabledHostHandlers'>All Hosts Enabled</td></tr>\n");
1582 
1583 		printf("</table>\n");
1584 		printf("</td>\n");
1585 		}
1586 	else
1587 		printf("<Td valign=center width=100%% class='featureDisabledHandlers'>N/A</td>\n");
1588 	printf("</tr>\n");
1589 	printf("</table>\n");
1590 	printf("</td>\n");
1591 
1592 
1593 
1594 
1595 
1596 	printf("<td valign=top>\n");
1597 	printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n");
1598 	printf("<tr>\n");
1599 	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");
1600 	printf("<Td width=10>&nbsp;</td>\n");
1601 	if(execute_service_checks == TRUE) {
1602 		printf("<Td valign=top width=100%% class='featureEnabledActiveChecks'>\n");
1603 		printf("<table border=0 width=100%%>\n");
1604 
1605 		if(active_checks_disabled_services > 0)
1606 			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");
1607 		else
1608 			printf("<tr><td width=100%% class='featureItemEnabledActiveServiceChecks'>All Services Enabled</td></tr>\n");
1609 
1610 		if(active_checks_disabled_hosts > 0)
1611 			printf("<tr><td width=100%% class='featureItemDisabledActiveHostChecks'><a href='%s?host=all&type=detail&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");
1612 		else
1613 			printf("<tr><td width=100%% class='featureItemEnabledActiveHostChecks'>All Hosts Enabled</td></tr>\n");
1614 
1615 		printf("</table>\n");
1616 		printf("</td>\n");
1617 		}
1618 	else
1619 		printf("<Td valign=center width=100%% class='featureDisabledActiveChecks'>N/A</td>\n");
1620 	printf("</tr>\n");
1621 	printf("</table>\n");
1622 	printf("</td>\n");
1623 
1624 
1625 
1626 
1627 
1628 	printf("<td valign=top>\n");
1629 	printf("<table border=0 width=135 cellspacing=0 cellpadding=0>\n");
1630 	printf("<tr>\n");
1631 	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");
1632 	printf("<Td width=10>&nbsp;</td>\n");
1633 	if(accept_passive_service_checks == TRUE) {
1634 
1635 		printf("<Td valign=top width=100%% class='featureEnabledPassiveChecks'>\n");
1636 		printf("<table border=0 width=100%%>\n");
1637 
1638 		if(passive_checks_disabled_services > 0)
1639 			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");
1640 		else
1641 			printf("<tr><td width=100%% class='featureItemEnabledPassiveServiceChecks'>All Services Enabled</td></tr>\n");
1642 
1643 		if(passive_checks_disabled_hosts > 0)
1644 			printf("<tr><td width=100%% class='featureItemDisabledPassiveHostChecks'><a href='%s?host=all&type=detail&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");
1645 		else
1646 			printf("<tr><td width=100%% class='featureItemEnabledPassiveHostChecks'>All Hosts Enabled</td></tr>\n");
1647 
1648 		printf("</table>\n");
1649 		printf("</td>\n");
1650 		}
1651 	else
1652 		printf("<Td valign=center width=100%% class='featureDisabledPassiveChecks'>N/A</td>\n");
1653 	printf("</tr>\n");
1654 	printf("</table>\n");
1655 	printf("</td>\n");
1656 
1657 	printf("</tr>\n");
1658 
1659 	printf("</table>\n");
1660 
1661 	printf("</p>\n");
1662 
1663 
1664 	return;
1665 	}
1666 
1667