/**************************************************************************
*
* TRENDS.C - Nagios State Trends 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"
#include <gd.h> /* Boutell's GD library function */
#include <gdfonts.h> /* GD library small font definition */
/*#define DEBUG 1*/
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 physical_images_path[MAX_FILENAME_LENGTH];
extern int log_rotation_method;
extern host *host_list;
extern service *service_list;
/* archived state types */
#define AS_CURRENT_STATE -1 /* special case for initial assumed state */
#define AS_NO_DATA 0
#define AS_PROGRAM_END 1
#define AS_PROGRAM_START 2
#define AS_HOST_UP 3
#define AS_HOST_DOWN 4
#define AS_HOST_UNREACHABLE 5
#define AS_SVC_OK 6
#define AS_SVC_UNKNOWN 7
#define AS_SVC_WARNING 8
#define AS_SVC_CRITICAL 9
#define AS_SOFT_STATE 1
#define AS_HARD_STATE 2
/* display types */
#define DISPLAY_HOST_TRENDS 0
#define DISPLAY_SERVICE_TRENDS 1
#define DISPLAY_NO_TRENDS 2
/* input types */
#define GET_INPUT_NONE 0
#define GET_INPUT_TARGET_TYPE 1
#define GET_INPUT_HOST_TARGET 2
#define GET_INPUT_SERVICE_TARGET 3
#define GET_INPUT_OPTIONS 4
/* modes */
#define CREATE_HTML 0
#define CREATE_IMAGE 1
/* standard report times */
#define TIMEPERIOD_CUSTOM 0
#define TIMEPERIOD_TODAY 1
#define TIMEPERIOD_YESTERDAY 2
#define TIMEPERIOD_THISWEEK 3
#define TIMEPERIOD_LASTWEEK 4
#define TIMEPERIOD_THISMONTH 5
#define TIMEPERIOD_LASTMONTH 6
#define TIMEPERIOD_THISQUARTER 7
#define TIMEPERIOD_LASTQUARTER 8
#define TIMEPERIOD_THISYEAR 9
#define TIMEPERIOD_LASTYEAR 10
#define TIMEPERIOD_LAST24HOURS 11
#define TIMEPERIOD_LAST7DAYS 12
#define TIMEPERIOD_LAST31DAYS 13
#define MIN_TIMESTAMP_SPACING 10
=1= |