/************************************************************************
*
* NOTIFICATIONS.C - Nagios Notifications CGI
*
* Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org)
* Last Modified: 04-10-2007
*
* This CGI program will display the notification events for
* a given host or contact or for all contacts/hosts.
*
* 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/getcgi.h"
#include "../include/cgiutils.h"
#include "../include/cgiauth.h"
extern char main_config_file[MAX_FILENAME_LENGTH];
extern char url_html_path[MAX_FILENAME_LENGTH];
extern char url_images_path[MAX_FILENAME_LENGTH];
extern char url_docs_path[MAX_FILENAME_LENGTH];
extern char url_stylesheets_path[MAX_FILENAME_LENGTH];
extern int log_rotation_method;
#define FIND_HOST 1
#define FIND_CONTACT 2
#define FIND_SERVICE 3
#define MAX_QUERYNAME_LENGTH 256
#define SERVICE_NOTIFICATION 0
#define HOST_NOTIFICATION 1
#define SERVICE_NOTIFICATION_STRING "] SERVICE NOTIFICATION:"
#define HOST_NOTIFICATION_STRING "] HOST NOTIFICATION:"
void display_notifications(void);
void document_header(int);
void document_footer(void);
int process_cgivars(void);
authdata current_authdata;
char log_file_to_use[MAX_FILENAME_LENGTH];
int log_archive=0;
int query_type=FIND_HOST;
int find_all=TRUE;
char *query_contact_name="";
char *query_host_name="";
char *query_svc_description="";
int notification_options=NOTIFICATION_ALL;
int use_lifo=TRUE;
int embedded=FALSE;
int display_header=TRUE;
int main(void){
int result=OK;
char temp_buffer[MAX_INPUT_BUFFER];
char temp_buffer2[MAX_INPUT_BUFFER];
/* get the arguments passed in the URL */
process_cgivars();
/* reset internal variables */
reset_cgi_vars();
/* read the CGI configuration file */
result=read_cgi_config_file(get_cgi_config_location());
if(result==ERROR){
document_header(FALSE);
cgi_config_file_error(get_cgi_config_location());
document_footer();
return ERROR;
}
/* read the main configuration file */
=1= |