/**************************************************************************
*
* OUTAGES.C - Nagios Network Outages CGI
*
* Copyright (c) 1999-2006 Ethan Galstad (nagios@nagios.org)
* Last Modified: 03-21-2006
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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 "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/comments.h"
#include "../include/statusdata.h"
#include "../include/cgiutils.h"
#include "../include/getcgi.h"
#include "../include/cgiauth.h"
extern int refresh_rate;
extern time_t program_start;
extern host *host_list;
extern service *service_list;
extern hoststatus *hoststatus_list;
extern servicestatus *servicestatus_list;
extern char main_config_file[MAX_FILENAME_LENGTH];
extern char url_html_path[MAX_FILENAME_LENGTH];
extern char url_stylesheets_path[MAX_FILENAME_LENGTH];
extern char url_images_path[MAX_FILENAME_LENGTH];
extern char url_logo_images_path[MAX_FILENAME_LENGTH];
extern char log_file[MAX_FILENAME_LENGTH];
/* HOSTOUTAGE structure */
typedef struct hostoutage_struct{
host *hst;
int severity;
int affected_child_hosts;
int affected_child_services;
unsigned long monitored_time;
unsigned long time_up;
float percent_time_up;
unsigned long time_down;
float percent_time_down;
unsigned long time_unreachable;
float percent_time_unreachable;
struct hostoutage_struct *next;
}hostoutage;
/* HOSTOUTAGESORT structure */
typedef struct hostoutagesort_struct{
hostoutage *outage;
struct hostoutagesort_struct *next;
}hostoutagesort;
void document_header(int);
void document_footer(void);
int process_cgivars(void);
void display_network_outages(void);
void find_hosts_causing_outages(void);
void calculate_outage_effects(void);
void calculate_outage_effect_of_host(host *,int *,int *);
int is_route_to_host_blocked(host *);
int number_of_host_services(host *);
void add_hostoutage(host *);
void sort_hostoutages(void);
void free_hostoutage_list(void);
void free_hostoutagesort_list(void);
authdata current_authdata;
hostoutage *hostoutage_list=NULL;
hostoutagesort *hostoutagesort_list=NULL;
int service_severity_divisor=4; /* default = services are 1/4 as important as hosts */
int embedded=FALSE;
int display_header=TRUE;
=1= |