/*********************************************************************** * * TAC.C - NetSaint Tactical Monitoring Overview CGI * * Copyright (c) 2001 Ethan Galstad (netsaint@netsaint.org) * Last Modified: 10-19-2001 * * This CGI program will display the contents of the NetSaint * log file. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ***********************************************************************/ #include "../common/config.h" #include "../common/locations.h" #include "../common/common.h" #include "../common/objects.h" #include "../common/statusdata.h" #include "getcgi.h" #include "cgiutils.h" #include "auth.h" #include "lifo.h" #define HEALTH_WARNING_PERCENTAGE 90 #define HEALTH_CRITICAL_PERCENTAGE 75 /* HOSTOUTAGE structure */ typedef struct hostoutage_struct{ host *hst; int affected_child_hosts; struct hostoutage_struct *next; }hostoutage; extern char main_config_file[MAX_FILENAME_LENGTH]; extern char url_images_path[MAX_FILENAME_LENGTH]; extern char url_stylesheets_path[MAX_FILENAME_LENGTH]; extern char url_media_path[MAX_FILENAME_LENGTH]; extern int refresh_rate; extern char *service_critical_sound; extern char *service_warning_sound; extern char *service_unknown_sound; extern char *host_down_sound; extern char *host_unreachable_sound; extern char *normal_sound; extern hostgroup *hostgroup_list; extern hoststatus *hoststatus_list; extern servicestatus *servicestatus_list; extern host *host_list; extern service *service_list; extern int program_mode; extern int execute_service_checks; extern int accept_passive_service_checks; extern int enable_event_handlers; extern int enable_flap_detection; extern int netsaint_process_state; void analyze_status_data(void); void display_tac_overview(void); void find_hosts_causing_outages(void); void calculate_outage_effect_of_host(host *,int *); int is_route_to_host_blocked(host *); int number_of_host_services(host *); void add_hostoutage(host *); void free_hostoutage_list(void); void document_header(int); void document_footer(void); int process_cgivars(void); authdata current_authdata; int embedded=FALSE; int display_header=FALSE; hostoutage *hostoutage_list=NULL; int total_blocking_outages=0; int total_nonblocking_outages=0; int total_service_health=0; int total_host_health=0; int potential_service_health=0; int potential_host_health=0; double percent_service_health=0.0; double percent_host_health=0.0; int total_hosts=0; int total_services=0; int total_active_checks=0; int total_passive_checks=0; int min_execution_time=-1; int max_execution_time=-1; unsigned long total_execution_time=0L; double average_execution_time=-1.0; int min_latency=-1; int max_latency=-1; unsigned long total_latency=0L; double average_latency=-1.0; int flapping_services=0; int flapping_hosts=0; int flap_disabled_services=0; int flap_disabled_hosts=0; int notification_disabled_services=0; int notification_disabled_hosts=0; int event_handler_disabled_services=0; int event_handler_disabled_hosts=0; int active_checks_disabled_services=0; int active_checks_disabled_hosts=0; int passive_checks_disabled_services=0; int hosts_pending=0; int hosts_pending_disabled=0; int hosts_up_disabled=0; int hosts_up_unacknowledged=0; int hosts_down_scheduled=0; int hosts_down_acknowledged=0; int hosts_down_disabled=0; int hosts_down_unacknowledged=0; int hosts_unreachable_scheduled=0; int hosts_unreachable_acknowledged=0; int hosts_unreachable_disabled=0; int hosts_unreachable_unacknowledged=0; int services_pending=0; int services_pending_disabled=0; int services_ok_disabled=0; int services_ok_unacknowledged=0; int services_warning_host_problem=0; int services_warning_scheduled=0; int services_warning_acknowledged=0; int services_warning_disabled=0; int services_warning_unacknowledged=0; int services_unknown_host_problem=0; int services_unknown_scheduled=0; int services_unknown_acknowledged=0; int services_unknown_disabled=0; int services_unknown_unacknowledged=0; int services_critical_host_problem=0; int services_critical_scheduled=0; int services_critical_acknowledged=0; int services_critical_disabled=0; int services_critical_unacknowledged=0; int main(void){ int result=OK; char *sound=NULL; /* get the CGI variables passed in the URL */ process_cgivars(); /* reset internal variables */ reset_cgi_vars(); /* read the CGI configuration file */ result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); printf("
| \n"); display_info_table("Tactical Status Overview",TRUE,¤t_authdata); printf(" | \n"); /* middle column of top table - log file navigation options */ printf("\n"); printf(" | \n"); /* right hand column of top row */ printf("\n"); printf(" | \n"); /* end of top table */ printf("